private void btnShowEmployerContact_Click(object sender, EventArgs e) { //Guard against passing a NULL object if (myJobLead.EmployerContact != null) { //Use the Employer Contact frmContact newContactForm = new frmContact(myJobLead.EmployerContact); newContactForm.ShowDialog(); } }
private void btnNewContact_Click(object sender, EventArgs e) { frmContact newContactForm = new frmContact(myBroker.Address); newContactForm.ShowDialog(); if (newContactForm.myContact.ContactID != 0) { myBroker.Contacts.Add((Contact)newContactForm.myContact); FillContactList(); } }
private void btnEditContact_Click(object sender, EventArgs e) { //Get the selected Contact from the listbox int thisContactID; if ((lstBoxBrokerContacts.SelectedValue != null) && (int.TryParse(lstBoxBrokerContacts.SelectedValue.ToString(), out thisContactID))) { var newContact = myBroker.Contacts.Where(s => s.ContactID == thisContactID).FirstOrDefault <Contact>(); frmContact newContactForm = new frmContact(newContact); newContactForm.ShowDialog(); FillContactList(); } }
private void dataGridAgencyContacts_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { //A row has been double clicked. We need to get the BrokerID value, extract the Broker instance //and then pass this to the form to display the Broker. int contactIDSelected = Convert.ToInt32(dataGridAgencyContacts.SelectedRows[0].Cells["ContactID"].Value.ToString()); //PUT THIS IN A Using BLOCK? JobLeadRepo thisJobLeadRepo = new JobLeadRepo(); iContact contactSelected = thisJobLeadRepo.GetContact(contactIDSelected); frmContact newContactForm = new frmContact(contactSelected); newContactForm.ShowDialog(); //Now reinitialise the Contacts Grid ReloadAgencyContactGrid(); }