private void Button1_Click(object sender, EventArgs e)
        {
            int prvg = controllerObj.CheckPassword(TxtBx_username.Text, TxtBx_pass.Text);

            if (prvg > 0)
            {
                if (prvg == 1)
                {
                    if (controllerObj.checkEmpid((int)id.Value))
                    {
                        Employees2 adm = new Employees2(TxtBx_pass.Text, (int)id.Value, prvg);
                        adm.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }
                else if (prvg == 2)
                {
                    if (controllerObj.checkUserid((int)id.Value))
                    {
                        User1 usr = new User1((int)id.Value);
                        usr.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }

                else if (prvg == 3)
                {
                    if (controllerObj.checkSuperid((int)id.Value))
                    {
                        Admin usr = new Admin((int)id.Value);
                        usr.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }
            }
            else
            {
                MessageBox.Show("Incorrect Password or Email or ID");
            }
        }
Example #2
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            int privlg = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);

            if (privlg > 0) // Successful Login
            {
                _loggedin = true;
                // Create an Object of "Provided_Functionalities" Form and Show it

                if (privlg > 1)  // if the privlg >1 then he is a teacher or student and form of functiontalities will appear
                {
                    Form1 func = new Form1(privlg, TxtBx_username.Text);
                    func.Show(this);
                    TxtBx_pass.Clear();
                    TxtBx_username.Clear();
                    // Hide the Login Form
                    // Don't close it because it's the startup form and the application will exit
                    this.Hide();
                }
                else if (privlg == 1)
                {
                    /// here the admin form is loaded
                }
            }
            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }
Example #3
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            int privlg = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);

            if (privlg > 0)
            {
                if (privlg == 1 || privlg == 8 || privlg == 9) // Successful Login
                {
                    _loggedin = true;
                    Manager func = new Manager((Privileges)privlg);
                    func.Show(this);
                }
                else if (privlg == 3)
                {
                    OtherEmployees func = new OtherEmployees();
                    func.Show(this);
                }
                else if (privlg == 4)
                {
                    Driver func = new Driver();
                    func.Show(this);
                }
                else if (privlg == 5)
                {
                    Sales func = new Sales();
                    func.Show(this);
                }
                else if (privlg == 6)
                {
                    TracksDesigner T = new TracksDesigner();
                    T.Show();
                }
                else if (privlg == 7)
                {
                    Marketing func = new Marketing();
                    func.Show(this);
                }
                else if (privlg == 100)
                {
                    Admin func = new Admin();
                    func.Show();
                }
                TxtBx_pass.Clear();
                TxtBx_username.Clear();
                // Hide the Login Form
                // Don't close it because it's the startup form and the application will exit
                this.Hide();
            }

            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }
