public void LoadData() { mapNameAmountInStock = loadAmountofMaterial(); BUS_InventoryExport export = new BUS_InventoryExport(); DataTable temp = export.SelectDetail(selectionID); tbDescription.Text = export.SelectDescription(selectionID); Console.WriteLine(temp.Rows.Count); foreach (DataRow row in temp.Rows) { string name = row["Tên"].ToString(); string amount = row["Số lượng"].ToString(); string unit = row["Unit"].ToString(); string materID = row["MaterialID"].ToString(); list.Add(new InventoryObject() { amount = amount, name = name, unit = unit, id = materID }); if (mapNameAmountInStock.ContainsKey(name)) { mapNameAmountInStock[name] += int.Parse(amount); } } this.dataGridMaterialExport.ItemsSource = list; if (list.Count == 0) { return; } tbDescription.Text = list[0].description; }
public void LoadData() { var list = new ObservableCollection <InventoryExportDetailObject>(); BUS_InventoryExport export = new BUS_InventoryExport(); DataTable temp = export.SelectDetail(selectionID); tbDescription.Text = export.SelectDescription(selectionID); Console.WriteLine(temp.Rows.Count); foreach (DataRow row in temp.Rows) { string name = row["Tên"].ToString(); string amount = row["Số lượng"].ToString(); string unit = row["Unit"].ToString(); list.Add(new InventoryExportDetailObject() { number = list.Count + 1, amount = amount, name = name, unit = unit }); } this.dataGridMaterialExport.ItemsSource = list; }
private void btnEdit_Click(object sender, RoutedEventArgs e) { InventoryExportObject row = (InventoryExportObject)dataGridExport.SelectedItem; if (row == null) { return; } DateTime importDate = DateTime.ParseExact(row.InventoryDate, "dd/MM/yyyy", null); BUS_Parameter busParameter = new BUS_Parameter(); int limitDay = busParameter.GetValue("DayDeleteExport"); if ((DateTime.Now - importDate) > TimeSpan.FromDays(limitDay)) { MessageBox.Show($"Không thể chỉnh sửa do phiếu đã được tạo cách đây hơn {limitDay} ngày."); return; } BUS_InventoryExport export = new BUS_InventoryExport(); var screen = new InventoryExportEDIT(row.ID, row.EmployName, row.InventoryDate, export.SelectDescription(row.ID), _context); if (screen != null) { this._context.StackPanelMain.Children.Clear(); this._context.StackPanelMain.Children.Add(screen); } }