public WareHouseModel(WareHouseModel source) { Id = source.Id; Code = source.Code; Name = source.Name; Location = source.Location; }
public List<WareHouseModel> FetchAll() { List<CloneableDictionary<string, string>> table = db.SelectMultiple("select * from warehouse"); foreach (var row in table) { var temp = new WareHouseModel(); var clone = row.Clone(); temp.Id = int.Parse(row["warehouse_id"]); temp.Code = row["code"].ToString(); temp.Name = row["name"]; temp.Location = row["location"]; _warehouses.Add(temp); } return _warehouses; }
public List <WareHouseModel> FetchAll() { List <CloneableDictionary <string, string> > table = db.SelectMultiple("select * from warehouse"); foreach (var row in table) { var temp = new WareHouseModel(); var clone = row.Clone(); temp.Id = int.Parse(row["warehouse_id"]); temp.Code = row["code"].ToString(); temp.Name = row["name"]; temp.Location = row["location"]; _warehouses.Add(temp); } return(_warehouses); }
private void fillForm() { foreach (var trans in transaction.FetchAll()) if (trans.TransactionNumber == SelectedTransactionNumber) { //transaction type foreach (var transType in transactionType.FetchAll()) if (transType.Code == trans.TransactionCode) { IndexTransactionType = transType.Id; SelectedTransactionType = transType; break; } //document number DocumentNumber = trans.DocumentNumber; //transaction date TransactionDate = trans.TransactionDate.ToString("MM/dd/yyyy"); //warehouse foreach (var wh in warehouse.FetchAll()) { if (wh.Code == trans.SourceWarehouseCode) { IndexSourceWarehouse = wh.Id; //strSourceWarehouse[0] = wh.Code; //strSourceWarehouse[1] = wh.Name; //SelectedSourceWarehouse.Code = strSourceWarehouse[0]; //SelectedSourceWarehouse.Name = strSourceWarehouse[1]; selectedSourceWarehouse = wh; break; } } foreach (var wh2 in warehouse.FetchAll()) { if (wh2.Code == trans.DestinationWarehouseCode) { IndexDestinationWarehouse = wh2.Id; SelectedDestinationWarehouse = wh2; //new WareHouseModel(wh2); } break; } //location foreach (var loc in location.FetchAll()) { if (loc.Code == trans.SourceLocationCode) { IndexSourceLocation = loc.Id; SelectedSourceLocation = loc; //new LocationModel(loc); } break; } foreach (var loc2 in location.FetchAll()) { if (loc2.Code == trans.DestinationLocationCode) { IndexDestinationLocation = loc2.Id; SelectedDestinationLocation = loc2; //new LocationModel(loc2); } break; } //price category switch (trans.PriceCategory) { case "Selling Price": IndexPriceCategory = 1; break; case "Purchase Price": IndexPriceCategory = 2; break; } //price type switch (trans.PriceType) { case "Current": IndexPriceType = 1; break; case "3 Months Ago": IndexPriceType = 2; break; case "6 Months Ago": IndexPriceType = 3; break; } //reason code foreach (var reason in reason.FetchAll()) { if (reason.ReasonCode == trans.ReasonCode) { IndexReason = int.Parse(reason.ReasonCode.Substring(2)); SelectedReason = reason; //new ReasonsModel(reason); break; } } //comment Comment = trans.Comment; } }