public IWebElement SurveyEmail(string email) { //select our drop-down and enters a parkcode SelectElement ParkSelector = new SelectElement(chromeDriver.FindElement(By.Id("ParkCode"))); ParkSelector.SelectByValue("CVNP"); //type an email for us and then clears any older entries then send email brought in and types it in SendKeys(email) WaitForElement(By.Id("EmailAddress")); EmailBox.Clear(); EmailBox.SendKeys(email); //select from a drop down menu SelectElement StateSelector = new SelectElement(chromeDriver.FindElement(By.Id("State"))); StateSelector.SelectByValue("OH"); //select radio butons IList <IWebElement> radioSelect = chromeDriver.FindElements(By.Id("ActivityLevel")); radioSelect[0].Click(); WaitForElement(By.Id("submit")); SubmitButton.Click(); WaitForElement(By.Id("survey")); return(Survey); }
private void EmailBox_GotFocus(object sender, EventArgs e) { if (EmailBox.Text == "Email") { EmailBox.Clear(); } }
private void EmptyTextBox() { FirstNameBox.Clear(); LastNameBox.Clear(); EmailBox.Clear(); PasswordBox.Clear(); ConPasswordBox.Clear(); }
private void ClearBoxes() { RegNumBox.Clear(); NameBox.Clear(); SurnameBox.Clear(); EmailBox.Clear(); PassBox.Clear(); CourseTitleBox.Clear(); }
private void Cleared() { FirstNBox.Clear(); LastNBox.Clear(); MiddleNBox.Clear(); PhoneBox.Clear(); EmailBox.Clear(); AddressBox1.Clear(); AddressBox2.Clear(); CityBox.Clear(); StateBox.Clear(); ZipBox.Clear(); CountryBox.Clear(); }
private void btnNew_Click(object sender, EventArgs e) { FirstNBox.Clear(); LastNBox.Clear(); MiddleNBox.Clear(); PhoneBox.Clear(); EmailBox.Clear(); AddressBox1.Clear(); AddressBox2.Clear(); CityBox.Clear(); StateBox.Clear(); ZipBox.Clear(); CountryBox.Clear(); }
void StartEmailBody() { EmailBox.Clear(); EmailBox.Text = Environment.NewLine + "Filler results : " + Environment.NewLine + Environment.NewLine; if (File.Exists(FillerResultsFile)) { EmailBox.Text = EmailBox.Text + Path.GetFileName(FillerResultsFile); } //adds a cat fact string jsonData = GET("https://catfact.ninja/fact"); dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonData); RandomFact = result.fact; EmailBox.Text = EmailBox.Text + Environment.NewLine + Environment.NewLine + RandomFact; EmailBox.Text = EmailBox.Text + Environment.NewLine + Environment.NewLine + "Attached files : " + Environment.NewLine + Environment.NewLine + Path.GetFileName(tempPath); }
/// <summary> /// When another file is selected see the results and the progress /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBox.SelectedIndex == -1) { return; } String filenameSelected = comboBox.SelectedItem.ToString(); STG message = new STG() { statut_op = true, info = "", data = new object[] { filenameSelected }, operationname = "result", tokenApp = MainWindow.tokenApp, tokenUser = MainWindow.tokenUser }; STG result = MainWindow.services.m_service(message); statusLabel.Visibility = Visibility.Visible; statusLabel.Content = result.info; if (result.info == "finish") { keyBox.Text = result.data[1].ToString(); contentBox.Text = result.data[2].ToString(); pourcentageBox.Text = result.data[3].ToString(); EmailBox.Text = result.data[4].ToString(); } else if (result.info == "progress") { keyBox.Clear(); contentBox.Clear(); pourcentageBox.Clear(); EmailBox.Clear(); } }
private void saveBtn(object sender, RoutedEventArgs e) { try { var suppModel = new supplier { SupplierID = int.Parse(SuppIdBox.Text), FirstName = FirstNameBox.Text, LastName = LastNameBox.Text, Address = AddressBox.Text, City = CityBox.Text, PinCode = int.Parse(PinCodeBox.Text), PhoneNumber = int.Parse(PhoneNrBox.Text), Email = EmailBox.Text, DateJoin = DateJoinPicker.SelectedDate, SupplierOf = SuppBox.Text, }; SuppIdBox.Clear(); FirstNameBox.Clear(); LastNameBox.Clear(); AddressBox.Clear(); CityBox.Clear(); PinCodeBox.Clear(); PhoneNrBox.Clear(); EmailBox.Clear(); SuppBox.Clear(); dc.suppliers.InsertOnSubmit(suppModel); dc.SubmitChanges(); MessageBox.Show("Supplier has been added"); LoadData(); LoadWindow(); } catch { MessageBox.Show("u need to fill out all fields correct"); } }
//Shows the Email of the employee who's employee ID is in the ID box private void showEmail() { String query = "SELECT Email FROM Employee where EmployeeID = @EmployeeID"; using (connection = new SqlConnection(connectionString)) using (SqlCommand command = new SqlCommand(query, connection)) using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { command.Parameters.AddWithValue("@EmployeeID", IDBox.Text); connection.Open(); SqlDataReader cr = command.ExecuteReader(); if (cr.Read()) { EmailBox.Text = (cr["Email"].ToString()); } else { EmailBox.Clear(); } } }
private void Clear_form() { modify = false; SaveButton.Enabled = false; DeleteButton.Enabled = false; FirstNameBox.Clear(); MiddleNmeBox.Clear(); LastNameBox.Clear(); GenderBox.Clear(); Address1Box.Clear(); Address2Box.Clear(); CityBox.Clear(); StateBox.Clear(); ZipCodeBox.Clear(); EmailBox.Clear(); PhoneNumberBox.Clear(); ResultList.SelectedItems.Clear(); DateReceivedPicker.Value = DateTime.Today; StartTimeBox.Clear(); SaveTimeBox.Clear(); BackNumBox.Clear(); }
private void saveBtn(object sender, RoutedEventArgs e) { try { var empModel = new employee { EmployeeID = int.Parse(EmpIdBox.Text), FirstName = FirstNameBox.Text, LastName = LastNameBox.Text, Address = AddressBox.Text, City = CityBox.Text, PinCode = int.Parse(PinCodeBox.Text), PhoneNumber = int.Parse(PhoneNrBox.Text), Email = EmailBox.Text, JoinDate = DateJoinPicker.SelectedDate }; EmpIdBox.Clear(); FirstNameBox.Clear(); LastNameBox.Clear(); AddressBox.Clear(); CityBox.Clear(); PinCodeBox.Clear(); PhoneNrBox.Clear(); EmailBox.Clear(); dc.employees.InsertOnSubmit(empModel); dc.SubmitChanges(); MessageBox.Show("Employee has been added"); LoadData(); LoadWindow(); } catch { MessageBox.Show("Thats not a valid action"); } }
/// <summary> /// Clears all fields and sets necessary enables/disables to /// prepare for new customer entry into database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewCustomerButton_Click(object sender, EventArgs e) { FirstNameBox.Clear(); LastNameBox.Clear(); AddressBox.Clear(); CityBox.Clear(); StateBox.Clear(); ZipBox.Clear(); PhoneBox.Clear(); EmailBox.Clear(); CustomerSelectBox.Enabled = false; CancelButton.Enabled = true; SaveButton.Enabled = true; return; /* * // When add customer button is first clicked, display message and disable box. * if (CustomerSelectBox.Enabled == true) * { * MessageBox.Show("To add a customer, fill in the fields and click Add Customer again", "Add Customer"); * CustomerSelectBox.Enabled = false; * return; * } * * // Once form is in "add customer" mode, add customer normally. * else * { * bool valid = true; // Boolean will be set to false if any tests fail, used to check if customer should be saved. * if (FirstNameBox.Text == "" || Regex.IsMatch(FirstNameBox.Text, name)) * { * MessageBox.Show("Please enter your first name", "First name is a required field"); * FirstNameBox.Focus(); * valid = false; * } * if (LastNameBox.Text == "" || Regex.IsMatch(LastNameBox.Text, name)) * { * MessageBox.Show("Please enter your last name", "Last name is a required field"); * LastNameBox.Focus(); * valid = false; * } * if (AddressBox.Text == "" || Regex.IsMatch(AddressBox.Text, address)) * { * MessageBox.Show("Please enter your address", "Address is a required field"); * AddressBox.Focus(); * valid = false; * } * if (CityBox.Text == "" || Regex.IsMatch(CityBox.Text, name)) * { * MessageBox.Show("Please enter your city", "City is a required field"); * CityBox.Focus(); * valid = false; * } * if (StateBox.Text == "" || Regex.IsMatch(StateBox.Text, name)) * { * MessageBox.Show("Please enter your state", "State is a required field"); * StateBox.Focus(); * valid = false; * } * if (ZipBox.Text == "" || Regex.IsMatch(ZipBox.Text, zip)) * { * MessageBox.Show("Please enter your zip code", "Zip Code is a required field"); * ZipBox.Focus(); * valid = false; * } * if (PhoneBox.Text == "" || Regex.IsMatch(PhoneBox.Text, phone)) * { * MessageBox.Show("Please enter your phone number", "Phone number is a required field"); * PhoneBox.Focus(); * valid = false; * } * if (EmailBox.Text == "" || Regex.IsMatch(EmailBox.Text, email)) * { * MessageBox.Show("Please enter your email address", "Email is a required field"); * EmailBox.Focus(); * valid = false; * } * * // If no issues, add customer to text file and ComboBox. * if (valid) * { * Customer tempCustomer = new Customer(FirstNameBox.Text, LastNameBox.Text, AddressBox.Text, CityBox.Text, StateBox.Text, ZipBox.Text, PhoneBox.Text, EmailBox.Text); * customers.Add(tempCustomer); * * // Close reader and inFile even if exception is thrown. * // SRC:https://stackoverflow.com/questions/86766/how-to-properly-handle-exceptions-when-performing-file-io * try * { * using (FileStream outFile = new FileStream("customers.txt", FileMode.Append, FileAccess.Write)) * using (StreamWriter writer = new StreamWriter(outFile)) * { * // Write info to file. * writer.WriteLine($"{FirstNameBox.Text},{LastNameBox.Text},{AddressBox.Text},{CityBox.Text},{StateBox.Text},{ZipBox.Text},{PhoneBox.Text},{EmailBox.Text}"); * // Clear Text Boxes. * FirstNameBox.Clear(); * LastNameBox.Clear(); * AddressBox.Clear(); * CityBox.Clear(); * StateBox.Clear(); * ZipBox.Clear(); * PhoneBox.Clear(); * EmailBox.Clear(); * CustomerSelectBox.Items.Add(tempCustomer); * CustomerSelectBox.Enabled = true; * } * } * catch (FileNotFoundException) * { * MessageBox.Show("File 'customers.txt' not found to write.", "File Write Error"); * } * // Catch generic I/O exceptions. * catch (IOException ex) * { * MessageBox.Show(ex.ToString(), "Error"); * } * * } * } */ }
/// <summary> /// Clicking button checks if all fields have plausible entires (not empty or wrong format). Then /// updates currently selected customer with new information. Uses email as unique identifier, but /// does not check if email already exists. (Not sure how...) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveButton_Click(object sender, EventArgs e) { bool valid = true; // Boolean will be set to false if any tests fail, used to check if customer should be saved. if (FirstNameBox.Text == "" || !Regex.IsMatch(FirstNameBox.Text, name)) { MessageBox.Show("Please enter your first name", "First name is a required field"); FirstNameBox.Focus(); valid = false; } if (LastNameBox.Text == "" || !Regex.IsMatch(LastNameBox.Text, name)) { MessageBox.Show("Please enter your last name", "Last name is a required field"); LastNameBox.Focus(); valid = false; } if (AddressBox.Text == "" || !Regex.IsMatch(AddressBox.Text, address)) { MessageBox.Show("Please enter your address", "Address is a required field"); AddressBox.Focus(); valid = false; } if (CityBox.Text == "" || !Regex.IsMatch(CityBox.Text, city)) { MessageBox.Show("Please enter your city", "City is a required field"); CityBox.Focus(); valid = false; } if (StateBox.Text == "" || !Regex.IsMatch(StateBox.Text, name)) { MessageBox.Show("Please enter your state", "State is a required field"); StateBox.Focus(); valid = false; } if (ZipBox.Text == "" || !Regex.IsMatch(ZipBox.Text, zip)) { MessageBox.Show("Please enter your zip code", "Zip Code is a required field"); ZipBox.Focus(); valid = false; } if (PhoneBox.Text == "" || !Regex.IsMatch(PhoneBox.Text, phone)) { MessageBox.Show("Please enter your phone number", "Phone number is a required field"); PhoneBox.Focus(); valid = false; } if (EmailBox.Text == "" || !Regex.IsMatch(EmailBox.Text, email)) { MessageBox.Show("Please enter your email address", "Email is a required field"); EmailBox.Focus(); valid = false; } // If invalid entry, do not save. if (!valid) { return; } // Else string ConnectionString = "server=localhost;user=root;database=book store;password="******"Insert into customer values" + $"('null','{FirstNameBox.Text}'," + $"'{LastNameBox.Text}'," + $"'{AddressBox.Text}'," + $"'{CityBox.Text}'," + $"'{StateBox.Text}'," + $"'{ZipBox.Text}'," + $"'{PhoneBox.Text}'," + $"'{EmailBox.Text}')"; cmd.Connection = DBConnect; cmd.ExecuteNonQuery(); DBConnect.Close(); FirstNameBox.Clear(); LastNameBox.Clear(); AddressBox.Clear(); CityBox.Clear(); StateBox.Clear(); ZipBox.Clear(); PhoneBox.Clear(); EmailBox.Clear(); // Call function to update the combobox with new customer added. CustomerSelectBox_Click(sender, e); CustomerSelectBox.Enabled = true; SaveButton.Enabled = false; MessageBox.Show("Customer added to database."); return; } // Else update the currently selected customer with textbox info // Extract first and last name into string array. string[] custName = new string[2]; custName = CustomerSelectBox.Text.Split(); cmd.CommandText = $"Update customer set" + $" first='{FirstNameBox.Text}'," + $"last='{LastNameBox.Text}'," + $"address='{AddressBox.Text}'," + $"city='{CityBox.Text}'," + $"state='{StateBox.Text}'," + $"zip='{ZipBox.Text}'," + $"phone='{PhoneBox.Text}'," + $"email='{EmailBox.Text}'" + $" where first='{custName[0]}' AND last ='{custName[1]}'"; cmd.Connection = DBConnect; cmd.ExecuteNonQuery(); DBConnect.Close(); MessageBox.Show("Customer successfully updated."); return; /* * SaveButton.Enabled = false; // Disable the save button again until new customer is selected from the comboBox. * * // Rewrite the entire file, omitting the line with the email of the customer that is being updated, since email is unique. * // SRC: https://stackoverflow.com/questions/10371630/c-sharp-text-file-search-for-specific-word-and-delete-whole-line-of-text-that-co * Customer tempCustomer = (Customer)(CustomerSelectBox.SelectedItem); * var oldLines = File.ReadAllLines("customers.txt"); * var newLines = oldLines.Where(line => !line.Contains(tempCustomer.email)); * File.WriteAllLines("customers.txt", newLines); * * customers.Remove((Customer)CustomerSelectBox.SelectedItem); // Remove old customer info from customer list. * * // Add new info to list. * tempCustomer = new Customer(FirstNameBox.Text, LastNameBox.Text, AddressBox.Text, CityBox.Text, StateBox.Text, ZipBox.Text, PhoneBox.Text, EmailBox.Text); * customers.Add(tempCustomer); * * // Close reader and inFile even if exception is thrown. * // SRC:https://stackoverflow.com/questions/86766/how-to-properly-handle-exceptions-when-performing-file-io * try * { * using (FileStream outFile = new FileStream("customers.txt", FileMode.Append, FileAccess.Write)) * using (StreamWriter writer = new StreamWriter(outFile)) * { * // Write info to file. * writer.WriteLine($"{FirstNameBox.Text},{LastNameBox.Text},{AddressBox.Text},{CityBox.Text},{StateBox.Text},{ZipBox.Text},{PhoneBox.Text},{EmailBox.Text}"); * } * * // Clear Text Boxes. * FirstNameBox.Clear(); * LastNameBox.Clear(); * AddressBox.Clear(); * CityBox.Clear(); * StateBox.Clear(); * ZipBox.Clear(); * PhoneBox.Clear(); * EmailBox.Clear(); * * // Update comboBox with new info. * CustomerSelectBox.Items.Remove(CustomerSelectBox.SelectedItem); * CustomerSelectBox.Items.Add(tempCustomer); * } * catch (FileNotFoundException) * { * MessageBox.Show("File 'customers.txt' not found to write.", "File Write Error"); * } * // Catch generic I/O exceptions. * catch (IOException ex) * { * MessageBox.Show(ex.ToString(), "Error"); * } */ }
private void ClearTextFields() { NameBox.Clear(); EmailBox.Clear(); }
private void RegisterButton_Click(object sender, EventArgs e) { //sets connection var connectionString = ConfigurationManager.ConnectionStrings["EmployeeManagement"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); //opens connection con.Open(); //Creates a command/sql query to select the userid from the database SqlCommand checkUserName = new SqlCommand("Select * from Employees where UserID=@Username", con); SqlCommand checkEmail = new SqlCommand("Select * from Employees where Email=@Email", con); //Trys to add the current data in the UserID text box to the database checkUserName.Parameters.AddWithValue("@Username", this.Username.Text); // same checks for the user id the only diffrence is its the email checkEmail.Parameters.AddWithValue("@Email", this.EmailBox.Text); var result = checkUserName.ExecuteScalar(); var emailResult = checkEmail.ExecuteScalar(); //checks to see if any textboxes are empty if so then it carrys on if (FirstNameBox.Text == "" || LastNameBox.Text == "" || DOBpicker.Text == "" || JobTitleBox.Text == "" || EmailBox.Text == "" || Username.Text == "" || Password.Text == "") { // if a empty a message box shows to ask to enter all fields MessageBox.Show("Please enter all fields!"); //simple return function as we dont want the rest of the code to continue return; } // if both useername and email are not empty and are equal to values in the database it does the following commands if (result != null || emailResult != null) { //if the user name and email is null then set them to red if (result != null && emailResult != null) { Username.BackColor = Color.LightCoral; EmailBox.BackColor = Color.LightCoral; MessageBox.Show("This Username & Email already exist!"); } //if the username is null set the email to green but the username to red else if (result != null) { EmailBox.BackColor = Color.LightGreen; Username.BackColor = Color.LightCoral; MessageBox.Show("This Username already exist!"); } //if the email is null set the email to red and the username to green else if (emailResult != null) { EmailBox.BackColor = Color.LightCoral; Username.BackColor = Color.LightGreen; MessageBox.Show("This Email already exist!"); } //close connection to database con.Close(); } //if no duplicates are found it will move on to adding the data to the database else { // creates a new connection { //creates the new command to insert values into the database but uses values for neater code Random rnd = new Random(); int ID = rnd.Next(2000, 4000); int Employeeid = ID; //SAME AS REGISTER PAGE SqlCommand EmployeeCheck = new SqlCommand("SELECT * from Employees where EmployeeID='" + Employeeid + "'", con); SqlCommand cmd = new SqlCommand("insert into Employees (EmployeeID, FirstName, LastName, DOB, Address, Salary, Department, JobTitle, Role, Email, UserID, Password) " + " values(@EmployeeID, @FirstName, @LastName, @DOB, @Address, @Salary, @Department, @JobTitle, @Role, @Email, @UserID, @Password)", con); SqlDataAdapter da = new SqlDataAdapter(EmployeeCheck); DataSet ds = new DataSet(); da.Fill(ds); int i = ds.Tables[0].Rows.Count; if (i > 0) { MessageBox.Show(i.ToString()); //create a new id int newID = rnd.Next(2000, 10000); cmd.Parameters.AddWithValue("@EmployeeID", newID); cmd.Parameters.AddWithValue("@FirstName", FirstNameBox.Text); cmd.Parameters.AddWithValue("@LastName", LastNameBox.Text); cmd.Parameters.AddWithValue("@DOB", DOBpicker.Text); cmd.Parameters.AddWithValue("@Address", Address.Text); //sets the salary value to the variable based on which role is selected // CLEAN UP ALL IFS STATEMENTS if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Manager") { cmd.Parameters.AddWithValue("@Salary", Manager); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Engineer") { cmd.Parameters.AddWithValue("@Salary", Engineer); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Team Leader") { cmd.Parameters.AddWithValue("@Salary", TeamLeader); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Engineer Scheduler") { cmd.Parameters.AddWithValue("@Salary", EngineerScheduler); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Senior Developer") { cmd.Parameters.AddWithValue("@Salary", SeniorDevelopment); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Programmer") { cmd.Parameters.AddWithValue("@Salary", Programmer); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Anaylst") { cmd.Parameters.AddWithValue("@Salary", Anaylst); } cmd.Parameters.AddWithValue("@Department", DepartmentBox.GetItemText(DepartmentBox.SelectedItem)); cmd.Parameters.AddWithValue("@JobTitle", JobTitleBox.Text); cmd.Parameters.AddWithValue("@Role", RoleBox.GetItemText(RoleBox.SelectedItem)); cmd.Parameters.AddWithValue("@Email", EmailBox.Text); cmd.Parameters.AddWithValue("@UserID", Username.Text); decryptedPassword = Password.Text; //adds the password as normal but adds it as an encrypted value cmd.Parameters.AddWithValue("@Password", PasswordLogin.encryptPassword(Password.Text.Trim())); //passing id cmd.ExecuteNonQuery(); //shows a succesful message MessageBox.Show("Succesfully Registerd!"); FirstNameBox.Clear(); LastNameBox.Clear(); JobTitleBox.Clear(); EmailBox.Clear(); Username.Clear(); Password.Clear(); Address.Clear(); DOBpicker.ResetText(); RoleBox.ResetText(); DepartmentBox.ResetText(); } else { cmd.Parameters.AddWithValue("@EmployeeID", Employeeid); cmd.Parameters.AddWithValue("@FirstName", FirstNameBox.Text); cmd.Parameters.AddWithValue("@LastName", LastNameBox.Text); cmd.Parameters.AddWithValue("@DOB", DOBpicker.Text); cmd.Parameters.AddWithValue("@Address", Address.Text); //sets the salary value to the variable based on which role is selected // CLEAN UP ALL IFS STATEMENTS if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Manager") { cmd.Parameters.AddWithValue("@Salary", Manager); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Engineer") { cmd.Parameters.AddWithValue("@Salary", Engineer); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Team Leader") { cmd.Parameters.AddWithValue("@Salary", TeamLeader); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Engineer Scheduler") { cmd.Parameters.AddWithValue("@Salary", EngineerScheduler); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Senior Developer") { cmd.Parameters.AddWithValue("@Salary", SeniorDevelopment); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Programmer") { cmd.Parameters.AddWithValue("@Salary", Programmer); } else if (RoleBox.GetItemText(RoleBox.SelectedItem) == "Anaylst") { cmd.Parameters.AddWithValue("@Salary", Anaylst); } cmd.Parameters.AddWithValue("@Department", DepartmentBox.GetItemText(DepartmentBox.SelectedItem)); cmd.Parameters.AddWithValue("@JobTitle", JobTitleBox.Text); cmd.Parameters.AddWithValue("@Role", RoleBox.GetItemText(RoleBox.SelectedItem)); cmd.Parameters.AddWithValue("@Email", EmailBox.Text); cmd.Parameters.AddWithValue("@UserID", Username.Text); decryptedPassword = Password.Text; //adds the password as normal but adds it as an encrypted value cmd.Parameters.AddWithValue("@Password", PasswordLogin.encryptPassword(Password.Text.Trim())); cmd.ExecuteNonQuery(); //closes connection con.Close(); //shows a succesful message MessageBox.Show("Succesfully Registerd!"); FirstNameBox.Clear(); LastNameBox.Clear(); JobTitleBox.Clear(); EmailBox.Clear(); Username.Clear(); Password.Clear(); Address.Clear(); DOBpicker.ResetText(); RoleBox.ResetText(); DepartmentBox.ResetText(); } } } }