private void BtnAcessSales(object sender, RoutedEventArgs e) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { MessageBox.Show("Initial" + idlog); CashierScreen obj = new CashierScreen(); obj.idlog = da.saveLoginEmployee(txtUsername); mw.MainFrame.Content = obj; } }
private void BtnLogin(object sender, RoutedEventArgs e) { Employee emp = new Employee(); if (!(txtUserName.Text.Equals("") || txtPass.Password.Equals(""))) { emp.Username = txtUserName.Text; emp.Password = txtPass.Password; if (da.SignIn(emp) != null) { if (da.SignIn(emp).Equals("Cashier")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { CashierScreen obj = new CashierScreen(); obj.idlog = da.saveLoginEmployee(txtUserName.Text); mw.MainFrame.Content = obj; mw.btnLogout.Visibility = Visibility.Visible; } } else if (da.SignIn(emp).Equals("Supervisor")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { Supervisor obj = new Supervisor(); obj.idlog = da.saveLoginEmployee(txtUserName.Text); obj.txtUsername = txtUserName.Text; mw.MainFrame.Content = obj; mw.btnLogout.Visibility = Visibility.Visible; } } else if (da.SignIn(emp).Equals("You dont have acess you no longer working here")) { MessageBox.Show("" + (da.SignIn(emp))); } else { MessageBox.Show("Wrong username or password"); } } else { MessageBox.Show("Wrong username or password"); } } else { MessageBox.Show("Username/Password cant be empty"); } }