コード例 #1
0
ファイル: CustomerForm.cs プロジェクト: padma-duvvuri/CSharp
 /// <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();
 }
コード例 #2
0
 /// <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();
 }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
ファイル: CustomerForm.cs プロジェクト: padma-duvvuri/CSharp
 /// <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;
 }
コード例 #5
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(CustomerContacts customerIn)
 {
     customers.Add(customerIn);
     names.Add(customerIn.FullName);
     return true;
 }
コード例 #6
0
        /// <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;
        }
コード例 #7
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(CustomerContacts customerIn)
 {
     customers.Add(customerIn);
     names.Add(customerIn.FullName);
     return(true);
 }
コード例 #8
0
 /// <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;
 }