Exemple #1
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     IdTb.ResetText();
     UsernameTb.ResetText();
     PasswordTb.ResetText();
     RecoveryTb.ResetText();
 }
Exemple #2
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);
     }
 }
Exemple #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();
     }
 }
Exemple #4
0
 private void Clear()
 {
     UsernameTb.Text   = "";
     PasswordTb.Text   = "";
     RetypePassTb.Text = "";
     RoleCb.Text       = "";
     NameTb.Text       = "";
     UsernameTb.Focus();
 }
Exemple #5
0
        public void LogIn()
        {
            if (string.IsNullOrEmpty(UsernameTb.GetAttribute("value")) ||
                string.IsNullOrEmpty(PassWordTb.GetAttribute("value")))
            {
                throw new ArgumentException("Text box username or password are empty");
            }

            LogInBtn.Click();
        }
Exemple #6
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);
     }
 }
Exemple #7
0
 private void textbox1_Click(object sender, EventArgs e)
 {
     UsernameTb.Clear();
     pictureBox2.BackgroundImage = Properties.Resources.user;
     UsernameTb.ForeColor        = Color.FromArgb(255, 99, 55);
 }
Exemple #8
0
 public LogInPage(string username, string password) : this()
 {
     UsernameTb.SendKeys(username);
     PassWordTb.SendKeys(password);
 }