Exemplo n.º 1
0
        // Made by Jelle de Vries
        private void CheckCredentials()
        {
            ChapooLogic.Employee_Service service        = new ChapooLogic.Employee_Service();
            ChapooLogic.Function_Service functieService = new ChapooLogic.Function_Service();
            // check if input is is valid input
            if (string.IsNullOrEmpty(txt_User.Text) || string.IsNullOrEmpty(txt_Pass.Text) || !int.TryParse(txt_User.Text, out int id))
            {
                lbl_Error.Text = "Incorrect Username/Password";
            }
            //assign values to var
            string   password        = txt_Pass.Text;
            Employee huidigGebruiker = new Employee();

            huidigGebruiker.username = txt_User.Text;
            // get salt with username
            string       salt     = service.GetSalt(huidigGebruiker);
            HashwithSalt retrieve = new HashwithSalt();
            // generate hash with input password and the retrieved salt
            string hash = retrieve.GenerateHash(password, salt);

            // get credentials and check if they are valid
            /*            Employee employee = employee_service.GetCredentials(int.Parse(huidigGebruiker.username), hash);*/
            huidigGebruiker.validlogin = 1;

            // show welcome box if login is valid
            if (huidigGebruiker.validlogin == 1)
            {
                int function = functieService.GetFunctie(huidigGebruiker);
                MessageBox.Show($"Welkom {huidigGebruiker.username.ToUpper()}\n\nU bent ingelogd met functie: {(Employee.FunctieNaam)function}");

                this.Hide();
                //  open correct form according to function
                if (function == 1)
                {
                    Boolean       keuken       = false;
                    BarKeukenForm barOverzicht = new BarKeukenForm(keuken);
                    barOverzicht.Show();
                }
                else if (function == 2)
                {
                    AdminForm adminform = new AdminForm();
                    adminform.Show();
                }
                else if (function == 3)
                {
                    Boolean       keuken          = true;
                    BarKeukenForm keukenOverzicht = new BarKeukenForm(keuken);
                    keukenOverzicht.Show();
                }
                else if (function == 4)
                {
                    BedieningForm bedieningForm = new BedieningForm();
                    bedieningForm.Show();
                }
                else
                {
                    MessageBox.Show("Geen functie gevonden.");
                }
            }
        }
Exemplo n.º 2
0
        private void ManagementUI_Load(object sender, EventArgs e)
        {
            menuProduct_Service = new ChapooLogic.MenuProduct_Service();
            employee_Service    = new ChapooLogic.Employee_Service();
            revenue_Service     = new ChapooLogic.Revenue_Service();
            ShowHome();


            lblIngelogdAls.Text = currentUser.EmployeeType.ToString();
        }