Example #4
0
        private void Check_Click(object sender, EventArgs e)
        {
            DataTable found = null;

            try
            {
                if (type == "Citizen")
                {
                    found = controllerObj.CheckPassword_Citizen(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                }
                else if (type == "Employee")
                {
                    found = controllerObj.CheckPassword_Employee(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                }
                else if (type == "Company")
                {
                    found = controllerObj.CheckPassword_Company(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                }
                else if (type == "Bank")
                {
                    found = controllerObj.CheckPassword_Bank(TxtBx_username.Text, TxtBx_pass.Text);
                }
                else if (type == "Admin")
                {
                    found = controllerObj.CheckPassword_Admin(TxtBx_username.Text, TxtBx_pass.Text);
                }

                if (found == null)
                {
                    MessageBox.Show("WRONG USERNAME OR PASSWORD!!!");
                }
                else
                {
                    MessageBox.Show("Type in your new password");
                    NewPassword.Enabled = true;
                    Confirm.Enabled     = true;
                    username            = TxtBx_username.Text;
                }
            }

            catch
            {
                MessageBox.Show("WRONG USERNAME OR PASSWORD!!!");
            }
            TxtBx_username.Clear();
            TxtBx_pass.Clear();
        }
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            int p = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);

            if (p > 0)
            {
                Provided_Functionalities PF = new Provided_Functionalities((Privileges)p);
                PF.Show(this);
                TxtBx_pass.Clear();
                TxtBx_username.Clear();
                this.Hide();
            }
            else
            {
                MessageBox.Show("WRONG USERNAME OR PASSWORD!!!");
            }
        }
Example #6
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            string password = CheckPassword_Hash(TxtBx_pass.Text);
            int    privlg   = controllerObj.CheckPassword_Basic(TxtBx_username.Text, password);

            privlg = Convert.ToInt32(TxtBx_username.Text);
            CheckPassword_Hash(TxtBx_pass.Text);
            //if (privlg > 0)
            //{
            _loggedin = true;
            User U;

            U.Priv     = (Privileges)privlg;
            U.Username = TxtBx_username.Text;
            U.Password = password;
            if (U.Priv == Privileges.Admin)
            {
                U.BranchName = "NULL";
            }
            else
            {
                U.BranchName = controllerObj.SelectUserBranchName(TxtBx_username.Text).ToString();
            }
            if (U.Priv <= Privileges.BranchManager)
            {
                U.DepartmentName = "NULL";
            }
            else
            {
                U.DepartmentName = controllerObj.SelectUserDepartmentName(TxtBx_username.Text).ToString();
            }
            ProvidedFunctionalities PF = new ProvidedFunctionalities(U);

            PF.Show(this);
            TxtBx_pass.Clear();
            TxtBx_username.Clear();
            this.Hide();
            //}
            //else
            //{
            //    MessageBox.Show("Wrong username or password");
            //}
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable check = controllerObj.SelectUsername(TxtBx_username.Text, textBox2.Text);

            if (check != null)
            {
                //Login successful
                _loggedin = true;
                controllerObj.user_name = TxtBx_username.Text;  //saving current User name in controller



                //HERE SHOULD OPEN APPROPRIATE FORM FOR USER ACCORDING TO HIS /HER TYPE (MANAGER,EMPLOYEE,CLIENT)
                DataRow dr = check.Rows[0];
                type = dr["type"].ToString();
                if (type == "client")
                {
                    Client_Form func = new Client_Form(controllerObj.user_name);
                    func.Show(this);
                    textBox2.Clear(); //password
                    TxtBx_username.Clear();
                    this.Hide();
                }
                else
                {
                    Employee_Form func = new Employee_Form(controllerObj.user_name);
                    func.Show(this);
                    textBox2.Clear(); //password
                    TxtBx_username.Clear();
                    this.Hide();
                }
            }


            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }
Example #8
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            int privlg = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);

            if (privlg > 0) // Successful Login
            {
                _loggedin          = true;
                WrongInput.Visible = false;
                // Create an Object of "Provided_Functionalities" Form and Show it
                Provided_Functionalities func = new Provided_Functionalities(this, TxtBx_username.Text, (Privileges)privlg);
                func.Show(this);
                TxtBx_pass.Clear();
                TxtBx_username.Clear();
                // Hide the Login Form
                // Don't close it because it's the startup form and the application will exit
                this.Hide();
            }
            else
            {
                WrongInput.Visible = true;
                TxtBx_pass.Clear();
            }
        }
Example #9
0
 private void Btn_Login_Click(object sender, EventArgs e)
 {
     if (TxtBx_username.TextLength == 0 && TxtBx_pass.TextLength == 0)
     {
         MessageBox.Show("Please fill the required fields to login!");
     }
     else
     {
         int ID       = controllerObj.CheckAccount(TxtBx_username.Text, TxtBx_pass.Text);
         int Position = controllerObj.CheckPosition(ID);
         if (Position == 1) // Successful Login
         {
             _loggedin = true;
             EmpMainMenu emp = new EmpMainMenu(ID);
             emp.Show();
             TxtBx_pass.Clear();
             TxtBx_username.Clear();
             // Hide the Login Form
             this.Hide();
         }
         else if (Position == 2 || Position == 3) // Successful Login
         {
             _loggedin = true;
             // Create an Object of "Provided_Functionalities" Form and Show it
             ManagerMainMenu func = new ManagerMainMenu(ID);
             func.Show();
             TxtBx_pass.Clear();
             TxtBx_username.Clear();
             // Hide the Login Form
             this.Hide();
         }
         else
         {
             MessageBox.Show("Wrong username or password!");
         }
     }
 }
