Пример #1
0
        /// <summary>
        /// Create variables and open the contact registry form. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ContactFiles.Address[] address = handle.getAddress();
            ContactFiles.Email[] email = handle.getEmail();
            ContactFiles.Person[] person = handle.getPerson();
            ContactFiles.Phone[] phone = handle.getPhone();
            ContactForm register = new ContactForm(handle, this, 0, "", "", "", "", "", "", "", "", "", 112); // input empty values to the contactform, set std. combox selection.

            register.Show();
        }
Пример #2
0
        /// <summary>
        /// This method calls when user click on the button btnEdit and user changes information of a cunstomer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int index = listBox.SelectedIndex;

            if (index != -1)
            {
                ContactForm frmContact = new ContactForm("Change Costumer");
                frmContact.ContactData = customerMng.GetCustomer(index).ContactData;
                if (frmContact.ShowDialog() == DialogResult.OK)
                {
                    customerMng.ChangeCustomer(frmContact.ContactData, index);
                    UpdateGui();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Edit contact
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event</param>
        private void btnChange_Click(object sender, EventArgs e)
        {
            var index = lstCustomerRegistry.SelectedIndex;

            if (_customerManager.CheckIndex(index))
            {
                var contactForm = new ContactForm(_customerManager.GetAt(index).Contact);

                var answer = contactForm.ShowDialog();
                if (answer == DialogResult.OK)
                {
                    _customerManager.ReplaceAt(index, contactForm.Contact);
                }
                UpdateGUI();
            }
        }
Пример #4
0
        /// <summary>
        /// This method calls when user click on button btnClick and user adds a new costumer info.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ContactForm frmContact = new ContactForm("Add New Costumer");
            int         index      = listBox.SelectedIndex;

            if (index != -1)
            {
                frmContact.ContactData = customerMng.GetCustomer(index).ContactData;
            }
            if (frmContact.ShowDialog() == DialogResult.OK)
            {
                customerMng.AddCustomer(frmContact.ContactData);
                frmContact.ContactData = new Contact();
                UpdateGui();
            }
        }
Пример #5
0
        /// <summary>
        /// Change a existing contact, fetch existing data from contact, based on the row selected in listview. printout the existing data to the contactform, so that the user can modify just the value she want to edit. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChange_Click(object sender, EventArgs e)
        {
            ContactFiles.Address[] address = handle.getAddress();
            ContactFiles.Email[] email = handle.getEmail();
            ContactFiles.Person[] person = handle.getPerson();
            ContactFiles.Phone[] phone = handle.getPhone();

            for(int x = 0; x < address.GetLength(0); x++)
            {
                if(index == address[x].getID())
                {
            ContactForm register = new ContactForm(handle,
                this,
                address[x].getID(),
                person[x].getFirstName(),
                person[x].getLastName(),
                person[x].getPID().ToString(),
                phone[x].getTelWork().ToString(),
                phone[x].getTelHome().ToString(),
                email[x].getEmailWork(),
                address[x].getStreet(),
                address[x].getZipCode(),
                address[x].getCity(),
                address[x].getCountryIndex());
            register.Show();
                }
            }
        }