コード例 #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.");
            }
        }