public MainWindow(Staff inStaff,int Power) { InitializeComponent(); curStaff=inStaff; if (Power == 1) { } if (Power == 2) { //StockManger: Show cái j lên thì bỏ vào đây btnStaff.IsEnabled = false; btnPayment.IsEnabled = false; btnCustomer.IsEnabled = false; btnDiscount.IsEnabled = false; btnReport.IsEnabled = false; } if (Power == 3) { //Dealer: Show cái j lên thì bỏ vào đây btnStaff.IsEnabled = false; btnDiscount.IsEnabled = false; btnReport.IsEnabled = false; } NotificationWindow noti = new NotificationWindow(); noti.Owner = Window.GetWindow(this); noti.Show(); }
public ButtonForm(string Order,Staff sta) { InitializeComponent(); lblName.Content = Order+"Management"; choice = Order; curStaff = sta; }
public BillWindow(Staff sta) { InitializeComponent(); curStaff = sta; loadData(); dtgBill.IsReadOnly = true; txtDiscount.IsEnabled = false; txtQuantity.Text = "1"; }
public ListWindow(string Order,Staff sta) { InitializeComponent(); lblName2.Content = Order; dpSearch.Visibility = Visibility.Hidden; choice = Order; curStaff = sta; loadData(); dataGrid.IsReadOnly = true; }
public static bool UpdateStaff(Staff a) { return StaffData.UpdateStaff(a); }
public static bool AddStaff(Staff a) { return StaffData.AddStaff(a); }
private void btnOK_Click(object sender, RoutedEventArgs e) { if (isValid()) { if (isUpdate) { try { Staff sta = new Staff(); //if(StaffBL.GefbyID(txt)) sta.StaffID = txtID.Text.Trim().Replace(" ",""); sta.StaffName = txtName.Text.Trim(); sta.StaffAge = int.Parse(txtAge.Text); sta.StaffRole = cbxRole.SelectedItem.ToString(); sta.StaffSalary = float.Parse(txtSalary.Text); sta.StaffPassword = txtPassword.Text.Trim(); sta.isActive = true; StaffBL.UpdateStaff(sta); System.Windows.Forms.MessageBox.Show("Success"); this.Close(); } catch (Exception ) { System.Windows.Forms.MessageBox.Show("ID is exist!"); } } else { try { Staff sta = new Staff(); sta.StaffID = txtID.Text.Trim().Replace(" ",""); sta.StaffName = txtName.Text.Trim(); sta.StaffAge = int.Parse(txtAge.Text); sta.StaffRole = cbxRole.SelectedItem.ToString(); sta.StaffSalary = float.Parse(txtSalary.Text); sta.StaffPassword = txtPassword.Text.Trim(); sta.isActive = true; StaffBL.AddStaff(sta); System.Windows.Forms.MessageBox.Show("Success"); this.Close(); } catch (Exception h) { System.Windows.Forms.MessageBox.Show("Error " + h.Message); } } } }
public void ShowMainForm(int power,Staff curStaff) { MainWindow frm = new MainWindow(curStaff,power); frm.Show(); //this.Visibility = Visibility.Hidden; }