using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; using MESClassLibrary.BLL.Log; using MESClassLibrary.EFModel; namespace MESClassLibrary.DAL.TruckBox { public class TightenDAL { public bool AddInfo(tb_TightenInfo md) { try { string sql = @"insert into tb_TightenInfo(BarCode ,[IsOK] ,[IsOK1] ,[IsOK2] ,[IsOK3] ,[IsOK4] ,[IsOK5] ,[IsOK6] ,[IsOK7] ,[Torque1] ,[Torque2] ,[Torque3] ,[Torque4] ,[Torque5] ,[Torque6] ,[Torque7] ,[Angle1] ,[Angle2] ,[Angle3] ,[Angle4] ,[Angle5] ,[Angle6] ,[Angle7]) values(@BarCode ,@IsOK ,@IsOK1 ,@IsOK2 ,@IsOK3 ,@IsOK4 ,@IsOK5 ,@IsOK6 ,@IsOK7 ,@Torque1 ,@Torque2 ,@Torque3 ,@Torque4 ,@Torque5 ,@Torque6 ,@Torque7 ,@Angle1 ,@Angle2 ,@Angle3 ,@Angle4 ,@Angle5 ,@Angle6 ,@Angle7) "; SqlParameter[] param=new SqlParameter[23]; param[0]=new SqlParameter("@BarCode",SqlDbType.VarChar); param[0].Value = md.BarCode; param[1] = new SqlParameter("@IsOK", SqlDbType.Int); param[1].Value = md.IsOK; param[2] = new SqlParameter("@IsOK1", SqlDbType.Int); param[2].Value = md.IsOK1; param[3] = new SqlParameter("@IsOK2", SqlDbType.Int); param[3].Value = md.IsOK2; param[4] = new SqlParameter("@IsOK3", SqlDbType.Int); param[4].Value = md.IsOK3; param[5] = new SqlParameter("@IsOK4", SqlDbType.Int); param[5].Value = md.IsOK4; param[6] = new SqlParameter("@IsOK5", SqlDbType.Int); param[6].Value = md.IsOK5; param[7] = new SqlParameter("@IsOK6", SqlDbType.Int); param[7].Value = md.IsOK6; param[8] = new SqlParameter("@IsOK7", SqlDbType.Int); param[8].Value = md.IsOK7; param[9] = new SqlParameter("@Torque1", SqlDbType.Float); param[9].Value = md.Torque1; param[10] = new SqlParameter("@Torque2", SqlDbType.Float); param[10].Value = md.Torque2; param[11] = new SqlParameter("@Torque3", SqlDbType.Float); param[11].Value = md.Torque3; param[12] = new SqlParameter("@Torque4", SqlDbType.Float); param[12].Value = md.Torque4; param[13] = new SqlParameter("@Torque5", SqlDbType.Float); param[13].Value = md.Torque5; param[14] = new SqlParameter("@Torque6", SqlDbType.Float); param[14].Value = md.Torque6; param[15] = new SqlParameter("@Torque7", SqlDbType.Float); param[15].Value = md.Torque7; param[16] = new SqlParameter("@Angle1", SqlDbType.Float); param[16].Value = md.Angle1; param[17] = new SqlParameter("@Angle2", SqlDbType.Float); param[17].Value = md.Angle2; param[18] = new SqlParameter("@Angle3", SqlDbType.Float); param[18].Value = md.Angle3; param[19] = new SqlParameter("@Angle4", SqlDbType.Float); param[19].Value = md.Angle4; param[20] = new SqlParameter("@Angle5", SqlDbType.Float); param[20].Value = md.Angle5; param[21] = new SqlParameter("@Angle6", SqlDbType.Float); param[21].Value = md.Angle6; param[22] = new SqlParameter("@Angle7", SqlDbType.Float); param[22].Value = md.Angle7; SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); return true; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return false; } } } }