private void InsertButton_Click(object sender, RoutedEventArgs e) { SupplierWindow supplierWindow = new SupplierWindow(); supplierWindow.EnterButton.Content = "Добавить"; supplierWindow.Show(); }
// mọi thứ xử lý sẽ nằm trong này public MainViewModel() { //mở các window loadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => { isLoginLoaded = true; if (p == null) { return; } p.Hide(); LoginWindow loginWindow = new LoginWindow(); loginWindow.ShowDialog(); if (loginWindow.DataContext == null) { return; } //lấy quyền truy cập var loginVM = loginWindow.DataContext as LoginViewModel; level = loginVM.level; if (loginVM.isLogin) { p.Show(); } else { p.Close(); } p.Show(); }); goodsCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { var w = new GoodsWindow(); w.ShowDialog(); }); staffCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { if (true == level) { var w = new StaffWindow(); w.ShowDialog(); } else { MessageBox.Show("Bạn không có quyền truy cập mục này!"); } }); supplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { var w = new SupplierWindow(); w.ShowDialog(); }); customerCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { var w = new CustomerWindow(); w.ShowDialog(); }); }
public void HandleSuppliers() { var view = new SupplierWindow(); var presenter = new SupplierPresenter(view, this, supplierRepository); presenter.Initialize(); view.ShowDialog(); }
public MainViewModel() { IsLoaded = false; LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => { IsLoaded = true; if (p == null) { return; } p.Hide(); LoginWindow loginWindow = new LoginWindow(); loginWindow.ShowDialog(); if (loginWindow.DataContext == null) { return; } var loginVM = loginWindow.DataContext as LoginViewModel; if (loginVM.IsLogin) { p.Show(); } else { p.Close(); } }); UnitCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow window = new UnitWindow(); window.ShowDialog(); }); SupplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SupplierWindow window = new SupplierWindow(); window.ShowDialog(); }); }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { try { Supplier supplier = (Supplier)SuppliersDataGrid.SelectedItem; SupplierWindow supplierWindow = new SupplierWindow(); supplierWindow.SupplierNameTextBox.Text = supplier.SupplierName; supplierWindow.SupplierNameTextBox.IsEnabled = false; supplierWindow.TelTextBox.Text = supplier.Tel; supplierWindow.EnterButton.Content = "Сохранить"; supplierWindow.Show(); } catch { } }
/// <summary> /// 打开供应商 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiSupplier_Click(object sender, EventArgs e) { if (null == supplierWindow || supplierWindow.IsDisposed) { supplierWindow = new SupplierWindow(); supplierWindow.MdiParent = this; supplierWindow.StartLoad += (obj, ev) => { StartLoad(obj); }; supplierWindow.StopLoad += (obj, ev) => { StopLoad(obj); }; supplierWindow.Show(); } SetSelect(null, tsmiSupplier); supplierWindow.Activate(); }
private void miSupplier_Click(object sender, RoutedEventArgs e) { SupplierWindow window = new SupplierWindow(); window.Show(); }
// mọi thứ xử lý sẽ nằm trong này public MainViewModel() { LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => { Isloaded = true; p.Hide(); LoginWindow loginWindow = new LoginWindow(); loginWindow.ShowDialog(); p.Show(); } ); UnitCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow wd = new UnitWindow(); wd.ShowDialog(); }); SupplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); }); CustomerCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); }); ObjectCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ObjectWindow wd = new ObjectWindow(); wd.ShowDialog(); }); UserCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UserWindow wd = new UserWindow(); wd.ShowDialog(); }); InputCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow wd = new InputWindow(); wd.ShowDialog(); }); OutputCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow wd = new OutputWindow(); wd.ShowDialog(); }); }
public MainViewModel() { ImportWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } ImportWindow wd = new ImportWindow(); wd.ShowDialog(); }); SellWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { SellWindow wd = new SellWindow(); wd.ShowDialog(); }); CustomerWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); }); ProductWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } ProductWindow wd = new ProductWindow(); wd.ShowDialog(); }); SupplierWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); }); StatisticalWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } StatisticalWindow wd = new StatisticalWindow(); wd.ShowDialog(); }); UnitWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } UnitWindow wd = new UnitWindow(); wd.ShowDialog(); }); UserListWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } UserListWindow wd = new UserListWindow(); wd.ShowDialog(); }); AccountCreateWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } AccountCreateWindow wd = new AccountCreateWindow(); wd.ShowDialog(); }); BillWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } BillWindow wd = new BillWindow(); wd.ShowDialog(); }); LoadMainWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (!isLoaded) { isLoaded = true; if (p == null) { return; } p.Hide(); LoginWindow wd = new LoginWindow(); wd.ShowDialog(); var loginViewModel = wd.DataContext as LoginViewModel; if (loginViewModel == null) { return; } if (loginViewModel.isLogin) { loadUserCurrentLogin(); p.Show(); } else { p.Close(); } } }); LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); }); }
public MainWindowViewModel() { LoadMainWindowCommand = new RelayCommand <Window>(p => { return(p == null ? false : true); }, p => { LoadStockInTradeData(); }); LoadChildWindowCommand = new RelayCommand <Button>(p => { return(p == null ? false : true); }, p => { switch (p.Name) { case "btnStockin": InputWindow inputWindow = new InputWindow(); FrameworkElement window1 = Window.GetWindow(p); var temp1 = window1 as Window; inputWindow.Owner = temp1; inputWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Import; inputWindow.ShowDialog(); break; case "btnStockout": OutputWindow outputWindow = new OutputWindow(); FrameworkElement window2 = Window.GetWindow(p); var temp2 = window2 as Window; outputWindow.Owner = temp2; outputWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Export; outputWindow.ShowDialog(); break; case "btnSupplies": SuppliesWindow suppliesWindow = new SuppliesWindow(); FrameworkElement window3 = Window.GetWindow(p); var temp3 = window3 as Window; suppliesWindow.Owner = temp3; suppliesWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.PackageVariantClosed; suppliesWindow.ShowDialog(); break; case "btnUnit": UnitWindow unitWindow = new UnitWindow(); FrameworkElement window4 = Window.GetWindow(p); var temp4 = window4 as Window; unitWindow.Owner = temp4; unitWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ChartScatterPlotHexbin; unitWindow.ShowDialog(); break; case "btnSupplier": SupplierWindow supplierWindow = new SupplierWindow(); FrameworkElement window5 = Window.GetWindow(p); var temp5 = window5 as Window; supplierWindow.Owner = temp5; supplierWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Factory; supplierWindow.ShowDialog(); break; case "btnCustomer": CustomerWindow customerWindow = new CustomerWindow(); FrameworkElement window6 = Window.GetWindow(p); var temp6 = window6 as Window; customerWindow.Owner = temp6; customerWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountMultiple; customerWindow.ShowDialog(); break; case "btnUser": UserWindow userWindow = new UserWindow(); FrameworkElement window7 = Window.GetWindow(p); var temp7 = window7 as Window; userWindow.Owner = temp7; userWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountEdit; userWindow.ShowDialog(); break; } }); }
public MainViewModel() { LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => { Isloaded = true; if (p == null) { return; } p.Hide(); LoginWindow loginWindow = new LoginWindow(); loginWindow.ShowDialog(); if (loginWindow == null) { return; } var loginVM = loginWindow.DataContext as LoginViewModel; if (loginVM.Islogin) { p.Show(); } else { p.Close(); } }); UnitWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow Unitwd = new UnitWindow(); Unitwd.ShowDialog(); }); SupplierWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SupplierWindow Supplierwd = new SupplierWindow(); Supplierwd.ShowDialog(); }); CustomerWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomerWindow Cuswd = new CustomerWindow(); Cuswd.ShowDialog(); }); ObjectWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ObjectWindow Objwd = new ObjectWindow(); Objwd.ShowDialog(); }); UserWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UserWindow Userwd = new UserWindow(); Userwd.ShowDialog(); }); InputWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow Inputwd = new InputWindow(); Inputwd.ShowDialog(); }); OutputWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow Outputwd = new OutputWindow(); Outputwd.ShowDialog(); }); }