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 InspectionDAL { public bool AddInfo(tb_Inspection_tx md) { try { string sql = @"insert into tb_Inspection_tx(BarCode,IsOK,Station) values(@BarCode,@IsOK,@Station)"; SqlParameter[] param=new SqlParameter[3]; 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("@Station", SqlDbType.Int); param[2].Value = md.Station; SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); return true; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return false; } } public DataTable SearchInfoByCode(string barCode) { try { string sql = @"select top 1 * from tb_Inspection_tx where BarCode='" + barCode + @"' order by id desc"; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } } }