private void ContactListBox_SelectedIndexChanged(object sender, EventArgs e) { EntityCouplet selectedItem = (EntityCouplet)ContactListBox.SelectedItem; selectedContact = XLMain.Contact.FetchContact(selectedItem.crmID); this.Close(); }
private void ContactAddressBtn_Click(object sender, RibbonControlEventArgs e) { try { ContForm myForm = new ContForm(); myForm.ShowDialog(); XLMain.Contact contact = myForm.selectedContact; string str = ""; if (contact.addresses[0].addressBlock != null) { if (contact.salutations.Count > 0) { str += contact.salutations[0].addressee + Environment.NewLine; } str += contact.addresses[0].addressBlock; XLDocument.InsertText(str); //insert the status text box; //XLDocument.AddStatusBox(); //XLDocument.ChangeStatus("Draft"); } else { MessageBox.Show(contact.firstname + " " + contact.lastname + " does not have an address in the system."); } } catch (Exception ex) { MessageBox.Show("Unable to get contact address"); XLtools.LogException("ContactAddressBtn", ex.ToString()); } }
private void GetAddressBtn_Click(object sender, EventArgs e) { try { ContForm myForm = new ContForm(); myForm.ShowDialog(); XLMain.Contact selectContact = myForm.selectedContact; if (selectContact != null) { if (docType == "Letter") { if (selectContact.addresses != null) { allAddresses = selectContact.addresses; addressesDDL.DataSource = allAddresses; addressesDDL.DisplayMember = "address1"; addressesDDL.ValueMember = "addressBlock"; add = (XLMain.Address)addressesDDL.SelectedItem; if (add != null) { addTB.Text = add.addressBlock; } } } else if (docType == "Fax") { XLMain.Number fax = XLMain.Number.GetNumber(client.crmID, "Fax"); if (fax != null) { FaxTB.Text = fax.number; } } //Deal with salutations if (selectContact.salutations != null) { SalDDL.DataSource = selectContact.salutations; SalDDL.DisplayMember = "Salutation"; SalDDL.ValueMember = "Addressee"; sal = (XLMain.Salutation)SalDDL.SelectedItem; if (sal != null) { AddresseeTB.Text = sal.addressee; SalutationTb.Text = sal.salutation; SalutationTb_Leave(this, null); } } else { SalDDL.DataSource = null; SalDDL.DisplayMember = "Salutation"; SalDDL.ValueMember = "Addressee"; AddresseeTB.Text = ""; SalutationTb.Text = ""; } RevertBtn.Visible = true; XLDocument.UpdateBookmark("Salutation", SalutationTb.Text); XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text); XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text); XLDocument.UpdateBookmark("Address", addTB.Text); XLDocument.UpdateBookmark("Fax", FaxTB.Text); } else { MessageBox.Show("No address returned"); } } catch (Exception ex) { MessageBox.Show("Unable to fetch contact"); XLtools.LogException("TaskPane-ContactBtn", ex.ToString()); } }