//if (rbutCust.Checked == true) {
        //    if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtPassword.Text)) {

        //        ControlCustomer ctrlCustomer = new ControlCustomer();
        //        bool isMatched = ctrlCustomer.LoginCustomer(txtEmail.Text, txtPassword.Text);  // Verificerer indtastede login-credentials gennem service.

        //        if (isMatched == true) {

        //            CustomerActive = ctrlCustomer.GetCustomerByEmail(txtEmail.Text); // Se fields. Customer-objekt til brug i Main.cs.

        //            MessageBox.Show("Login succeeded!");
        //            this.Hide();
        //            Main mainForm = new Main();
        //            mainForm.Show();

        //        } else {
        //            MessageBox.Show("Login failed!");
        //        }
        //    }
        //}
        //}



        // CREATE ACCOUNT - ADMIN & CUSTOMER
        private void btnCreateAcc_Click(object sender, EventArgs e)
        {
            string chosenAdminEmail    = txtEmail.Text;
            string chosenAdminPassword = txtPassword.Text;

            ControlAdmin ctrlAdmin = new ControlAdmin();

            ctrlAdmin.CreateAdmin(chosenAdminEmail, chosenAdminPassword);

            MessageBox.Show("Admin created succesfully!");
        }
        // LOGIN - ADMIN & CUSTOMER
        private void button1_Click(object sender, EventArgs e)
        {
            //if (rbutAdm.Checked == true) {
            if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtPassword.Text))
            {
                ControlAdmin ctrlAdmin = new ControlAdmin();
                bool         isMatched = ctrlAdmin.LoginAdmin(txtEmail.Text, txtPassword.Text);

                if (isMatched == true)
                {
                    MessageBox.Show("Login succeeded!");
                    this.Hide();
                    Main mainForm = new Main();
                    mainForm.Show();
                }
                else
                {
                    MessageBox.Show("Login failed!");
                }
            }
        }
Exemple #3
0
        public bool LoginAdmin(string emailToLookUp, string passwordToVerify)
        {
            ControlAdmin ctrlAdmin = new ControlAdmin();

            return(ctrlAdmin.LoginAdmin(emailToLookUp, passwordToVerify));
        }
Exemple #4
0
        public Admin CreateAdmin(Admin adminToCreate)
        {
            ControlAdmin ctrlAdmin = new ControlAdmin();

            return(ctrlAdmin.CreateAdmin(adminToCreate));
        }