Exemplo n.º 1
0
 private void metroTile_DeleteUser_Click(object sender, EventArgs e)
 {
     DTO.User_DTO u = new DTO.User_DTO();
     u.Id = int.Parse(metroTextBox_ID.Text);
     if (BUS.User_BUS.DeleteUser(u) == true)
     {
         MessageBox.Show("User was deleted !");
         Load_Users();
     }
     else
     {
         MessageBox.Show("Can't delete this User !");
     }
 }
Exemplo n.º 2
0
        private void metroTile_addUser_Click(object sender, EventArgs e)
        {
            if (metroTextBox_userName.Text == "")
            {
                MessageBox.Show("Please input username !");
                return;
            }

            if (metroTextBox_nameUser.Text == "")
            {
                MessageBox.Show("Please input user's name !");
                return;
            }


            DTO.User_DTO u = new DTO.User_DTO();
            u.Username = metroTextBox_userName.Text;
            u.NameUser = metroTextBox_nameUser.Text;

            if (metroRadioButton_admin.Checked == true)
            {
                u.Permission = 1;
            }
            else
            {
                u.Permission = 2;
            }

            if (BUS.User_BUS.AddUser(u) == false)
            {
                MessageBox.Show("Can't add this user !");
                return;
            }
            MessageBox.Show("User was added !" + Environment.NewLine + Environment.NewLine + "Username: "******"Default password: 123" + Environment.NewLine + "Remember change your password at the first login.");
            Load_Users();
        }
Exemplo n.º 3
0
 public static bool DeleteUser(DTO.User_DTO u)
 {
     return(DAO.User_DAO.DeleteUser(u));
 }
Exemplo n.º 4
0
 public static bool AddUser(DTO.User_DTO u)
 {
     return(DAO.User_DAO.AddUser(u));
 }