Ejemplo n.º 1
0
        private void metroButtonBack_Click(object sender, EventArgs e)
        {
            CustomerControl cs = new CustomerControl();

            this.Hide();
            cs.ShowDialog();
        }
Ejemplo n.º 2
0
        private void btnmainlogin_Click(object sender, EventArgs e)
        {
            LoginInfo    login          = new LoginInfo();
            custregTable CustLoginTable = new custregTable();

            //radio button.
            //CustomerUser Access Check.
            if (rbtnCustomer.Checked == true)
            {
                if (!string.IsNullOrEmpty(txtLoginUserName.Text) && !string.IsNullOrEmpty(txtLogInPassword.Text))
                {
                    if (login.CheckCustomeruser(txtLoginUserName.Text, txtLogInPassword.Text))
                    {
                        CustomerControl control = new CustomerControl();
                        MetroMessageBox.Show(this, "Welcome " + txtLoginUserName.Text, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Hide();
                        control.ShowDialog();
                    }

                    else
                    {
                        MetroMessageBox.Show(this, "Wrong CustomerPassword!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "You have to fill up all fields!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            //AdminUSer Access Check
            else if (rbtnAdmin.Checked == true)
            {
                if (!string.IsNullOrEmpty(txtLoginUserName.Text) && !string.IsNullOrEmpty(txtLogInPassword.Text))
                {
                    if (login.CheckAdminUser(txtLoginUserName.Text, txtLogInPassword.Text))
                    {
                        AdminControl objAdmin = new AdminControl();
                        MetroMessageBox.Show(this, "Welcome Admin " + txtLoginUserName.Text, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Hide();
                        objAdmin.ShowDialog();
                    }

                    else
                    {
                        MetroMessageBox.Show(this, "Wrong AdminPassword!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "You have to fill up all fields!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                MetroMessageBox.Show(this, "You have to select either Admin or Customer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }