一厂MES,含注塑,喷涂,冲孔
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.5 KiB

3 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.Model;
namespace MESClassLibrary.DAL.ExchangeCenter
{
public class GetNewTasksDAL
{
public static string TableName = "tb_GetNewTasks";
public bool AddInfo(GetNewTasksModel md)
{
try
{
#region 添加数据
string sql = "";
SqlParameter[] param = null;
sql = "INSERT INTO " + TableName + " ([TaskState] ,[TaskID] ,[TableName],[TableName2],[TableName3],[Creator],[DataCount],[Subscriber] ,[FailedCount],[FailedInfo],[Domain],[Site],[GUID] ,[UID],[CreateUser],[CreateTime],[Remark],[UpdateUser] ,[UpdateTime],[IsChecked]";
sql += ") VALUES (";
sql += "@TaskState,";
sql += "@TaskID,";
sql += "@TableName,";
sql += "@TableName2,";
sql += "@TableName3,";
sql += "@Creator,";
sql += "@DataCount,";
sql += "@Subscriber,";
sql += "@FailedCount,";
sql += "@FailedInfo,";
sql += "@Domain,";
sql += "@Site,";
sql += "@GUID,";
sql += "@UID,";
sql += "@CreateUser,";
sql += "@CreateTime,";
sql += "@Remark,";
sql += "@UpdateUser,";
sql += "@UpdateTime,";
sql += "@IsChecked)";
#region 添加参数
param = new SqlParameter[20];
param[0] = new SqlParameter("@TaskState", SqlDbType.VarChar);
param[0].Value = md.TaskState;
param[1] = new SqlParameter("@TaskID", SqlDbType.VarChar);
param[1].Value = md.TaskID;
param[2] = new SqlParameter("@TableName", SqlDbType.VarChar);
param[2].Value = md.TableName;
param[3] = new SqlParameter("@TableName2", SqlDbType.VarChar);
param[3].Value = md.TableName2;
param[4] = new SqlParameter("@TableName3", SqlDbType.VarChar);
param[4].Value = md.TableName3;
param[5] = new SqlParameter("@Creator", SqlDbType.VarChar);
param[5].Value = md.Creator;
param[6] = new SqlParameter("@DataCount", SqlDbType.VarChar);
param[6].Value = md.DataCount;
param[7] = new SqlParameter("@Subscriber", SqlDbType.VarChar);
param[7].Value = md.Subscriber;
param[8] = new SqlParameter("@FailedCount", SqlDbType.VarChar);
param[8].Value = md.FailedCount;
param[9] = new SqlParameter("@FailedInfo", SqlDbType.VarChar);
param[9].Value = md.FailedInfo;
param[10] = new SqlParameter("@Domain", SqlDbType.VarChar);
param[10].Value = md.Domain;
param[11] = new SqlParameter("@Site", SqlDbType.VarChar);
param[11].Value = md.Site;
param[12] = new SqlParameter("@GUID", SqlDbType.VarChar);
param[12].Value = md.GUID;
param[13] = new SqlParameter("@UID", SqlDbType.VarChar);
param[13].Value = md.UID;
param[14] = new SqlParameter("@CreateUser", SqlDbType.VarChar);
param[14].Value = md.CreateUser;
param[15] = new SqlParameter("@CreateTime", SqlDbType.VarChar);
param[15].Value = md.CreateTime;
param[16] = new SqlParameter("@Remark", SqlDbType.VarChar);
param[16].Value = md.Remark;
param[17] = new SqlParameter("@UpdateUser", SqlDbType.VarChar);
param[17].Value = md.UpdateUser;
param[18] = new SqlParameter("@UpdateTime", SqlDbType.VarChar);
param[18].Value = md.UpdateTime;
param[19] = new SqlParameter("@IsChecked", SqlDbType.VarChar);
param[19].Value = md.IsChecked;
#endregion
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
#endregion
return true;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}