Пример #1
0
        private void BtnSave_Click(object sender, System.EventArgs e)
        {
            if (FieldFName.Text == "")
            {
                MessageBox.Show("Please fill first name.", "Information",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CustomerService.CustomerInformation custInfo;
            if (selectedCust != null)
                custInfo = selectedCust;
            else
            {
                custInfo = new CustomerService.CustomerInformation();
                custInfo.CustID = 0;
            }
            custInfo.Telephone = FieldPhone.Text;
            custInfo.FirstName = FieldFName.Text;
            custInfo.MiddleName = FieldMName.Text;
            custInfo.LastName = FieldLName.Text;
            custInfo.Address = FieldAddress.Text;
            custInfo.Description = FieldMemo.Text;

            CustomerService.CustomerService service = new CustomerService.CustomerService();
            string result = service.SetCustomer(custInfo);
            if (result != null)
            {
                MessageBox.Show(result);
                return;
            }
            BtnCustSearch_Click(null, null);
        }