Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminF af = new AdminF();

            af.Visible = true;
        }
        private void BackToAdminButton_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            AdminF af = new AdminF();

            af.Visible = true;
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var count = _repo.IsExist(UserNameTextBox.Text.Trim(), PasswordTextBox.Text.Trim());

            if (count == 1)
            {
                this.Hide();
                AdminF af = new AdminF();
                af.Visible = true;
                //bv = true;
            }
            else if (count == 2)
            {
                this.Hide();
                EmployeePlanelF ep = new EmployeePlanelF();
                ep.Visible = true;
            }
            else
            {
                MessageBox.Show(" User Name Or Password Incorrect ! ", "invalid login credentials", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            /*       info.userName = UserNameTextBox.Text;
             * info.userPass = PasswordTextBox.Text;
             *
             *
             * dt = opr.login(info);
             *
             * if (dt.Rows.Count > 0)
             * {
             *  //dt.Rows[0][4]
             *  AdminF ad = new AdminF();
             *  ad.Show();
             *  //this.Close();
             *  this.Hide();
             *
             * }
             * else
             * {
             *  MessageBox.Show("Invalid User name or Password !!! ");
             * }
             *
             */
        }
Beispiel #4
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(UsernameTextBox.Text) || string.IsNullOrEmpty(UserPasswordTextBox.Text) || string.IsNullOrEmpty(ConfirmPassTextBox.Text) || string.IsNullOrEmpty(UserTypeComboBox.Text) || string.IsNullOrEmpty(SecurityQuestionComboBox.Text) || string.IsNullOrEmpty(SequrityAnsTextBox.Text))
            {
                MessageBox.Show("Insufficient Information \n Please Fill-up all information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (UserPasswordTextBox.Text.Equals(ConfirmPassTextBox.Text))
                {
                    try
                    {
                        var userregister = new user
                        {
                            userName  = UsernameTextBox.Text.Trim(),
                            userPass  = UserPasswordTextBox.Text.Trim(),
                            userType  = UserTypeComboBox.SelectedItem.ToString(),
                            sQuestion = SecurityQuestionComboBox.SelectedItem.ToString(),
                            aQuestion = SequrityAnsTextBox.Text.Trim()
                                        //id = Int32.Parse(id_tbox.Text.Trim())
                        };
                        _repousr.Create(userregister);

                        MessageBox.Show("Successfully Inserted!!");
                        this.Visible = false;
                        AdminF af = new AdminF();
                        af.Visible = true;
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Username Already Taken!! Choose another username !", "Duplicate Username", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //For triangle Warning
                    }
                }
                else
                {
                    MessageBox.Show("Password Mismatch!!");
                }
            }
        }