Пример #1
0
 public void Autoris(TextBox log, PasswordBox pass, Window win)
 {
     DateBase.EMPLOYEE emp = db.EMPLOYEE.Where(c => c.login == log.Text && c.password == pass.Password).SingleOrDefault();
     if (emp == null)
     {
         pass.Clear();
         MessageBox.Show("Такой комбинации логин/пароль не существует!", "Ошибка авторизации", MessageBoxButton.OK, MessageBoxImage.Error);
         Func.CheckText(log);
     }
     else
     {
         if (emp.TITLE == "Operations Manager")
         {
             Windows.admin a = new Windows.admin(emp);
             a.Show();
             win.Close();
         }
         else if (emp.TITLE == "Loan Manager")
         {
             Windows.LoanM LM = new Windows.LoanM(emp);
             LM.Show();
             win.Close();
         }
     }
 }
Пример #2
0
 public admin(DateBase.EMPLOYEE emp)
 {
     InitializeComponent();
     dpDateStart.DisplayDateStart = DateTime.Now;
     dpDateStart.DisplayDate      = DateTime.Now;
     f.LoadEmployee(dgEmployee, cbDepartment, cbBranch, cbSuperior);
 }
Пример #3
0
 public void EditEmployee(TextBox FN, TextBox LN, TextBox Log, ComboBox branch, ComboBox title, ComboBox superior, ComboBox depart, DatePicker date, DatePicker dateEnd, DataGrid dg, TextBox mail)
 {
     DateBase.EMPLOYEE emp = dg.SelectedItem as DateBase.EMPLOYEE;
     if (emp == null)
     {
         return;
     }
     emp.FIRST_NAME         = FN.Text;
     emp.LAST_NAME          = LN.Text;
     emp.login              = Log.Text;
     emp.ASSIGNED_BRANCH_ID = (branch.SelectedItem as DateBase.BRANCH).BRANCH_ID;
     emp.DEPT_ID            = (depart.SelectedItem as DateBase.DEPARTMENT).DEPT_ID;
     emp.TITLE              = title.Text;
     if (superior.SelectedIndex != -1)
     {
         emp.SUPERIOR_EMP_ID = (superior.SelectedItem as DateBase.EMPLOYEE).EMP_ID;
     }
     emp.START_DATE = Convert.ToDateTime(date.Text);
     if (dateEnd.Text != "")
     {
         emp.END_DATE = Convert.ToDateTime(dateEnd.Text);
     }
     emp.MAIL = mail.Text;
     db.SaveChanges();
     LoadEmployee(dg, depart, branch, superior);
 }
Пример #4
0
 public void CheckUserPassword(DateBase.EMPLOYEE emp)
 {
     if (emp.password == "qwe")
     {
         Windows.ChangePassword CP = new Windows.ChangePassword(emp);
         CP.ShowDialog();
     }
 }
Пример #5
0
 public void DeleteEmployee(DataGrid dg)
 {
     DateBase.EMPLOYEE emp = dg.SelectedItem as DateBase.EMPLOYEE;
     if (emp == null)
     {
         return;
     }
     db.EMPLOYEE.Remove(emp);
     db.SaveChanges();
     dg.ItemsSource = db.EMPLOYEE.ToList();
 }
Пример #6
0
 public void SelectEmployee(TextBox FN, TextBox LN, TextBox Log, ComboBox branch, ComboBox title, ComboBox superior, ComboBox depart, DatePicker date, DatePicker dateEnd, DataGrid dg, TextBox mail)
 {
     DateBase.EMPLOYEE emp = dg.SelectedItem as DateBase.EMPLOYEE;
     if (emp == null)
     {
         return;
     }
     FN.Text               = emp.FIRST_NAME;
     LN.Text               = emp.LAST_NAME;
     Log.Text              = emp.login;
     branch.SelectedItem   = db.BRANCH.Where(c => c.BRANCH_ID == emp.ASSIGNED_BRANCH_ID).FirstOrDefault();
     title.Text            = emp.TITLE;
     superior.SelectedItem = (emp.SUPERIOR_EMP_ID == null) ? null: db.EMPLOYEE.Where(c => c.EMP_ID == emp.EMPLOYEE2.EMP_ID).SingleOrDefault();
     depart.SelectedItem   = db.DEPARTMENT.Where(c => c.DEPT_ID == emp.DEPT_ID).FirstOrDefault();
     date.Text             = emp.START_DATE.ToString();
     dateEnd.Text          = emp.END_DATE.ToString();
     mail.Text             = emp.MAIL;
 }
Пример #7
0
 public void AddEmployee(TextBox FN, TextBox LN, TextBox Log, ComboBox branch, ComboBox title, ComboBox superior, ComboBox depart, DatePicker date, DataGrid dg, TextBox mail)
 {
     DateBase.EMPLOYEE emp = new DateBase.EMPLOYEE
     {
         FIRST_NAME         = FN.Text,
         LAST_NAME          = LN.Text,
         login              = Log.Text,
         ASSIGNED_BRANCH_ID = (branch.SelectedItem as DateBase.BRANCH).BRANCH_ID,
         DEPT_ID            = (depart.SelectedItem as DateBase.DEPARTMENT).DEPT_ID,
         TITLE              = title.Text,
         password           = "******",
         START_DATE         = Convert.ToDateTime(date.Text),
         MAIL = mail.Text
     };
     db.EMPLOYEE.Add(emp);
     db.SaveChanges();
     LoadEmployee(dg, depart, branch, superior);
 }
Пример #8
0
 public ChangePassword(DateBase.EMPLOYEE emp)
 {
     InitializeComponent();
     lbMail.Content = $"Введите код с почты {emp.MAIL}";
     this.emp       = emp;
 }
Пример #9
0
 public LoanM(DateBase.EMPLOYEE emp)
 {
     InitializeComponent();
     f.CheckUserPassword(emp);
 }