private bool Validation() { if (string.IsNullOrWhiteSpace(TextBoxFirstName.Text)) { MessageBox.Show("Enter first name"); TextBoxFirstName.Focus(); return(false); } if (string.IsNullOrWhiteSpace(TextBoxLastName.Text)) { MessageBox.Show("Enter last name"); TextBoxLastName.Focus(); return(false); } if (string.IsNullOrWhiteSpace(DataPicker1.Text)) { MessageBox.Show("Enter date"); DataPicker1.Focus(); return(false); } return(true); }
private void ButtonRemove_Click(object sender, RoutedEventArgs e) { if (ListBox1.SelectedIndex < 0) { MessageBox.Show("Select employee"); return; } Employee e1 = ListBox1.SelectedItem as Employee; MessageBoxResult mbr = MessageBox.Show("Delete employee: " + e1.ToString(), "Delete", MessageBoxButton.YesNo); if (mbr == MessageBoxResult.No) { return; } int result = eDal.DeleteEmployee(e1); if (result == 0) { ShowEmployees(); TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxDateOfBirth.Clear(); MessageBox.Show("Employee deleted"); } else { MessageBox.Show("Error"); } }
/// <summary> /// Helper methods to display information in the Results textbox. /// </summary> private void ResultsClear() { TextBoxResults.Clear(); TextBoxLeadID.Clear(); TextBoxCapturedBy.Clear(); TextBoxCapturedDate.Clear(); TextBoxRegID.Clear(); TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxTitle.Clear(); TextBoxCompany.Clear(); TextBoxCompany2.Clear(); TextBoxAddress.Clear(); TextBoxAddress2.Clear(); TextBoxAddress3.Clear(); TextBoxCity.Clear(); TextBoxStateCode.Clear(); TextBoxZipCode.Clear(); TextBoxCountryCode.Clear(); TextBoxEmail.Clear(); TextBoxPhone.Clear(); TextBoxPhoneExt.Clear(); TextBoxFax.Clear(); TextBoxNotes.Clear(); dgvDemographics.DataSource = null; }
private void buttonSubmit_Click(object sender, EventArgs e) { if (checkBoxAgreement.Checked == false) { MessageBox.Show("Please indicate that you agree to the Terms"); checkBoxAgreement.Focus(); return; } if (TextBoxFirstName.Text == "") { MessageBox.Show("Please complete all sections before submitting"); TextBoxFirstName.Focus(); return; } if (this.ValidateChildren(ValidationConstraints.Enabled)) { string successline = "Thank you for your application " + TextBoxFirstName.Text + Environment.NewLine + "A confirmation of your submission will be sent to " + textBoxEmail.Text; MessageBox.Show(successline); } else { MessageBox.Show("There are missing details in the form. Please complete all sections before submitting."); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } }
public void ClearInputs() { TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxAge.Clear(); TextBoxEmail.Clear(); TextBoxAddress.Clear(); TextBoxSSN.Clear(); ComboBoxGender.SelectedIndex = -1; }
private void ClearFields() { TextBoxYear.Clear(); TextBoxMonth.Clear(); TextBoxDay.Clear(); TextBoxFirstName.Clear(); TextBoxSecondName.Clear(); TextBoxLastName.Clear(); TextBoxPasportNumber.Clear(); TextBoxPasportSeries.Clear(); }
private void ClearFields() { TextBoxYear.Clear(); TextBoxMonth.Clear(); TextBoxDay.Clear(); TextBoxFirstName.Clear(); TextBoxSecondName.Clear(); TextBoxLastName.Clear(); TextBoxLocation.Clear(); TextBoxPost.Clear(); }
internal void ClearControls() { TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxCitizenID.Clear(); TextBoxContact.Clear(); DateTimeHireStaff.ResetText(); TextBoxAddress.Clear(); TextBoxCity.Clear(); TextBoxZipCode.Clear(); TextBoxEmail.Clear(); }
private void TextBoxCardID_KeyDown(object sender, KeyEventArgs e) { // check for user or scanner 'pressing' enter if (e.KeyData.ToString().Equals("Return")) { // don't let the textbox handle it further e.SuppressKeyPress = true; // automatically go to the next text box TextBoxFirstName.Focus(); } }
internal void clearAll() { TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxIDNumber.Clear(); ComboBoxGender.ResetText(); TextBoxContactNumber.Clear(); TextBoxEmailAddress.Clear(); TextBoxAddressLine1.Clear(); TextBoxSuburb.Clear(); TextBoxCity.Clear(); TextBoxZipCode.Clear(); DateAdmission.ResetText(); ComboBoxCentre.ResetText(); }
protected void Page_Load(object sender, EventArgs e) { this.accountContactId = Common.GetEncryptedQueryStringValue("AccountContactId", 0); this.accountId = Common.GetEncryptedQueryStringValue("AccountId", 0); LabelPageTitle.Text = "Account Contact"; Page.Form.DefaultFocus = TextBoxFirstName.ClientID; Page.Form.DefaultButton = ButtonSave.UniqueID; if (!IsPostBack) { TextBoxFirstName.Focus(); ButtonSave.Visible = true; ButtonSaveNew.Visible = true; if (ViewState["AccountContactId"] != null) { this.accountContactId = Convert.ToInt32(ViewState["AccountContactId"].ToString()); } if (ViewState["AccountId"] != null) { this.accountId = Convert.ToInt32(ViewState["AccountId"].ToString()); } if (this.accountContactId != 0) { BindAccountContact(); } if (this.accountId != 0) { ButtonSave.Visible = false; ButtonSaveNew.Visible = false; ButtonSaveLink.Visible = true; BindAccountContactGridView(); } else { ButtonSave.Visible = true; ButtonSaveNew.Visible = true; ButtonSaveLink.Visible = false; } } }
private bool CheckAllFields() { ErrMsg errMsg; errMsg = Check.CheckField(FieldName.IsInsured, TextBoxInsured.Text); if (errMsg.ErrorId != "00") { SetOnErrMsg(errMsg); TextBoxInsured.Focus(); TextBoxInsured.ForeColor = Color.Red; return(false); } errMsg = Check.CheckField(FieldName.FirstName, TextBoxFirstName.Text); if (errMsg.ErrorId != "00") { SetOnErrMsg(errMsg); TextBoxFirstName.Focus(); TextBoxFirstName.ForeColor = Color.Red; return(false); } errMsg = Check.CheckField(FieldName.LastName, TextBoxLastName.Text); if (errMsg.ErrorId != "00") { SetOnErrMsg(errMsg); TextBoxLastName.Focus(); TextBoxLastName.ForeColor = Color.Red; return(false); } // Sterrenbeeld moet kloppen: errMsg = Check.CheckField(FieldName.Zodiac, TextBoxZodiac.Text); if (errMsg.ErrorId != "00") { SetOnErrMsg(errMsg); TextBoxZodiac.Focus(); TextBoxZodiac.ForeColor = Color.Red; return(false); } return(true); }
private void clearTextBox() { TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxInitials.Clear(); TextBoxLoginUser.Clear(); TextBoxPasswordUser.Clear(); ChkBoxAdministrator.IsChecked = false; ChkBoxDismissed.IsChecked = false; ChkBoxPreClean.IsChecked = false; ChkBoxTesting.IsChecked = false; ChkBoxDebug.IsChecked = false; ChkBoxRepaire.IsChecked = false; ChkBoxFinalQC.IsChecked = false; ChkBoxReport.IsChecked = false; //ChkBoxOrder.IsChecked = false; btAddUser.Visibility = Visibility.Visible; btDeleteUser.Visibility = Visibility.Hidden; btUpdateUser.Visibility = Visibility.Hidden; }
private void ButtonRemove_Click(object sender, RoutedEventArgs e) { EmployeeServiceClient klijent = new EmployeeServiceClient(); if (ListBox1.SelectedIndex < 0) { MessageBox.Show("Select employee"); return; } EmployeeCon e2 = ListBox1.SelectedItem as EmployeeCon; MessageBoxResult mbr = MessageBox.Show("Delete employee: " + e2.ToString(), "Delete", MessageBoxButton.YesNo); if (mbr == MessageBoxResult.No) { return; } int result = klijent.DeleteEmployee(e2); klijent.Close(); if (result == 0) { ShowEmployees(); TextBoxFirstName.Clear(); TextBoxLastName.Clear(); TextBoxDateOfBirth.Clear(); MessageBox.Show("Employee deleted"); } else { MessageBox.Show("Error"); } }
private void TextBoxCutomerNo_Validated(object sender, EventArgs e) { if (TextBoxCutomerNo.Text.ToString().Trim().Length < 6 && TextBoxCutomerNo.Text.ToString().Trim().Length > 0) { TextBoxCutomerNo.Text = TextBoxCutomerNo.Text.Trim().PadLeft(6, '0'); } lsCustomerNo = TextBoxCutomerNo.Text.ToString().Trim(); if (lsCustomerNo == "") // Moses Newman 03/02/2012 previously only returned if in Add Mode!!! { return; } CUSTOMERTableAdapter.Fill(gsData.CUSTOMER, lsCustomerNo); if (gsData.CUSTOMER.Rows.Count > 0) { TextBoxFirstName.Text = gsData.CUSTOMER.Rows[0].Field <String>("CUSTOMER_FIRST_NAME"); TextBoxFirstName.Refresh(); TextBoxLastName.Text = gsData.CUSTOMER.Rows[0].Field <String>("CUSTOMER_LAST_NAME"); TextBoxLastName.Refresh(); textBoxSSNLast4.Text = gsData.CUSTOMER.Rows[0].Field <String>("CUSTOMER_SS_3"); textBoxSSNLast4.Refresh(); comboBoxSide.Text = "CLOSED"; comboBoxSide.Refresh(); nullableDateTimePickerArchivedDate.Value = DateTime.Now; nullableDateTimePickerArchivedDate.Refresh(); textBoxDealerNo.Text = gsData.CUSTOMER.Rows[0].Field <String>("CUSTOMER_DEALER"); textBoxDealerNo.Refresh(); DEALERTableAdapter.Fill(gsData.DEALER, gsData.CUSTOMER.Rows[0].Field <String>("CUSTOMER_DEALER")); if (gsData.DEALER.Rows.Count > 0) { textBoxDealerName.Text = gsData.DEALER.Rows[0].Field <String>("DEALER_NAME"); textBoxDealerName.Refresh(); } IsFound = true; } else { OPNCUSTTableAdapter.Fill(gsData.OPNCUST, lsCustomerNo); if (gsData.OPNCUST.Rows.Count > 0) { TextBoxFirstName.Text = gsData.OPNCUST.Rows[0].Field <String>("CUSTOMER_FIRST_NAME"); TextBoxFirstName.Refresh(); TextBoxLastName.Text = gsData.OPNCUST.Rows[0].Field <String>("CUSTOMER_LAST_NAME"); TextBoxLastName.Refresh(); textBoxSSNLast4.Text = gsData.OPNCUST.Rows[0].Field <String>("CUSTOMER_SS_3"); textBoxSSNLast4.Refresh(); comboBoxSide.Text = "OPEN"; comboBoxSide.Refresh(); nullableDateTimePickerArchivedDate.Value = DateTime.Now; nullableDateTimePickerArchivedDate.Refresh(); textBoxDealerNo.Text = gsData.OPNCUST.Rows[0].Field <String>("CUSTOMER_DEALER"); textBoxDealerNo.Refresh(); OPNDEALRTableAdapter.Fill(gsData.OPNDEALR, gsData.OPNCUST.Rows[0].Field <String>("CUSTOMER_DEALER")); if (gsData.OPNDEALR.Rows.Count > 0) { textBoxDealerName.Text = gsData.OPNDEALR.Rows[0].Field <String>("OPNDEALR_NAME"); textBoxDealerName.Refresh(); } IsFound = true; } } }
//Update Customer table data private void UpdateCustomer_Click(object sender, EventArgs e) { try { string custId = tbxCustomerID.Text; string FirstName, LastName, fatherName, address, phone; LastName = textBoxLastName.Text; FirstName = TextBoxFirstName.Text; address = textBoxAddress.Text; phone = textBoxPhone.Text; fatherName = textBox1FatherName.Text; if (FirstName == "") { MessageBox.Show("First name required!"); TextBoxFirstName.Focus(); } else if (LastName == "") { MessageBox.Show("Last name required!"); textBoxLastName.Focus(); } else if (fatherName == "") { MessageBox.Show("Father's name required!"); textBox1FatherName.Focus(); } else if (address == "") { MessageBox.Show("Address required!"); textBoxAddress.Focus(); } else if (phone == "") { MessageBox.Show("Phone number required!"); textBoxPhone.Focus(); } else { CustomerDataTbl data = new CustomerDataTbl(); data.FirstName = FirstName; data.LastName = LastName; data.Address = address; data.Phone = phone; data.fatherName = fatherName; data.CustId = int.Parse(custId); if (new Customer().UpdateCustomerInformation(data)) { AddCustomer.Enabled = true; BindDdlWithCustomer(); // Bind comboBox with Customer table BindGridCustomersTbl(); // BindGridView with Customer table MessageBox.Show("Customer Data Updated!"); TextBoxFirstName.Text = ""; textBoxLastName.Text = ""; textBoxAddress.Text = ""; textBox1FatherName.Text = ""; textBoxPhone.Text = ""; tbxCustomerID.Text = ""; } else { MessageBox.Show("Unable to update this customer!!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); DataBaseConnection.CloseConnection(); // close connection with database when error occured } }
//Add Customers to database private void AddCustomer_Click(object sender, EventArgs e) { try { string Firstname, Lastname, address, phone, fatherName; Firstname = TextBoxFirstName.Text; Lastname = textBoxLastName.Text; address = textBoxAddress.Text; phone = textBoxPhone.Text; fatherName = textBox1FatherName.Text; if (Firstname == "") { MessageBox.Show("First name required!"); TextBoxFirstName.Focus(); } else if (Lastname == "") { MessageBox.Show("Last name required!"); textBoxLastName.Focus(); } else if (fatherName == "") { MessageBox.Show("Father's name required!"); textBox1FatherName.Focus(); } else if (address == "") { MessageBox.Show("Address required!"); textBoxAddress.Focus(); } else if (phone == "") { MessageBox.Show("Phone number required!"); textBoxPhone.Focus(); } else { CustomerDataTbl data = new CustomerDataTbl(); data.FirstName = Firstname; data.LastName = Lastname; data.fatherName = fatherName; data.Address = address; data.Phone = phone; if (new Customer().AddCustomerData(data)) { BindDdlWithCustomer(); // bind customer table to combobox BindGridCustomersTbl(); // Bind GridView with Customer table MessageBox.Show("Customer Saved to Database!!"); TextBoxFirstName.Text = ""; textBoxLastName.Text = ""; textBoxAddress.Text = ""; textBox1FatherName.Text = ""; textBoxPhone.Text = ""; } else { MessageBox.Show("Unable to add this customer!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); DataBaseConnection.CloseConnection(); // close DB connection when error occured } }
protected void Page_Load(object sender, EventArgs e) { this.insightSupplierContactId = Common.GetEncryptedQueryStringValue("InsightSupplierContactId", 0); this.insightSupplierId = Common.GetEncryptedQueryStringValue("InsightSupplierId", 0); LabelPageTitle.Text = "User"; Page.Form.DefaultFocus = TextBoxFirstName.ClientID; Page.Form.DefaultButton = ButtonSave.UniqueID; if (!IsPostBack) { TextBoxFirstName.Focus(); BindGift(); BindRegion(); BindAccessMethod(); BindLink(); BindOption(); BindModel(); //BindAccount(); BindLicense(); BindLicenseAllocated(); BindQlikviewVersion(); ButtonSave.Visible = true; ButtonSaveNew.Visible = true; PanelInstall.Visible = false; PanelOnline.Visible = false; PanelInSparMapper.Visible = false; if (ViewState["InsightSupplierContactId"] != null) { this.insightSupplierContactId = Convert.ToInt32(ViewState["InsightSupplierContactId"].ToString()); } if (ViewState["InsightSupplierId"] != null) { this.insightSupplierId = Convert.ToInt32(ViewState["InsightSupplierId"].ToString()); } if (this.insightSupplierId != 0) { ButtonSave.Visible = false; ButtonSaveNew.Visible = false; ButtonSaveLink.Visible = true; BindInsightSupplierContactGridView(); } else { ButtonSave.Visible = true; ButtonSaveNew.Visible = true; ButtonSaveLink.Visible = false; } if (this.insightSupplierContactId != 0) { BindInsightSupplierContact(); PanelAccessMethod.Visible = true; PanelDistributionConfig.Visible = true; if (this.insightSupplierId != 0) { ButtonSaveLink.Visible = true; } ButtonSaveEdit.Visible = false; } else { PanelAccessMethod.Visible = false; PanelDistributionConfig.Visible = false; ButtonSaveLink.Visible = false; ButtonSaveEdit.Visible = true; //PanelInstall.Visible = false; } //PanelViewLicenseDropdown.Visible = false; } }
//Update Customer Information private void UpdateCustomer_Click(object sender, EventArgs e) { try { string custId = tbxCustomerID.Text; string FirstName, LastName, address, phone; LastName = textBoxLastName.Text; FirstName = TextBoxFirstName.Text; address = textBoxAddress.Text; phone = textBoxPhone.Text; if (FirstName == "") { MessageBox.Show("First name is required!"); TextBoxFirstName.Focus(); } else if (LastName == "") { MessageBox.Show("Last name is required!"); textBoxLastName.Focus(); } else if (address == "") { MessageBox.Show("Address is required!"); textBoxAddress.Focus(); } else if (phone == "") { MessageBox.Show("Phone number is required!"); textBoxPhone.Focus(); } else { CustomerData data = new CustomerData { FirstName = FirstName, LastName = LastName, Address = address, Phone = phone, CustId = int.Parse(custId) }; if (new Customer().UpdateCustomerInformation(data)) { AddCustomer.Enabled = true; BindDdlCustomer(); // method calling to Bind comboBox Customer BindGridCustomersInfo(); // method calling to Bind GridView Customer MessageBox.Show("Customer Updated Successfully!"); TextBoxFirstName.Text = "First Name..."; textBoxLastName.Text = "Last Name..."; textBoxAddress.Text = "Address..."; textBoxPhone.Text = "Phone..."; tbxCustomerID.Text = ""; } else { MessageBox.Show("Unable to update this customer!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); DataBaseConnection.CloseConnection(); // close connection with database when error occured } }
/// <summary> /// Event that fires on Page Load Event /// </summary> protected void Page_Load(object sender, EventArgs eventArgument) { DataProvider.AuthorizeUser(); MasterPage masterPage = this.Page.Master; Header headerPage = (Header)masterPage; headerPage.DisplayDataFromMasterPage(Session["UserName"].ToString()); // Disable the Product selection DropdownList in Master Page Session["EnableProductSelection"] = false; string actionType = Request.Params["action"]; if (!Page.IsPostBack) { LabelRequiredFields.Text = Resources.Labels.RequiredFields; GetDataForDropDownLists(); DropDownListCountry.Attributes.Add("onChange", "javascript:GetStates('" + DropDownListCountry.ClientID + "', '" + HiddenFieldStateSource.ClientID + "', '" + HiddenFieldStateOthers.ClientID + "', '" + HiddenFieldState.ClientID + "')"); //DropDownListCountry.Attributes.Add("onFocus", "javascript:GetStates('" + DropDownListCountry.ClientID + "', '" + HiddenFieldStateSource.ClientID + "', '" + HiddenFieldStateOthers.ClientID + "', '" + HiddenFieldState.ClientID + "')"); ButtonAdd.Attributes.Add("onClick", "javascript:return ValidateInputData()"); ButtonUpdate.Attributes.Add("onClick", "javascript:return ValidateInputData()"); BuildCountriesAndStates(); } ButtonReset.Attributes.Add("onClick", "javascript:return ConfirmReset()"); // Set the focus to first editable control #region Display Registration Details if (!string.IsNullOrEmpty(actionType)) { if (actionType == "add") { DropDownListRegistrationType.Focus(); ButtonUpdate.Visible = false; ButtonAdd.Visible = true; TableManageRegistration.Rows[5].Visible = false; GetCustomfields(null); } else if (actionType == "update") { TextBoxFirstName.Focus(); ButtonAdd.Visible = false; ButtonUpdate.Visible = true; TableManageRegistration.Rows[5].Visible = true; if (Request["REC_ID"] != null) { string recordId = Request["REC_ID"].ToString(); HiddenRecordId.Value = recordId; if (!string.IsNullOrEmpty(Request.Params["pid"])) { HiddenProductId.Value = Request.Params["pid"]; } // Don't call GetRegistrationDetails when Update button is clicked if (Request.Form[ButtonUpdate.ClientID.Replace("_", "$")] == null && Page.IsPostBack == false) { GetRegistrationDetails(); } } } } #endregion }
private void TextBoxCardID_KeyDown(object sender, KeyEventArgs e) { // vars bool found = false; // check for user or scanner 'pressing' enter if (e.KeyData.ToString().Equals("Return")) { // don't let the textbox handle it further e.SuppressKeyPress = true; // don't allow changing the card id TextBoxCardID.ReadOnly = true; dt = sql.GetDataTable("select * from employees where employeeID=" + TextBoxCardID.Text.Trim() + ";"); // check if this is the card we're looking for if (dt.Rows.Count == 1) { // make note of card's position found = true; // enable editing and saving TextBoxFirstName.Enabled = true; TextBoxLastName.Enabled = true; TextBoxMI.Enabled = true; NumericUpDownHrRate.Enabled = true; RadioButtonFWS.Enabled = true; RadioButtonSWS.Enabled = true; RadioButtonMST.Enabled = true; RadioButtonHED.Enabled = true; RadioButtonHelp.Enabled = true; RadioButtonTutor1.Enabled = true; RadioButtonTutor2.Enabled = true; RadioButtonTANF.Enabled = true; ButtonSave.Enabled = true; try { // first name TextBoxFirstName.Text = dt.Rows[0].ItemArray[1].ToString(); // last name TextBoxLastName.Text = dt.Rows[0].ItemArray[2].ToString(); // middle initial TextBoxMI.Text = dt.Rows[0].ItemArray[3].ToString(); // hourly rate NumericUpDownHrRate.Value = Decimal.Parse(dt.Rows[0].ItemArray[4].ToString()); // position type switch (dt.Rows[0].ItemArray[5].ToString()) { case "FWS": RadioButtonFWS.Checked = true; break; case "SWS": RadioButtonSWS.Checked = true; break; case "MST": RadioButtonMST.Checked = true; break; case "HED": RadioButtonHED.Checked = true; break; case "Help": RadioButtonHelp.Checked = true; break; case "Tutor1": RadioButtonTutor1.Checked = true; break; case "Tutor2": RadioButtonTutor2.Checked = true; break; case "TANF": RadioButtonTANF.Checked = true; break; } // automatically go to the next text box TextBoxFirstName.Focus(); } catch (Exception err) { MessageBox.Show(this, "There was an error while trying to load your info.\nWas someone playing with the database files?\n\n" + err.Message, "Clocked Time Calculation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // notify user if card wasn't found if (!found) { MessageBox.Show(this, "The card you entered wasn't found. Are you sure you typed it in correctly?", "Card Not Found!", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxCardID.Clear(); TextBoxCardID.ReadOnly = false; TextBoxCardID.Focus(); } } }