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); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { InventoryExportObject row = (InventoryExportObject)dataGridExport.SelectedItem; //get time of import 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ể xóa do phiếu đã được tạo cách đây hơn {limitDay} ngày."); return; } System.Windows.Media.Effects.BlurEffect objBlur = new System.Windows.Media.Effects.BlurEffect(); ((MainWindow)App.Current.MainWindow).Opacity = 0.5; ((MainWindow)App.Current.MainWindow).Effect = objBlur; Window window = new Window { ResizeMode = ResizeMode.NoResize, WindowStyle = WindowStyle.None, Title = "Xóa phiếu xuất kho! ", Content = new PopupDeleteConfirm(this, row.ID), //delete message Width = 420, Height = 210, WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.ShowDialog(); this.tbNumPage.Text = "1"; this.btBack.IsEnabled = false; if ((int)lblMaxPage.Content == 1) { this.btNext.IsEnabled = false; } else { this.btNext.IsEnabled = true; } ((MainWindow)App.Current.MainWindow).Opacity = 1; ((MainWindow)App.Current.MainWindow).Effect = null; }
private void btnWatch_Click(object sender, RoutedEventArgs e) { InventoryExportObject row = (InventoryExportObject)dataGridExport.SelectedItem; if (row != null) { System.Windows.Media.Effects.BlurEffect objBlur = new System.Windows.Media.Effects.BlurEffect(); ((MainWindow)App.Current.MainWindow).Opacity = 0.5; ((MainWindow)App.Current.MainWindow).Effect = objBlur; Window window = new Window { ResizeMode = ResizeMode.NoResize, WindowStyle = WindowStyle.None, Title = "Chi tiết phiếu xuất", Content = new PopupInventoryExportDETAIL(row.ID, row.EmployName, row.InventoryDate), Height = 630, Width = 500, WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.ShowDialog(); ((MainWindow)App.Current.MainWindow).Opacity = 1; ((MainWindow)App.Current.MainWindow).Effect = null; } }