public BindableCollection <SizeModel> GiveCollection(DataTable cs) { List <SizeModel> output = new List <SizeModel>(); foreach (DataRow row in cs.Rows) { SizeModel ctm = new SizeModel { Id = System.Convert.ToInt32(row[0].ToString()), Size = row[1].ToString(), }; output.Add(ctm); } return(new BindableCollection <SizeModel>(output)); }
public List <FactureDetailsModel> GetFactureDetailsList(int facture_id) { List <FactureDetailsModel> FactureDetailsList = new List <FactureDetailsModel>(); List <KeyValuePair <string, string[]> > Data = new List <KeyValuePair <string, string[]> >(); string[] value = new string[2] { "number", facture_id.ToString() }; Data.Add(new KeyValuePair <string, string[]>("facture_id", value)); DataTable dt = this.FindByParameters(Data); foreach (DataRow row in dt.Rows) { FactureDetailsModel fm = new FactureDetailsModel() { Id = System.Convert.ToInt32(row[0].ToString()), Facture = System.Convert.ToInt32(row[1].ToString()), Product = System.Convert.ToInt32(row[2].ToString()), }; ProductModel p = new ProductModel(); p = p.Get(fm.Product); fm.ProductName = p.Name; if (row[3].ToString() != string.Empty && System.Convert.ToInt32(row[3].ToString()) != 0) { fm.Size = System.Convert.ToInt32(row[3].ToString()); SizeModel s = new SizeModel(); fm.SizeSymbol = s.Get(fm.Size).Size; } if (row[4].ToString() != string.Empty && System.Convert.ToInt32(row[4].ToString()) != 0) { fm.Quantity = System.Convert.ToInt32(row[4].ToString()); } if (row[5].ToString() != string.Empty && System.Convert.ToDecimal(row[5].ToString()) != 0) { fm.Price = System.Convert.ToDecimal(row[5].ToString()); if (row[6].ToString() != string.Empty && System.Convert.ToInt32(row[6].ToString()) != 0) { fm.Currency = System.Convert.ToInt32(row[6].ToString()); CurrencyModel c = new CurrencyModel(); c = c.Get(fm.Currency); fm.FullPrice = fm.Price.ToString() + " " + c.Symbol; fm.Total = (fm.Price * fm.Quantity).ToString() + " " + c.Symbol; } } FactureDetailsList.Add(fm); } return(FactureDetailsList); }