/// <summary> /// constructor that takes 2 parameters. /// And adds id for the customer /// </summary> /// <param name="contact">the contact object</param> /// <param name="id">id for the customer</param> public Customer(Contact contact, string id) { m_contact = contact; m_id = id; }
/// <summary> /// constructor with one parameter which calls the constructor /// with two parameters passing default value for id /// </summary> /// <param name="contactIn"></param> public Customer(Contact contactIn) : this(contactIn, string.Empty) { }
/// <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(Contact contactIn, int index) { if(IsValidIndex(index)) { Customer customer = (Customer)customers[index]; customer.ContactData = contactIn; customers.RemoveAt(index); customers.Insert(index, customer); return true; } else return false; }