private void Btn_Cancel_Click(object sender, RoutedEventArgs e) { CustomerHome ch = new CustomerHome(); ch.Show(); Close(); }
private void BtnLogin_Click(object sender, RoutedEventArgs e) { CustomerHome customer = new CustomerHome(); try { Users newUser = new Users(); AuthenticationValidation user = new AuthenticationValidation(); newUser.LoginID = (txtloginID.Text); id = newUser.LoginID; newUser.Password = txtPassword.Password.ToString(); string userRole = user.Login_BLL(newUser); if (userRole.ToLower() == "customer") { MessageBox.Show(string.Format("Login Successful"), "Login Window"); customer.EmployeeMenu.Visibility = Visibility.Hidden; customer.AdminMenu.Visibility = Visibility.Hidden; customer.Show(); Close(); } else if (userRole.ToLower() == "employee") { MessageBox.Show(string.Format("Login Successful"), "Login Window"); customer.CustomerMenu.Visibility = Visibility.Hidden; customer.AdminMenu.Visibility = Visibility.Hidden; customer.Show(); Close(); } else if (userRole.ToLower() == "admin") { MessageBox.Show(string.Format("Login Successful"), "Login Window"); customer.CustomerMenu.Visibility = Visibility.Hidden; customer.EmployeeMenu.Visibility = Visibility.Hidden; customer.Show(); Close(); } else { MessageBox.Show(string.Format("Invalid Login"), "Login Window"); } } catch (UsersException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Btn_EmpRegister_Click(object sender, RoutedEventArgs e) { Employee emp = new Employee(); emp.EmployeeName = txt_EName.Text.ToString(); emp.EmailID = txt_Email.Text; emp.PhoneNumber = long.Parse(txt_Phone.Text.ToString()); emp.Designation = txt_Desgn.Text.ToString(); emp.Address = txt_Address.Text; emp.DrivingLicenseNumber = txt_License.Text.ToString(); Users users = new Users(); users.LoginID = (txt_LoginID.Text); users.Password = txt_Password.Password.ToString(); users.Role = "Employee"; //users.EmployeeID = 0; EmployeeValidations ev = new EmployeeValidations(); try { if (ev.AddEmployee_BLL(emp, users) != 0) { MessageBox.Show("Employee Details are added"); CustomerHome ch = new CustomerHome(); ch.Show(); Close(); } else { throw new EmployeeException("Entered details are not correct"); } } catch (EmployeeException ex) { MessageBox.Show(ex.Message); } }
//Sign Up for Customer private void Btn_SignUp_Click(object sender, RoutedEventArgs e) { Customer cust = new Customer(); cust.CustomerName = txt_Name.Text.ToString(); cust.EmailID = txt_Email.Text; cust.PhoneNumber = long.Parse(txt_PhoneNumber.Text); cust.Address = txt_Address.Text; Users users = new Users(); users.LoginID = (txt_LoginID.Text); users.Password = txt_Password.Password.ToString(); users.Role = "Customer"; //users.EmployeeID = 0; CustomerValidations cv = new CustomerValidations(); try { if (cv.AddCustomer_BLL(cust, users) != 0) { MessageBox.Show("Customer Details are added"); CustomerHome ch = new CustomerHome(); ch.Show(); Close(); } else { throw new CustomerException("Enter details are not correct"); } } catch (CustomerException ex) { MessageBox.Show(ex.Message); } }