예제 #1
0
 /// <summary>
 /// Event handler for click event of the OK button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnOK_Click(object sender, EventArgs e)
 {
     //validate the user given values for Name fields and phone number
     if (!ValidateInputFields())
     {
         return;
     }
     //if no customer is present then create a new customer
     if (m_customer == null)
     {
         m_customer = new Customer();
     }
     // passing the values given by the user to the fields
     //get selected coutry
     Countries selectedCountry = (Countries)Enum.Parse(typeof(Countries), (string)this.cmbCountry.SelectedItem);
     m_customer.ContactData.AddressData = new Address(txtStreet.Text, txtZip.Text, txtCity.Text, selectedCountry);
     m_customer.ContactData.EmailData = new Email(txtProfessionalEmail.Text, txtPersonalEmail.Text);
     m_customer.ContactData.PhoneData = new Phone(txtHomePhone.Text, txtCellPhone.Text);
     m_customer.ContactData.FirstName = txtFirstName.Text;
     m_customer.ContactData.LastName = txtLastName.Text;
     //return the dialog result value as OK so as to perform next calculations
     this.DialogResult = DialogResult.OK;
 }
예제 #2
0
 /// <summary>
 /// constructor that takes 1 parameter.
 /// It calls the constructor with 2 parameters
 /// </summary>
 /// <param name="customerIn">Input - customer object</param>
 public Customer(Customer customerIn)
     : this(customerIn.ContactData, customerIn.ID)
 {
 }
예제 #3
0
 /// <summary>
 /// It stores the new customer details entered by the user, and returns
 /// true if added.
 /// </summary>
 /// <param name="customerIn">Input - customer details</param>
 /// <returns>True when the new customer is added</returns>
 public bool AddCustomer(Customer customerIn)
 {
     customerIn.ID = GetNewID.ToString();
     customers.Add(customerIn);
         return true;
 }