/// <summary> /// Constructor with 2 paramerts with custom title and details of customer /// </summary> /// <param name="title"></param> /// <param name="details"></param> public CustomerForm(string title, string[] details) { InitializeComponent(); //Other initalizations this.Text = title; closeForm = true; m_customer = new CustomerContacts(details); UpdateGUI(); }
/// <summary> /// If the index is valid then it will allow the updation /// of the fields /// </summary> /// <param name="contactIn">details of selected customer</param> /// <param name="index">selected index</param> /// <returns>true if value is changed</returns> public bool ChangeCustomer(CustomerContacts contactIn, int index) { if (IsValidIndex(index)) { string str = customers[index].ToString(); string[] details = InputUtility.GetWords(contactIn.ToString()); //create a new customercontacts object with selected string values CustomerContacts customer = new CustomerContacts(details); customers.RemoveAt(index); names.RemoveAt(index); customers.Insert(index, customer); names.Insert(index, customer.FullName); return(true); } else { return(false); } }
/// <summary> /// Event-handler to handle click event of btnCustomer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCustomer_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 CustomerContacts(); } //set the values inputted by the user to m_customer object m_customer.Email = txtCustomerEmail.Text; m_customer.Phone = txtCustomerPhone.Text; m_customer.FirstName = txtCustomerFirstName.Text; m_customer.LastName = txtCustomerLastName.Text; UpdateGUI(); this.DialogResult = DialogResult.OK; }
/// <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(CustomerContacts customerIn) { customers.Add(customerIn); names.Add(customerIn.FullName); return true; }
/// <summary> /// If the index is valid then it will allow the updation /// of the fields /// </summary> /// <param name="contactIn">details of selected customer</param> /// <param name="index">selected index</param> /// <returns>true if value is changed</returns> public bool ChangeCustomer(CustomerContacts contactIn, int index) { if (IsValidIndex(index)) { string str = customers[index].ToString(); string[] details = InputUtility.GetWords(contactIn.ToString()); //create a new customercontacts object with selected string values CustomerContacts customer = new CustomerContacts(details); customers.RemoveAt(index); names.RemoveAt(index); customers.Insert(index, customer); names.Insert(index, customer.FullName); return true; } else return false; }
/// <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(CustomerContacts customerIn) { customers.Add(customerIn); names.Add(customerIn.FullName); return(true); }
/// <summary> /// Event-handler to handle click event of btnCustomer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCustomer_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 CustomerContacts(); } //set the values inputted by the user to m_customer object m_customer.Email = txtCustomerEmail.Text; m_customer.Phone = txtCustomerPhone.Text ; m_customer.FirstName = txtCustomerFirstName.Text; m_customer.LastName = txtCustomerLastName.Text; UpdateGUI(); this.DialogResult = DialogResult.OK; }