Example #10
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            int privlg = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);
            int id     = 0;

            if (privlg >= 0) // Successful Login
            {
                // Create an Object of "Provided_Functionalities" Form and Show it
                if (privlg == 0)
                {
                    id = controllerObj.getIDOperator(TxtBx_username.Text, TxtBx_pass.Text);
                    operator_main func; func = new operator_main((Privileges)privlg, id);
                    func.Show(this);
                }
                else if (privlg == 1)
                {
                    id = controllerObj.getIDAdminstrator(TxtBx_username.Text, TxtBx_pass.Text);
                    admin_main func = new admin_main((Privileges)privlg, id);
                    func.Show(this);
                }
                else if (privlg == 2)
                {
                    id = controllerObj.getIDAdminstrator(TxtBx_username.Text, TxtBx_pass.Text);
                    manager_main func = new manager_main((Privileges)privlg, id);
                    func.Show(this);
                }
            }
            else
            {
                MessageBox.Show("Wrong username or password");
            }
            TxtBx_pass.Clear();
            TxtBx_username.Clear();
            // Hide the Login Form
            // Don't close it because it's the startup form and the application will exit
            this.Hide();
        }
Example #11
0
        private void Btn_Login_Click_1(object sender, EventArgs e)
        {
            if ((string)loginAsComboBox.SelectedValue == "Patient")
            {
                long id = controllerObj.PatientPasswordCheck(TxtBx_username.Text, TxtBx_pass.Text);

                if (id > 0)
                {
                    new PatientServices((long)id).Show();
                    TxtBx_pass.Clear();
                    TxtBx_username.Clear();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong credentials. Please try again.");
                }
            }
            else if ((string)loginAsComboBox.SelectedValue == "Doctor")
            {
                long id = controllerObj.DoctorPasswordCheck(TxtBx_username.Text, TxtBx_pass.Text);

                if (id > 0)
                {
                    new DoctorServices((long)id).Show();
                    TxtBx_pass.Clear();
                    TxtBx_username.Clear();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong credentials. Please try again.");
                }
            }
            else if ((string)loginAsComboBox.SelectedValue == "Receptionist")
            {
                long id = controllerObj.ReceptionistPasswordCheck(TxtBx_username.Text, TxtBx_pass.Text);

                if (id > 0)
                {
                    new ReceptionistServices((long)id).Show();
                    TxtBx_pass.Clear();
                    TxtBx_username.Clear();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong credentials. Please try again.");
                }
            }
            else if ((string)loginAsComboBox.SelectedValue == "Admin")
            {
                long id = controllerObj.AdminPasswordCheck(TxtBx_username.Text, TxtBx_pass.Text);

                if (id > 0)
                {
                    new AdminServices((long)id).Show();
                    TxtBx_pass.Clear();
                    TxtBx_username.Clear();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong credentials. Please try again.");
                }
            }
        }
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            DataTable found = null;

            if (!(radioButton_Bank.Checked || radioButton_Citizen.Checked || radioButton_Company.Checked || radioButton_Employee.Checked || radioButton_Admin.Checked) ||
                TxtBx_username.Text == "" || TxtBx_pass.Text == "")
            {
                MessageBox.Show("Please Enter All Required Data and Pick an Account Type");
                return;
            }

            try
            {
                if (radioButton_Citizen.Checked)
                {
                    found = controllerObj.CheckPassword_Citizen(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                    if (found != null)
                    {
                        CitizenFunctionalities CF = new CitizenFunctionalities(Convert.ToInt32(TxtBx_username.Text));
                        CF.Show(this);
                        this.Hide();
                    }
                }
                else if (radioButton_Employee.Checked)
                {
                    found = controllerObj.CheckPassword_Employee(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                    if (found != null)
                    {
                        switch (Convert.ToChar(found.Rows[0]["EType"]))
                        {
                        case 'M':
                        {
                            new ManagerEmployeeFunctionalities(Convert.ToInt32(found.Rows[0]["NationalId"])).Show(this);
                            break;
                        }

                        case 'P':
                        {
                            new ProjectsEmployeeFunctionalities(Convert.ToInt32(found.Rows[0]["NationalId"])).Show(this);
                            break;
                        }

                        case 'H':
                        {
                            new HousingEmployeeFunctionalities(Convert.ToInt32(found.Rows[0]["NationalId"])).Show(this);
                            break;
                        }
                        }
                        this.Hide();
                    }
                }
                else if (radioButton_Company.Checked)
                {
                    found = controllerObj.CheckPassword_Company(Convert.ToInt32(TxtBx_username.Text), TxtBx_pass.Text);
                    if (found != null)
                    {
                        new CompanyFunctionalities(Convert.ToInt32(found.Rows[0]["CID"])).Show(this);
                        this.Hide();
                    }
                }
                else if (radioButton_Bank.Checked)
                {
                    found = controllerObj.CheckPassword_Bank(TxtBx_username.Text, TxtBx_pass.Text);
                    if (found != null)
                    {
                        BankFunctionalities BF = new BankFunctionalities(TxtBx_username.Text);
                        BF.Show(this);
                        this.Hide();
                    }
                }
                else if (radioButton_Admin.Checked)
                {
                    found = controllerObj.CheckPassword_Admin(TxtBx_username.Text, TxtBx_pass.Text);
                    if (found != null)
                    {
                        int isHigh = Convert.ToInt32(controllerObj.IsHighAdmin(TxtBx_username.Text).Rows[0][0]);
                        AdminFunctionalities AF = new AdminFunctionalities(isHigh);
                        AF.Show(this);
                        this.Hide();
                    }
                }

                if (found == null)
                {
                    MessageBox.Show("WRONG USERNAME OR PASSWORD!!!");
                }
            }
            catch
            {
                MessageBox.Show("WRONG USERNAME OR PASSWORD!!!");
            }
            TxtBx_pass.Clear();
            TxtBx_username.Clear();
        }
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            controllerObj = new Controller();
            int Privilege = controllerObj.CheckPassword_Basic(TxtBx_username.Text, TxtBx_pass.Text);

            if (Privilege > 0)
            {
                Hide();

                Privileges _Privileges = (Privileges)Privilege;
                //Login successful

                switch (_Privileges)
                {
                case Privileges.ADMIN:
                    new Admin(TxtBx_username.Text).Show();
                    break;

                case Privileges.EMPLOYEE:
                    int Dno = controllerObj.FindEmployeeDno(TxtBx_username.Text);
                    if (Dno != -1)
                    {
                        switch (Dno)
                        {
                        case 1:
                            new FinanceEmployee(TxtBx_username.Text).Show();
                            break;

                        case 2:
                            new HREmployee(TxtBx_username.Text).Show();
                            break;

                        case 3:
                            new Employee(TxtBx_username.Text).Show();
                            break;

                        case 4:
                            new EmployeeContact(TxtBx_username.Text).Show();
                            break;

                        case 5:
                            new Employee(TxtBx_username.Text).Show();
                            break;
                        }
                    }
                    //new Employee().Show();
                    break;

                case Privileges.USER:
                    new User(TxtBx_username.Text).Show();
                    break;
                }
                // MainMenu func = new MainMenu((Privileges) privlg);
                //func.Show(this);
                TxtBx_pass.Clear();
                TxtBx_username.Clear();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }