private void getContact() { try { string fromName = ""; using (var mItem = ClassFactory.Instance.Outlook.GetCurrentInspectorItem()) { if (mItem != null) { var senderEmailAddress = mItem.SenderEmailAddress; if (!string.IsNullOrEmpty(senderEmailAddress)) { fromName = senderEmailAddress; this.txtNewOpp.Text = mItem.Subject; senderName = mItem.SenderName; } } } var local = new Legacy.PPOLService.PsnNoteAPIService(); local.Url = serviceUtil.getPpolURL() + "/cxf/PsnNoteAPI"; psn = local.findContactByEmail(serviceUtil.getPpolAccount(), serviceUtil.getUserName(), serviceUtil.getPassword(), fromName); if (psn != null) { if (psn.errorMessage == "SUCCESS") { this.txtContactName.Text = psn.displayName; } else { if (psn.errorMessage.Trim().Contains("Account")) { MessageBox.Show(psn.errorMessage); this.Close(); } else { this.lblContactMsg.Text = "Contact was not found in PlanPlus Online. You can search and associate a contact, Otherwise system will create new contact."; } } } } catch (Exception ex) { ClassFactory.Instance.ConnectionProblem(ex); } }
private void btnSearchContact_Click(object sender, EventArgs e) { ContactSearch contactSearch = new ContactSearch(); contactSearch.ShowDialog(this); if (contactSearch.contactIdFromSearch != 0) { psn = new Legacy.PPOLService.ppolContact(); psn.id = contactSearch.contactIdFromSearch; this.txtContactName.Text = contactSearch.contactNameFromSearch; } }
private void getContact() { try { Properties.Settings settings = new Properties.Settings(); settings.Reload(); String PPOLUrl = settings.PPOLURL; String ppolAccount = settings.Account; String userName = settings.UserName; String password = settings.Password; string fromName = ""; //MessageBox.Show("Inside the method"); using (var mItem = ClassFactory.Instance.Outlook.GetCurrentInspectorItem()) { if (mItem != null) { var senderEmailAddress = mItem.SenderEmailAddress; if (!string.IsNullOrEmpty(senderEmailAddress)) { fromName = senderEmailAddress; this.txtNewOpp.Text = mItem.Subject; senderName = mItem.SenderName; } } } /* * Microsoft.Office.Interop.Outlook.MailItem mItem = * (Microsoft.Office.Interop.Outlook.MailItem)Globals.ThisAddIn.Application.ActiveInspector().CurrentItem; * if (mItem.SenderEmailAddress != null && !mItem.SenderEmailAddress.Equals("")) * { * fromName = mItem.SenderEmailAddress; * this.txtNewOpp.Text = mItem.Subject; * senderName = mItem.SenderName; * }*/ var local = new Legacy.PPOLService.PsnNoteAPIService(); local.Url = PPOLUrl + "/cxf/PsnNoteAPI"; psn = local.findContactByEmail(ppolAccount, userName, password, fromName); MessageBox.Show("Called first API"); if (psn != null) { if (psn.errorMessage == "SUCCESS") { this.txtContactName.Text = psn.displayName; } else { if (psn.errorMessage.Trim().Contains("Account")) { MessageBox.Show(psn.errorMessage); this.Close(); } else { this.lblContactMsg.Text = "Contact was not found in PlanPlus Online. You can search and associate a contact, Otherwise system will create new contact."; } } } } catch (Exception ex) { ClassFactory.Instance.ConnectionProblem(ex); } }