Ejemplo n.º 1
0
 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();
     
 }
Ejemplo n.º 2
0
 public ButtonForm(string Order,Staff sta)
 {
     InitializeComponent();
     lblName.Content = Order+"Management";
     choice = Order;
     curStaff = sta;
 }
Ejemplo n.º 3
0
 public BillWindow(Staff sta)
 {
     InitializeComponent();
     curStaff = sta;
     loadData();
     dtgBill.IsReadOnly = true;
     txtDiscount.IsEnabled = false;
     txtQuantity.Text = "1";
 }
Ejemplo n.º 4
0
 public ListWindow(string Order,Staff sta)
 {
     InitializeComponent();
     lblName2.Content = Order;
     dpSearch.Visibility = Visibility.Hidden;
     choice = Order;
     curStaff = sta;
     loadData();
     dataGrid.IsReadOnly = true;
 }
Ejemplo n.º 5
0
 public static bool UpdateStaff(Staff a)
 {
     return StaffData.UpdateStaff(a);
 }
Ejemplo n.º 6
0
 public static bool AddStaff(Staff a)
 {
     return StaffData.AddStaff(a);
 }
Ejemplo n.º 7
0
 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);
             }
         }
     }            
 }
Ejemplo n.º 8
0
 public void ShowMainForm(int power,Staff curStaff)
 {
     MainWindow frm = new MainWindow(curStaff,power);
     frm.Show();
     //this.Visibility = Visibility.Hidden;
 }