public void EnterContactAndBillingInfo() { string firstName = Generator.RandomString(5, 0); string lastName = Generator.RandomString(5, 0); string companyName = Generator.RandomString(5, 0); string phoneNumber = Generator.RandomInt(0, 999999).ToString() + Generator.RandomInt(0, 999999).ToString(); string email = Generator.RandomString(5, 0) + "@test.com"; FirstName.SendKeys(firstName); LastName.SendKeys(lastName); CompanyName.SendKeys(companyName); Email.SendKeys(email); PhoneNumber.SendKeys("0"); PhoneNumber.Clear(); PhoneNumber.Set(phoneNumber); //select Billing address; javaScriptExecutor.ExecuteScript("arguments[0].click();", AddressBookLink); System.Threading.Thread.Sleep(3000); webDriver.SwitchTo().Frame(webDriver.FindElement(By.Id("billing_address_wizard_modal_iframe"))); javaScriptExecutor.ExecuteScript("arguments[0].click();", SelectBtn); webDriver.SwitchTo().DefaultContent(); javaScriptExecutor.ExecuteScript("arguments[0].click();", EquoteContactContinueBtn); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(30)); javaScriptExecutor.ExecuteScript("arguments[0].click();", ExportOption); javaScriptExecutor.ExecuteScript("arguments[0].click();", ShippingContinueButton); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(30)); javaScriptExecutor.ExecuteScript("arguments[0].click();", PurchaseOrderSelectBtn); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(30)); javaScriptExecutor.ExecuteScript("arguments[0].click();", PaymentContinueBtn); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(30)); }
// clears form public void ClearForm() { FirstName.Clear(); Name.Clear(); PhoneNumber.Clear(); Email.Clear(); }
private void clear_Click(object sender, EventArgs e) { VendorName.Clear(); VendorAddress.Clear(); PhoneNumber.Clear(); email.Clear(); VendorID.Clear(); }
private void ResetForm() { StudentId = 0; FirstName.Clear(); LastName.Clear(); Group.Clear(); Address.Clear(); PhoneNumber.Clear(); }
private void ClearPersonalData_Click(object sender, RoutedEventArgs e) { Username.Clear(); Surname.Clear(); StreetName.Clear(); PostalCode.Clear(); PhoneNumber.Clear(); City.Clear(); Email.Clear(); }
private void resetlist_Click(object sender, EventArgs e) { ID_Student.Clear(); Firstname.Clear(); Lastname.Clear(); PhoneNumber.Clear(); Address.Clear(); picturestudent.Image = null; RadioMale.Checked = false; RadioFemale.Checked = false; }
private void cleartextboxes() { FirstName.Clear(); LastName.Clear(); Address.Clear(); PhoneNumber.Clear(); CustomerID.Clear(); VideoId.Clear(); RentedCost.Clear(); Year.Clear(); Title.Clear(); Genre.Clear(); }
private void update_Click(object sender, EventArgs e) { if (VendorName.Text == "" || VendorAddress.Text == "" || PhoneNumber.Text == "" || email.Text == "" || VendorID.Text == "") { MessageBox.Show("Please provide all the details", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Connect connectObj = new Connect(); con = connectObj.connect(); SqlCommand cmd = new SqlCommand("UPDATE VENDOR SET vname = @vname,address = @address,phone_number = @phno,email = @email WHERE vid = @id;", con); cmd.Parameters.AddWithValue("@id", VendorID.Text); cmd.Parameters.AddWithValue("@vname", VendorName.Text); cmd.Parameters.AddWithValue("@phno", Convert.ToInt64(PhoneNumber.Text)); cmd.Parameters.AddWithValue("@address", VendorAddress.Text); cmd.Parameters.AddWithValue("@email", email.Text); int i = cmd.ExecuteNonQuery(); //If count is equal to 1, than show frmMain form if (i != 0) { MessageBox.Show("Vendor Updation Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Vendor Updation Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } con.Close(); } catch (Exception ex) { MessageBox.Show("Vendor not found", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (con != null) { con.Close(); } } VendorName.Clear(); VendorAddress.Clear(); PhoneNumber.Clear(); email.Clear(); VendorID.Clear(); }
//Method for filling the personal details form public void FillPersonalDetails(PersonalDetails details) { Address.Clear(); Address.SendKeys(details.Address); PostCode.Clear(); PostCode.SendKeys(details.PostCode); City.Clear(); City.SendKeys(details.City); Name.Clear(); Name.SendKeys(details.Name); PhoneNumber.Clear(); PhoneNumber.SendKeys(details.PhoneNumber); Email.Clear(); Email.SendKeys(details.Email); }
private void clear_Click(object sender, EventArgs e) { Cust_search.Clear(); CustName.Clear(); PhoneNumber.Clear(); Cust_address.Clear(); custEmail.Clear(); Product_search.Clear(); Product_Name.Clear(); ProductID.Clear(); Total_Amt.Text = "0"; SubTotal.Clear(); Discount.Text = "0"; GST.Clear(); PaidAmount.Clear(); ReturnAmount.Clear(); Quantity.Text = "0"; Amount.Text = "0"; AddedProducts.DataSource = null; }
private void Cust_search_TextChanged(object sender, EventArgs e) { String keyword = Cust_search.Text; if (keyword == "") { Cust_search.Clear(); CustName.Clear(); PhoneNumber.Clear(); Cust_address.Clear(); custEmail.Clear(); return; } Connect connectObj = new Connect(); con = connectObj.connect(); DataTable dt = new DataTable(); try { String sql = "SELECT CNAME,ADDRESS,PHONE_NUMBER,EMAIL,C_ID FROM CUSTOMER WHERE C_ID LIKE '%" + keyword + "%' OR CNAME LIKE '%" + keyword + "%';"; SqlDataAdapter adpt = new SqlDataAdapter(sql, con); adpt.Fill(dt); if (dt.Rows.Count > 0) { CustName.Text = dt.Rows[0]["CNAME"].ToString(); PhoneNumber.Text = dt.Rows[0]["PHONE_NUMBER"].ToString(); Cust_address.Text = dt.Rows[0]["ADDRESS"].ToString(); custEmail.Text = dt.Rows[0]["EMAIL"].ToString(); cid = dt.Rows[0]["C_ID"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddButton_Click(object sender, RoutedEventArgs e) { // Variables for text boxes string firstName = FirstName.Text; string lastName = LastName.Text; string age = DatePicker.Text; // Create error boxes for empty inputs if (string.IsNullOrEmpty(FirstName.Text)) { MessageBox.Show("Error: You must insert a First Name >>>"); FirstName.Text = ""; } if (string.IsNullOrEmpty(LastName.Text)) { MessageBox.Show("Error: You must insert a Last Name >>>"); LastName.Text = ""; } if (int.TryParse(PhoneNumber.Text, out int phone)) { MessageBox.Show("Error: Please insert a valid phone number >>>"); PhoneNumber.Text = ""; } // Find users age int userAge = (DateTime.Now.Year - DateTime.Parse(age).Year); // String to add to listbox. string a = ($"{LastName.Text}, {FirstName.Text} ({userAge}): {phone}"); ListBox.Items.Add(a); FirstName.Clear(); LastName.Clear(); PhoneNumber.Clear(); // DatePicker.ClearValue(); Can't Reset. }
private void Save_Click(object sender, EventArgs e) { //Create the orders try { Connect connectObj = new Connect(); con = connectObj.connect(); SqlCommand cmd = new SqlCommand("Insert into MYORDER (ORD_ID,CID,DATE,AMOUNT) values(@oid,@cid,@date,@amount);", con); cmd.Parameters.AddWithValue("@oid", OrderID.Text); //cmd.Parameters.AddWithValue("@pid", textBox8.Text); cmd.Parameters.AddWithValue("@cid", cid); cmd.Parameters.AddWithValue("@date", date.Text); cmd.Parameters.AddWithValue("@amount", Total_Amt.Text); int i = cmd.ExecuteNonQuery(); //If count is equal to 1, than show frmMain form if (i != 0) { MessageBox.Show("Order Insertion Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Order Insertion Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (con != null) { con.Close(); } } //Insert into orderDetails try { int j; Connect connectObj = new Connect(); con = connectObj.connect(); for (int i = 0; i < transactionDT.Rows.Count; i++) { SqlCommand cmd = new SqlCommand("Insert into ORDER_DETAILS (ord_id,pid,quantity) values(@oid,@pid,@quantity);", con); cmd.Parameters.AddWithValue("@oid", OrderID.Text); cmd.Parameters.AddWithValue("@pid", transactionDT.Rows[i]["Product ID"].ToString()); cmd.Parameters.AddWithValue("@quantity", transactionDT.Rows[i]["Quantity"].ToString()); j = cmd.ExecuteNonQuery(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (con != null) { con.Close(); } } //Update stock table after creating order try { int j; Connect connectObj = new Connect(); con = connectObj.connect(); for (int i = 0; i < transactionDT.Rows.Count; i++) { SqlCommand cmd = new SqlCommand("UPDATE STOCK SET QUANTITY = QUANTITY - @quantity WHERE PID = @pid", con); cmd.Parameters.AddWithValue("@pid", transactionDT.Rows[i]["Product ID"].ToString()); cmd.Parameters.AddWithValue("@quantity", transactionDT.Rows[i]["Quantity"].ToString()); j = cmd.ExecuteNonQuery(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (con != null) { con.Close(); } } //Clear all the fields. Cust_search.Clear(); CustName.Clear(); PhoneNumber.Clear(); Cust_address.Clear(); custEmail.Clear(); Product_search.Clear(); Product_Name.Clear(); ProductID.Clear(); Total_Amt.Text = "0"; SubTotal.Clear(); Discount.Text = "0"; GST.Clear(); PaidAmount.Clear(); ReturnAmount.Clear(); Quantity.Text = "0"; Amount.Text = "0"; AddedProducts.DataSource = null; }
private void button1_Click(object sender, EventArgs e) { int broj; if (FirstName.Text == "") { MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); FirstName.Focus(); return; } else if (LastName.Text == "") { MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); LastName.Focus(); return; } else if (UniqueIN.Text == "") { MessageBox.Show("you did not enter the unique identifacion number of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UniqueIN.Focus(); return; } else if (IDNumber.Text == "") { MessageBox.Show("you did not enter the ID number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); IDNumber.Focus(); return; } else if (Address.Text == "") { MessageBox.Show("you did not enter the address of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); Address.Focus(); return; } else if (PhoneNumber.Text == "" && Int32.TryParse(PhoneNumber.Text, out broj)) { MessageBox.Show("you did not enter the phone number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); PhoneNumber.Focus(); return; } else if (Municipalities.Text == "") { MessageBox.Show("you did not enter the municipalities of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (UniqueIN.Text.Length < 13) { MessageBox.Show("Unesite isprevno JMBG"); UniqueIN.Clear(); UniqueIN.Focus(); } else if (UniqueIN.Text.Length > 13) { MessageBox.Show("Unesite isprevno JMBG"); UniqueIN.Clear(); UniqueIN.Focus(); } else if (IDNumber.Text.Length < 9) { MessageBox.Show("Unesite isprevno BRLK"); IDNumber.Clear(); IDNumber.Focus(); } else if (IDNumber.Text.Length > 9) { MessageBox.Show("Unesite isprevno BRLK"); IDNumber.Clear(); IDNumber.Focus(); } else { SqlConnection con = new SqlConnection(Form1.path); try { con.Close(); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandText = "SELECT Id FROM municipalities WHERE name = '" + Municipalities.SelectedItem.ToString() + "';"; SqlDataReader rdr = command.ExecuteReader(); rdr.Read(); int d = rdr.GetInt32(0); rdr.Close(); command.CommandText = "INSERT INTO candidate ( municipalities_id, first_name, last_name, unique_identifacion_number, Id_number, address, phone_number) VALUES ( " + d + ",'" + FirstName.Text + "','" + LastName.Text + "','" + UniqueIN.Text + "','" + IDNumber.Text + "','" + Address.Text + "'," + int.Parse(PhoneNumber.Text) + ");"; command.ExecuteNonQuery(); MessageBox.Show("Successfully entered candidate"); FirstName.Clear(); LastName.Clear(); UniqueIN.Clear(); IDNumber.Clear(); Address.Clear(); PhoneNumber.Clear(); Municipalities.SelectedIndex = -1; con.Close(); } catch (Exception ee) { MessageBox.Show("" + ee.ToString()); return; } } }