Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int  choiceId      = dbOps.getChoice(sysMessages.msgSaveCap);
            bool goodToProceed = entryVal.validateCustomerEntry(choiceId,
                                                                txtFirstName.Text,
                                                                txtLastName.Text);

            try
            {
                if (goodToProceed)
                {
                    int    zip       = customerOps.check_ZIP(txtZIP.Text);
                    string state     = customerOps.convertState(cboState.Text);
                    string homePhone = customerOps.convertPhone(txtHome.Text);
                    string cellPhone = customerOps.convertPhone(txtCell.Text);
                    string workPhone = customerOps.convertPhone(txtWork.Text);

                    addCustomer.NewCustomer(txtFirstName.Text,
                                            txtLastName.Text,
                                            txtAddress.Text,
                                            txtCity.Text,
                                            state,
                                            zip,
                                            homePhone,
                                            cellPhone,
                                            workPhone,
                                            txtEMail.Text,
                                            txtCustomerNotes.Text,
                                            userId);
                }
                else
                {
                    MessageBox.Show(sysMessages.msgIncompleteEntry,
                                    sysMessages.msgAttention,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString(),
                                sysMessages.dbError,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                clearEntries();
                txtFirstName.Focus();
            }
        }