Ejemplo n.º 1
0
 private void UpdateBtn_Click(object sender, EventArgs e)
 {
     if (UsernameTb.Text != "" || PasswordTb.Text != "" || RecoveryTb.Text != "")
     {
         if (IdTb.Text != "")
         {
             DialogResult result = MessageBox.Show("Do You Really Want To Update this Account?", "Confirm Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (result == DialogResult.OK)
             {
                 _admin.Id           = int.Parse(IdTb.Text);
                 _admin.Username     = UsernameTb.Text;
                 _admin.Password     = PasswordTb.Text;
                 _admin.RecoveryName = RecoveryTb.Text;
                 _adminService.UpdateLogín(_admin);
                 AdminService adminService = new AdminService();
                 var          dataSource   = adminService.GetLogínsDataTable();
                 grid.DataSource = dataSource;
                 MessageBox.Show("Account Updated Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 IdTb.ResetText();
                 UsernameTb.ResetText();
                 PasswordTb.ResetText();
                 RecoveryTb.ResetText();
             }
         }
     }
     else
     {
         MessageBox.Show("Please Select an account from the grid!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 2
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     IdTb.ResetText();
     UsernameTb.ResetText();
     PasswordTb.ResetText();
     RecoveryTb.ResetText();
 }
Ejemplo n.º 3
0
 private void CreateAccountBtn_Click(object sender, EventArgs e)
 {
     if (UsernameTb.Text != "" || PasswordTb.Text != "" || RecoveryTb.Text != "")
     {
         _admin.Username     = UsernameTb.Text;
         _admin.Password     = PasswordTb.Text;
         _admin.RecoveryName = RecoveryTb.Text;
         _adminService.InsertLogín(_admin);
         AdminService adminService = new AdminService();
         var          dataSource   = adminService.GetLogínsDataTable();
         grid.DataSource = dataSource;
         MessageBox.Show("Account Created Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         IdTb.ResetText();
         UsernameTb.ResetText();
         PasswordTb.ResetText();
         RecoveryTb.ResetText();
     }
     else
     {
         MessageBox.Show("Please Fill in the fields!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         IdTb.ResetText();
         UsernameTb.ResetText();
         PasswordTb.ResetText();
         RecoveryTb.ResetText();
     }
 }
Ejemplo n.º 4
0
 private void DeleteBtn_Click(object sender, EventArgs e)
 {
     if (IdTb.Text != "")
     {
         DialogResult result = MessageBox.Show("Do You Really Want To Delete this Account?", "Confirm Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (result == DialogResult.OK)
         {
             _adminService.DeleteLogín(int.Parse(IdTb.Text));
             AdminService adminService = new AdminService();
             var          dataSource   = adminService.GetLogínsDataTable();
             grid.DataSource = dataSource;
             MessageBox.Show("Account Deleted Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
             IdTb.ResetText();
             UsernameTb.ResetText();
             PasswordTb.ResetText();
             RecoveryTb.ResetText();
         }
     }
     else
     {
         MessageBox.Show("Please Select an Id from the grid!", "Id is not provided", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }