using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection; using System.Text; using MESClassLibrary.BLL.Log; namespace MESClassLibrary.DAL.Mistake247 { public class ToVisualDAL { public bool AddInfo(string PartNo,string tableName) { try { string sql = @" insert into " + tableName + " (PartNo) values('" + PartNo + @"')"; SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, null); return true; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return false; } } public DataTable SearchInfoByPartNo(string PartNo, string tableName) { try { string sql = @"select ID from " + tableName + " where PartNo='" + PartNo + @"' and ToVisual=0"; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return null; } } public bool IsVisual(string tableName) { try { bool res = false; string sql = @"select ID from " + tableName + " where ToVisual=1"; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; if (dt != null && dt.Rows.Count > 0) { res = false; } else { res = true; } return res; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); return false; } } } }