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; namespace MESClassLibrary.DAL.Mistake247 { public class MistakeDAL { public DataTable IsMath(string DeviceNo, string PartNo) { try { string sql = @"SELECT * from tb_Mistake_247 where DeviceNo=@DeviceNo and PartNo1=@PartNo"; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@DeviceNo", SqlDbType.VarChar); param[0].Value = DeviceNo; param[1] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[1].Value = PartNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchByNo(string PartNo, string deviceNo) { try { string sql = @"SELECT * from tb_Mistake_247 where PartNo1=@PartNo and DeviceNo=@deviceNo"; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[0].Value = PartNo; param[1] = new SqlParameter("@deviceNo", SqlDbType.VarChar); param[1].Value = deviceNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchPartName(string PartNo) { try { string sql = @"SELECT * from tb_Mistake_247 where [PartNo2]=@PartNo "; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[0].Value = PartNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchPartNoByDecice(string deviceNo) { try { string sql = @"SELECT * from tb_Mistake_247 where DeviceNo=@DeviceNo "; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@DeviceNo", SqlDbType.VarChar); param[0].Value = deviceNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } #region 243 public DataTable IsMath1(string DeviceNo, string PartNo) { try { string sql = @"SELECT * from tb_Mistake_243 where DeviceNo=@DeviceNo and PartNo1=@PartNo"; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@DeviceNo", SqlDbType.VarChar); param[0].Value = DeviceNo; param[1] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[1].Value = PartNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchByNo1(string PartNo, string deviceNo) { try { string sql = @"SELECT * from tb_Mistake_243 where PartNo1=@PartNo and DeviceNo=@deviceNo"; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[0].Value = PartNo; param[1] = new SqlParameter("@deviceNo", SqlDbType.VarChar); param[1].Value = deviceNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } public DataTable SearchPartName1(string PartNo) { try { string sql = @"SELECT * from tb_Mistake_243 where [PartNo2]=@PartNo "; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@PartNo", SqlDbType.VarChar); param[0].Value = PartNo; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } #endregion } }