public List <BlackItem> GetBlackList()
        {
            List <BlackItem> list = new List <BlackItem>();

            using (SqlConnection conn = new SqlConnection(_connectionstring))
            {
                conn.Open();
                SqlCommand cmd    = conn.CreateCommand();
                string     sqltxt = string.Format(@"SELECT T.VENDORNO,T.MATERIALNO,T.ASLCODE,T.LOTNO,T.DATECODE,T.TRACECODE,T.REASON FROM [WMWHSE1].[BLACKLIST] T WHERE T.STATUS=0");
                cmd.CommandText = sqltxt;
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    BlackItem item = new BlackItem();
                    item.Vendor    = reader.GetValue(0) == DBNull.Value?"":reader.GetString(0);
                    item.Sku       = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1);
                    item.Als       = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2);
                    item.LotNo     = reader.GetValue(3) == DBNull.Value ? "" : reader.GetString(3);
                    item.DateCode  = reader.GetValue(4) == DBNull.Value ? "" : reader.GetString(4);
                    item.TraceCode = reader.GetValue(5) == DBNull.Value ? "" : reader.GetString(5);
                    item.Reason    = reader.GetValue(6) == DBNull.Value ? "" : reader.GetString(6);
                    list.Add(item);
                }
            }
            return(list);
        }
 public List<BlackItem> GetBlackList() {
     List<BlackItem> list = new List<BlackItem>();
     using (SqlConnection conn = new SqlConnection(_connectionstring))
     {
         conn.Open();
         SqlCommand cmd = conn.CreateCommand();
         string sqltxt = string.Format(@"SELECT T.VENDORNO,T.MATERIALNO,T.ASLCODE,T.LOTNO,T.DATECODE,T.TRACECODE,T.REASON FROM [WMWHSE1].[BLACKLIST] T WHERE T.STATUS=0");
         cmd.CommandText = sqltxt;
         SqlDataReader reader = cmd.ExecuteReader();
         while (reader.Read()) {
             BlackItem item = new BlackItem();
             item.Vendor = reader.GetValue(0) == DBNull.Value?"":reader.GetString(0);
             item.Sku = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1);
             item.Als = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2);
             item.LotNo = reader.GetValue(3) == DBNull.Value ? "" : reader.GetString(3);
             item.DateCode = reader.GetValue(4) == DBNull.Value ? "" : reader.GetString(4);
             item.TraceCode = reader.GetValue(5) == DBNull.Value ? "" : reader.GetString(5);
             item.Reason = reader.GetValue(6) == DBNull.Value ? "" : reader.GetString(6);
             list.Add(item);
         }
     }
     return list;
 }