//private int check_ZIP(string zip) //{ // int zipCode = 0; // if (zip != String.Empty) // { // zipCode = int.Parse(zip); // } // return zipCode; //} //private string convertState(string stateName) //{ // string stateAbbr = String.Empty; // SqlDataReader state = dbOps.ExecuteReader(DB.DB_Conn, // dbSQL.sqlConvertStates + stateName + sysMessages.msgQuote, // CommandType.Text); // while (state.Read()) // { // stateAbbr = state.GetValue(0).ToString(); // } // return stateAbbr; //} //private string convertPhone(string phoneNumber) //{ // string phoneFormat = String.Empty; // if (phoneNumber != sysMessages.msgPhoneFormat) // { // phoneFormat = phoneNumber; // } // return phoneFormat; //} private void btnClose_Click(object sender, EventArgs e) { int choiceId = dbOps.getChoice(sysMessages.msgClose); bool goodToProceed = entryVal.validateCustomerEntry(choiceId, txtFirstName.Text, txtLastName.Text); if (goodToProceed) { string msg = sysMessages.msgThereIs + sysMessages.msgSpace + sysMessages.msgCustomer.ToLower() + sysMessages.msgSpace + sysMessages.msgDataEntered + sysMessages.msgSpace + sysMessages.msgSaved + sysMessages.msgPeriod + sysMessages.msgSpace + sysMessages.msgAreYouSure + sysMessages.msgSpace + sysMessages.msgYouWishTo + sysMessages.msgSpace + sysMessages.msgSave + sysMessages.msgSpace + sysMessages.msgProcess + sysMessages.msgQuestion; result = MessageBox.Show(msg, sysMessages.msgAttention, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (result == DialogResult.Yes) { this.Close(); } } else { this.Close(); } }
private void btnUpdate_Click(object sender, EventArgs e) { string stateAbbr = customerOps.convertState(cboState.Text); string updatedValues = dataUpdated(); int recordTypeId = dbOps.getRecordUpdateType(sysMessages.msgCustomer); int processId = dbOps.getSystemProcess(sysMessages.msgCustomer); int customerId = dbOps.getRecordIdByNameValue(processId, cboRecords.Text, false); try { int choiceId = dbOps.getChoice(sysMessages.msgSaveCap); bool goodToProceed = entryVal.validateCustomerEntry(choiceId, txtFirstName.Text, txtLastName.Text); //if (cboRecords.Text != String.Empty) if (goodToProceed) { updateCustomer.CustomerUpdate(recordTypeId, customerId, txtFirstName.Text, txtLastName.Text, txtAddress.Text, txtCity.Text, stateAbbr, int.Parse(txtZIP.Text), txtHome.Text, txtCell.Text, txtWork.Text, txtEMail.Text, txtCustomerNotes.Text, userId, updatedValues); } else { MessageBox.Show(sysMessages.msgMakeChoice, sysMessages.msgAttention, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception e1) { MessageBox.Show(e1.ToString(), sysMessages.dbError, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (cboRecords.Text != String.Empty) { cboRecords.Text = String.Empty; this.Close(); } else { cboRecords.Focus(); } } }