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.Model; using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.BLL.Log; namespace MESClassLibrary.DAL.painting { public class InspectResultDAL { public static string TableName = "tb_InspectResult"; public bool AddInfo(InspectResultModel md) { try { #region 添加数据 string sql = ""; SqlParameter[] param = null; sql = "INSERT INTO " + TableName + " ([ID] ,[barcode] ,[side],[stationNo],[workClass],[inspectResult],[productInfo],[productOption] ,[InspectTimes],[createTime]"; sql += ") VALUES ("; sql += "@ID,"; sql += "@barcode,"; sql += "@side,"; sql += "@stationNo,"; sql += "@workClass,"; sql += "@inspectResult,"; sql += "@productInfo,"; sql += "@productOption,"; sql += "@InspectTimes,"; sql += "@createTime)"; #region 添加参数 param = new SqlParameter[10]; param[0] = new SqlParameter("@ID", SqlDbType.VarChar); param[0].Value = md.ID; param[1] = new SqlParameter("@barcode", SqlDbType.VarChar); param[1].Value = md.barcode; param[2] = new SqlParameter("@side", SqlDbType.VarChar); param[2].Value = md.side; param[3] = new SqlParameter("@stationNo", SqlDbType.VarChar); param[3].Value = md.stationNo; param[4] = new SqlParameter("@workClass", SqlDbType.VarChar); param[4].Value = md.workClass; param[5] = new SqlParameter("@inspectResult", SqlDbType.VarChar); param[5].Value = md.inspectResult; param[6] = new SqlParameter("@productInfo", SqlDbType.VarChar); param[6].Value = md.productInfo; param[7] = new SqlParameter("@productOption", SqlDbType.VarChar); param[7].Value = md.productOption; param[8] = new SqlParameter("@InspectTimes", SqlDbType.VarChar); param[8].Value = md.InspectTimes; param[9] = new SqlParameter("@createTime", SqlDbType.DateTime); param[9].Value = md.createTime; #endregion SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); #endregion return true; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return false; } } } }