Example #1
0
        private void btn_select_Click(object sender, EventArgs e)
        {
            Menecer_name selectedMenecer = (Menecer_name)Enum.Parse(typeof(Menecer_name), this.selectedItem);

            Menecer menecer = new Menecer(form, selectedMenecer);

            menecer.Show();
            this.Hide();
        }
Example #2
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            foreach (Person prs in person)
            {
                if (txt_email.Text == prs.Email)
                {
                    if ((txt_name.Text == prs.Name) && (txt_password.Text == prs.Password))
                    {
                        prs.Role = (Role)Enum.Parse(typeof(Role), cmb_role.SelectedItem.ToString());

                        if (prs.Role == Role.Ofisant)
                        {
                            Ofisant sendedOfisant = (Ofisant)Enum.Parse(typeof(Ofisant), prs.Name);
                            Orders  orders        = new Orders(form, sendedOfisant);
                            orders.Show();
                            this.Hide();
                        }
                        else if (prs.Role == Role.Menecer)
                        {
                            Menecer_name selectedMenecer = (Menecer_name)Enum.Parse(typeof(Menecer_name), prs.Name);
                            Menecer      menecer         = new Menecer(this.form, selectedMenecer);
                            menecer.Show();
                            this.Hide();
                        }
                        else if (prs.Role == Role.Admin)
                        {
                            Admin admin = new Admin(this.form);
                            admin.Show();
                            this.Hide();
                        }

                        MessageBox.Show("You are succesfull Logined");
                        break;
                    }
                    else
                    {
                        MessageBox.Show("Email or password invalid");
                        break;
                    }
                }
            }
        }