private void UpdateWarehouses() { var oldSelectedWarehouse = _selectedWarehouse; Warehouses.Clear(); var allWarehouse = new Warehouse { ID = -1, Name = "All" }; Warehouses.Add(new WarehouseVM { Model = allWarehouse }); using (var context = new ERPContext()) { var warehousesFromDatabase = context.Warehouses.OrderBy(warehouse => warehouse.Name); foreach (var warehouse in warehousesFromDatabase) { Warehouses.Add(new WarehouseVM { Model = warehouse }); } } UpdateSelectedWarehouse(oldSelectedWarehouse); }
private void ResetTransaction() { NewEntryVM.ResetEntryFields(); NewEntryVM.NewEntryWarehouse = null; IsTransactionNotPaid = true; NotEditMode = true; IsTransactionTaxCheckBoxSelected = false; Model = new PurchaseTransaction(); TransactionSupplier = null; TransactionDOID = null; TransactionTax = 0; TransactionDiscount = 0; TransactionNote = null; TransactionDate = UtilityMethods.GetCurrentDate().Date; TransactionDueDate = UtilityMethods.GetCurrentDate().Date; Warehouses.Clear(); SupplierItems.Clear(); DisplayedLines.Clear(); UpdateSuppliers(); OnPropertyChanged("TransactionGrossTotal"); OnPropertyChanged("TransactionNetTotal"); SetTransactionID(); }
public void UpdateWarehouses() { Warehouses.Clear(); using (var context = new ERPContext()) { var warehouses = context.Warehouses.OrderBy(warehouse => warehouse.Name); foreach (var warehouse in warehouses) { Warehouses.Add(new WarehouseVM { Model = warehouse }); } } }
public async void InitAsync() { Warehouses.Clear(); IEnumerable <Warehouse> allWarehouse = null; await Task.Run(() => { using var db = MyDbContext.Instance; allWarehouse = MyDbContext.Instance.Warehouses.AsEnumerable(); }); foreach (var i in allWarehouse) { if (i.Available) { Warehouses.Add(i); } } }