private void btnLoginAdmin_Click(object sender, EventArgs e) ///////////// { if (IsValidDataAdmin()) { UsersClass admin; admin = UsersDB_Class.GetAdmin(txtEmailAdmin.Text); if (admin == null) { MessageBox.Show("Email incorrect!", Title); txtEmailAdmin.Clear(); txtEmailAdmin.Focus(); } else { string textboxPassword = EncriptString.Decrypt(admin.passwordUsers, "testEncript"); if (txtPasswordAdmin.Text == textboxPassword) { Admin modifFormAdmin = new Admin(); modifFormAdmin.Show(); this.Hide(); } else { MessageBox.Show("Password incorrect!", Title); txtPasswordAdmin.Clear(); txtPasswordAdmin.Focus(); } } } }
private void btnSingUpForm_Click(object sender, EventArgs e) { if (txtSingUpPassword.Text == txtSingUpConfirm.Text) { createdProfile.passwordUsers = txtSingUpPassword.Text; if (IsValidDataSingUp()) { createdProfile.firstNameUsers = txtSingUpFirstName.Text; createdProfile.lastNameUsers = txtSingUpLastName.Text; createdProfile.emailUsers = txtSingUpEmail.Text; createdProfile.phoneUsers = txtSingUpPhone.Text; createdProfile.passwordUsers = EncriptString.Encrypt(txtSingUpPassword.Text, "testEncript"); createdProfile.roleUsers = "user"; createdProfile.updatedUsers = DateTime.Today; createdProfile.createdUsers = DateTime.Today; createdProfile.approvedUsers = "0"; this.creativityProfile = createdProfile; UsersDB_Class.CreateProfile(createdProfile); MessageBox.Show("Please wait for approval."); txtSingUpClear(); } } else { MessageBox.Show("Password and confirm password do not match", Title); txtSingUpPassword.Clear(); txtSingUpConfirm.Clear(); } }
private void btnLoginLogin_Click(object sender, EventArgs e) { if (IsValidData()) { UsersClass user; user = UsersDB_Class.GetUser(txtEmailLogin.Text); if (user == null) { MessageBox.Show("Email incorrect!", Title); txtEmailLogin.Clear(); txtEmailLogin.Focus(); } else { int user_id = user.userID; // Дешифровка пароля из базы данных и сравнивание с введенным паролем из текстбокса string textboxPassword = EncriptString.Decrypt(user.passwordUsers, "testEncript"); if (txtPasswordLodin.Text == textboxPassword) { Users modifFormUsers = new Users(user_id); modifFormUsers.Show(); this.Hide(); } else { MessageBox.Show("Password incorrect!", Title); txtPasswordLodin.Clear(); txtPasswordLodin.Focus(); } } } }
private void btnCreate_Click(object sender, EventArgs e) { if (txtCreateAdminPassword.Text == txtCreateAdminPassword1.Text) { createdAdmin.passwordUsers = txtCreateAdminPassword.Text; } else { txtCreateAdminPassword.Clear(); txtCreateAdminPassword1.Clear(); } if (IsValidData()) { createdAdmin.firstNameUsers = txtCreateAdminFirstName.Text; createdAdmin.lastNameUsers = txtCreateAdminLastName.Text; createdAdmin.emailUsers = txtCreateAdminEmail.Text; createdAdmin.phoneUsers = txtCreateAdminPhone.Text; createdAdmin.passwordUsers = EncriptString.Encrypt(txtCreateAdminPassword.Text, "testEncript"); //Salt/Key createdAdmin.roleUsers = "admin"; createdAdmin.updatedUsers = DateTime.Today; createdAdmin.createdUsers = DateTime.Today; createdAdmin.approvedUsers = "1"; this.creativity = createdAdmin; this.DialogResult = DialogResult.OK; this.Close(); } }
private void btnModifyProfile_Click(object sender, EventArgs e) { try { if (txtModifyProfilePassword.Text == txtModifyProfileConfirm.Text) { user.passwordUsers = txtModifyProfilePassword.Text; } else { txtModifyProfilePassword.Clear(); txtModifyProfileConfirm.Clear(); } if (IsValidData()) { user.firstNameUsers = txtModifyProfileFirstName.Text; user.lastNameUsers = txtModifyProfileLastName.Text; user.emailUsers = txtModifyProfileEmail.Text; user.phoneUsers = txtModifyProfilePhone.Text; user.passwordUsers = EncriptString.Encrypt(txtModifyProfilePassword.Text, "testEncript"); //Salt/Key this.modify = user; this.DialogResult = DialogResult.OK; this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n\n" + ex.GetType().ToString() + "\n" + ex.StackTrace, "Exception"); } }
private void btnChangeUsers_Click(object sender, EventArgs e) { if (IsValidData()) { changeUser.firstNameUsers = txtChangeUsersFirstName.Text; changeUser.lastNameUsers = txtChangeUsersLastName.Text; changeUser.emailUsers = txtChangeUsersEmail.Text; changeUser.phoneUsers = txtChangeUsersPhone.Text; changeUser.roleUsers = comboBoxChangeUsersRole.Text; changeUser.updatedUsers = DateTime.Now; changeUser.passwordUsers = EncriptString.Encrypt(txtChangeUsersPassword.Text, "testEncript"); //Salt/Key this.changes = changeUser; this.DialogResult = DialogResult.OK; this.Close(); } }