protected override void OnNavigatedTo(NavigationEventArgs e) { using (DBContext dbCtx = new DBContext()) { inventoryHeader = (InventoryHeader)e.Parameter; if (inventoryHeader.DocumentID != null) { inventoryHeader = dbCtx.InventoryHeaders.First(x => x.DocumentID == inventoryHeader.DocumentID); DocumentIDTb.Text = inventoryHeader.DocumentID; DescriptionTb.Text = inventoryHeader.Description; Warehouse warehouse = dbCtx.Warehouses.Single(x => x.WarehouseName == inventoryHeader.WarehouseName); if (warehouse != null) { WarehouseNameCb.SelectedIndex = WarehousesColl.IndexOf(WarehousesColl.FirstOrDefault(x => x.WarehouseName == inventoryHeader.WarehouseName)); } InventoryDateDP.Date = inventoryHeader.InventoryDate; dbCtx.InventoryHeaders.Attach(inventoryHeader); BindInventoryList(); } else { inventoryHeader = new InventoryHeader(""); DocumentIDTb.Text = inventoryHeader.DocumentID; dbCtx.InventoryHeaders.Add(inventoryHeader); dbCtx.SaveChanges(); } } }
private async void SaveInventoryHeaderButton_Click(object sender, RoutedEventArgs e) { using (DBContext dbCtx = new DBContext()) { InventoryHeader inventoryHeader = dbCtx.InventoryHeaders.First(x => x.DocumentID == DocumentIDTb.Text); dbCtx.Attach(inventoryHeader); var warehouse = WarehouseNameCb.SelectedItem as Warehouse; if (warehouse != null) { inventoryHeader.DocumentID = DocumentIDTb.Text; inventoryHeader.Description = DescriptionTb.Text; inventoryHeader.InventoryDate = Convert.ToDateTime(InventoryDateDP.Date.ToString()); inventoryHeader.WarehouseName = warehouse.WarehouseName; string errorMsg = InvMgt.isInventoryHeaderValid(inventoryHeader); if (String.IsNullOrEmpty(errorMsg)) { dbCtx.SaveChanges(); this.Frame.Navigate(typeof(MainPage), "BackToInventoryHeaderList"); } else { MessageDialog message = new MessageDialog(errorMsg, "Operacja przerwana"); await message.ShowAsync(); return; } } } }
public ViewStockReceivingDetailsUI(string pInventoryHeaderId) { InitializeComponent(); loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); lInventoryHeaderId = pInventoryHeaderId; }
public async Task <IActionResult> PutInventoryHeader(int id, InventoryHeader inventoryHeader) { if (id != inventoryHeader.ID) { return(BadRequest()); } _context.Entry(inventoryHeader).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryHeaderExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public StockReceivingDetailUI(string pInventoryId) { InitializeComponent(); lOperation = GlobalVariables.Operation.Edit; loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loSupplier = new Supplier(); loStock = new Stock(); loStockReceivingDetailRpt = new StockReceivingDetailRpt(); loReportViewer = new ReportViewerUI(); lInventoryId = pInventoryId; }
public StockWithdrawalDetailUI() { InitializeComponent(); loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loCustomer = new Customer(); loStock = new Stock(); lOperation = GlobalVariables.Operation.Add; loStockReceivingDetailRpt = new StockReceivingDetailRpt(); loReportViewer = new ReportViewerUI(); lInventoryId = ""; }
public StockWithdrawalDetailUI(string pInventoryId) { InitializeComponent(); lOperation = GlobalVariables.Operation.Edit; loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loCustomer = new Customer(); loSalesIncharge = new SalesIncharge(); loStock = new Stock(); loStockReceivingDetailRpt = new StockReceivingDetailRpt(); loReportViewer = new ReportViewerUI(); lInventoryId = pInventoryId; }
public StockWithdrawalUI() { InitializeComponent(); loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loCommon = new Common(); loStockWithdrawalRpt = new StockWithdrawalRpt(); loStockWithdrawalDetailRpt = new StockWithdrawalDetailRpt(); loReportViewer = new ReportViewerUI(); ldtHeader = new System.Data.DataTable(); ldtDetail = new System.Data.DataTable(); }
public StockReceivingUI() { InitializeComponent(); loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loCommon = new Common(); loStockReceivingRpt = new StockReceivingRpt(); loStockReceivingDetailRpt = new StockReceivingDetailRpt(); loReportViewer = new ReportViewerUI(); ldtStockReceiving = new System.Data.DataTable(); ldtStockReceivingDetail = new System.Data.DataTable(); }
public StockAdjustmentUI() { InitializeComponent(); loInventoryHeader = new InventoryHeader(); loInventoryDetail = new InventoryDetail(); loCommon = new Common(); loStockAdjustmentRpt = new StockAdjustmentRpt(); loStockAdjustmentDetailRpt = new StockAdjustmentDetailRpt(); loReportViewer = new ReportViewerUI(); ldtStockAdjustment = new System.Data.DataTable(); ldtStockAdjustmentDetail = new System.Data.DataTable(); }
public async Task <ActionResult <InventoryHeader> > PostInventoryHeader(string itemcode, InventoryHeader inventoryHeader) { var items = _context.Inventory_Headers.Where(x => x.Item_Code == itemcode).Distinct().Count(); if (items == 0) { _context.Inventory_Headers.Add(inventoryHeader); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInventoryHeader", new { id = inventoryHeader.ID }, inventoryHeader)); } return(Ok("Item exist")); }
private void InventoryHeaderList_Tapped(object sender, TappedRoutedEventArgs e) { InventoryHeader inventoryHeader = InventoryHeaderList.SelectedItem as InventoryHeader; Frame.Navigate(typeof(InventoryHeaderPage), inventoryHeader); }