public static listCollection Now() { listCollection list = new listCollection(); try { DataRow[] result = config.get(api.GetDetails(config.Barcode, config.Type)).Select(); foreach (DataRow l in result) { fieldCollections f = new fieldCollections(); f.Mid = l["mid"].ToString(); f.Code = l["code"].ToString(); f.Type = l["type"].ToString(); f.Classification = l["classification"].ToString(); f.Description = l["description"].ToString(); f.Model = l["model"].ToString(); f.Pic = l["pic"].ToString(); f.Unit = l["unit"].ToString(); f.Defect_rate = l["defect_rate"].ToString(); f.Sorting_percentage = l["sorting_percentage"].ToString(); decimal MSqty = Convert.ToDecimal(l["msq"].ToString()); f.Msq = config.format_currency(MSqty); f.Status = l["status"].ToString(); f.Total_qty = Totl_Qty(); list.Add(f); } } catch (Exception ex) { throw new Exception(ex.Message); } return list; }
public static listCollection Item(string id) { listCollection list = new listCollection(); try { DataRow[] result = dt.Select("id = " + id); foreach (DataRow l in result) { fieldCollections f = new fieldCollections(); f.Lid = l["id"].ToString(); f.Litem_id = l["item_id"].ToString(); f.Linvoice_no = l["invoice_no"].ToString(); f.Llotno = l["lot_no"].ToString(); f.Lqty = l["qty"].ToString(); f.Lremarks = l["remarks"].ToString(); f.Lunit = l["unit"].ToString(); list.Add(f); } } catch (Exception ex) { throw new Exception(ex.Message); } return list; }
public listCollection Select(string query, int[] index) { listCollection list = new listCollection(); SqlCeConnection sqlcon = new SqlCeConnection(Database.Connection); SqlCeCommand sqlcom = new SqlCeCommand(query, sqlcon); SqlCeDataReader sqldr; try { sqlcon.Open(); sqldr = sqlcom.ExecuteReader(); while (sqldr.Read()) { listFields l = new listFields(); for (int i = 0; i < index.Length; i++) { l.sqlDr[i] = sqldr[i].ToString(); } list.Add(l); } sqlcon.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } return list; }
public listCollection Select(string query, int[] index) { listCollection list = new listCollection(); SqlCeConnection sqlcon = new SqlCeConnection(Connection); SqlCeCommand sqlcom = new SqlCeCommand(query, sqlcon); SqlCeDataReader sqldr; try { sqlcon.Open(); sqldr = sqlcom.ExecuteReader(); while (sqldr.Read()) { indexCollections f = new indexCollections(); if (index.Length == 1) { f.Index0 = sqldr[index[0]].ToString(); } else if (index.Length == 2) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); } else if (index.Length == 3) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); } else if (index.Length == 4) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); } else if (index.Length == 5) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); } else if (index.Length == 6) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); f.Index5 = sqldr[index[5]].ToString(); } else if (index.Length == 7) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); f.Index5 = sqldr[index[5]].ToString(); f.Index6 = sqldr[index[6]].ToString(); } else if (index.Length == 8) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); f.Index5 = sqldr[index[5]].ToString(); f.Index6 = sqldr[index[6]].ToString(); f.Index7 = sqldr[index[7]].ToString(); } else if (index.Length == 9) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); f.Index5 = sqldr[index[5]].ToString(); f.Index6 = sqldr[index[6]].ToString(); f.Index7 = sqldr[index[7]].ToString(); f.Index8 = sqldr[index[8]].ToString(); } else if (index.Length == 10) { f.Index0 = sqldr[index[0]].ToString(); f.Index1 = sqldr[index[1]].ToString(); f.Index2 = sqldr[index[2]].ToString(); f.Index3 = sqldr[index[3]].ToString(); f.Index4 = sqldr[index[4]].ToString(); f.Index5 = sqldr[index[5]].ToString(); f.Index6 = sqldr[index[6]].ToString(); f.Index7 = sqldr[index[7]].ToString(); f.Index8 = sqldr[index[8]].ToString(); f.Index9 = sqldr[index[9]].ToString(); } list.Add(f); } return list; } catch (Exception ex) { throw new Exception(ex.Message); } return list; }
public static listCollection Item(int id) { listCollection list = new listCollection(); try { DataRow[] result = dt.Select("delivery_id = '" + id + "'"); foreach (DataRow l in result) { fieldCollections f = new fieldCollections(); delivery_id = Convert.ToInt32(l["delivery_id"].ToString()); f.PO_No = l["po_number"].ToString(); f.Delivery_Date = l["delivery_date"].ToString(); f.Supplier_Name = l["supplier_name"].ToString(); list.Add(f); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return list; }