コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            UserLog ul = new UserLog();
            ul.setUsername(username.Text);
            ul.setPassword(password.Text);
            ul.setEmp_no(employee_no.Text);

            string status = UserHandler.addUser(ul);

            if(status=="success"){
                MessageBox.Show("New user added successfully...!");
            }
            else if (status == "user exists")
            {
                MessageBox.Show("User already exists. Please add a new user.");
            }
            else
            {
                MessageBox.Show("Failed to add user.");
            }
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            UserLog ul = new UserLog();
            ul.setUsername(username.Text);
            ul.setPassword(password.Text);
            ul.setEmp_no(employee_no.Text);

            string status = UserHandler.updateUser(ul);

            if (status == "success")
            {
                MessageBox.Show("User updated successfully...!");
            }
            else if (status == "user does not exist")
            {
                MessageBox.Show("User does not exists. Please add a new user.");
            }
            else
            {
                MessageBox.Show("Failed to update user.");
            }
        }
コード例 #3
0
        private void btnLogin(object sender, EventArgs e)
        {
            UserLog ul = new UserLog();

            ul.setUsername(username.Text);
            ul.setPassword(password.Text);

            if (username.Text == "" || password.Text == "")
            {
                MessageBox.Show("Empty Fields Detected ! Please fill up all the fields");
                return;
            }
            else if (LoginValidator.isMaster(ul))
            {
                LoginInfo.UserID = username.Text;

                frmMain form1 = new frmMain();
                form1.Show();
                this.Hide();
            }
            else
            {
                bool r = LoginValidator.validateLogin(ul);

                if (r)
                {
                    frmMain form1 = new frmMain();
                    form1.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Incorrect Login Credentials");
                }
            }
        }