示例#1
0
 // Add new Customer Contact
 private void loadContactManagerAdd()
 {
     var contactManager = new ContactManager();
     contactManager.ShowDialog();
     if (contactManager.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         // Loads new contact in combo
         cmbContacts.Properties.Items.Add(contactManager.Tag);
         cmbContacts.SelectedItem = contactManager.Tag;
     }
 }
示例#2
0
 // Load Contact Manager
 private void loadContactManager()
 {
     var contactManager = new ContactManager();
     var customerContact = cmbContact.Tag as CustomerContactDto;
     // Validate if we have an customer selected
     if (customerContact != null && customerContact.Id > 0)
     {
         var customer = cmbCustomerName.Tag as CustomerDto;
         customerContact.Customer = customer;
         contactManager.Tag = customerContact;
         contactManager.ShowDialog();
         if (contactManager.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
             cmbContact.Properties.Items.Remove(customerContact);
             cmbContact.Properties.Items.Add(contactManager.Tag);
             cmbContact.SelectedItem = contactManager.Tag;
         }
     }
     else
     {
         var newCustomerContact = new CustomerContactDto();
         var customer = cmbCustomerName.Tag as CustomerDto;
         newCustomerContact.Customer = customer;
         contactManager.Tag = newCustomerContact;
         contactManager.ShowDialog();
         if (contactManager.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
             cmbContact.Properties.Items.Add(contactManager.Tag);
             cmbContact.SelectedItem = contactManager.Tag;
         }
     }
 }
示例#3
0
 // Edit Customer Contact
 private void loadContactManagerEdit(object contact)
 {
     var contactManager = new ContactManager();
     contactManager.Tag = contact;
     contactManager.ShowDialog();
     if (contactManager.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         cmbContacts.Properties.Items.Add(contactManager.Tag);
         cmbContacts.SelectedItem = contactManager.Tag;
     }
 }