Beispiel #1
0
 public Recipes(CookerForm f)
 {
     InitializeComponent();
     m_cookerForm = f;
     back_to_manager.Text = "Back to cooker routine";
 }
Beispiel #2
0
        private void yes_btn_Click(object sender, EventArgs e)
        {
            IQueryable<worker> userQuery = from w in cafeContext.worker
                                           where w.name + w.surname == login_tb.Text
                                           select w;
            if (userQuery.Any())
            {
                foreach (worker w in userQuery)
                    switch (m_departmentCallFrom)
                    {
                        case Constants.CASHIERDEP_ID:
                            if (w.department_id == Constants.CASHIERDEP_ID
                                || w.department_id == Constants.MANAGERDEP_ID)
                                if (MD5cheksum.verifyMd5Hash(pass_tb.Text, w.password))
                                {
                                    CashierFrom m_cashierForm = new CashierFrom(m_mainform);
                                    m_cashierForm.Show();
                                    this.Close();
                                }
                                else MessageBox.Show("Incorrect password");
                            else
                                MessageBox.Show("You don't have permission");
                            break;

                        case Constants.MANAGERDEP_ID:
                            if (w.department_id == Constants.MANAGERDEP_ID)
                                if (MD5cheksum.verifyMd5Hash(pass_tb.Text, w.password))
                                {
                                    ManagerForm m_managerForm = new ManagerForm(m_mainform);
                                    m_managerForm.Show();
                                    this.Close();
                                }
                                else MessageBox.Show("Incorrect password");
                            else
                                MessageBox.Show("You don't have permission");
                            break;
                        case Constants.COOCKERDEP_ID:
                            if (w.department_id == Constants.COOCKERDEP_ID)
                                if (MD5cheksum.verifyMd5Hash(pass_tb.Text, w.password))
                                {
                                    CookerForm m_cookerForm = new CookerForm(m_mainform);
                                    m_cookerForm.Show();
                                    this.Close();
                                }
                                else MessageBox.Show("Incorrect password");
                            else
                                MessageBox.Show("You don't have permission");
                            break;
                    }
            }
            else
                MessageBox.Show("No such login");
        }