private void btnTransfer_Click(object sender, EventArgs e) { 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 = ""; string subject = ""; string htmlBody = ""; using (var mItem = ClassFactory.Instance.Outlook.GetCurrentInspectorItem()) { if (mItem != null) { var senderEmailAddress = mItem.SenderEmailAddress; if (!string.IsNullOrEmpty(senderEmailAddress)) { fromName = senderEmailAddress; } subject = mItem.Subject; htmlBody = mItem.HTMLBody; } } /* * 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; * }*/ OppService.OppNoteAPIService local = new OppService.OppNoteAPIService(); local.Url = PPOLUrl + "/cxf/OppNoteAPI"; string rtn = local.transferEmailToOpp(ppolAccount, userName, password, 0, subject, htmlBody, this.rchTxtComment.Text, psn.id, senderName, fromName, this.chkAttachNote.Checked); // mItem.Attachments.g; if (rtn == "SUCCESS") { MessageBox.Show(String.Format("Transfered email to an opportunity")); } else { MessageBox.Show(String.Format(rtn)); } this.Close(); } catch (Exception ex) { ClassFactory.Instance.ConnectionProblem(ex); } }
public ServicesUtil() { settings = new Properties.Settings(); settings.Reload(); PPOLUrl = settings.PPOLURL; ppolAccount = settings.Account; userName = settings.UserName; password = settings.Password; }
private void btnAttach_Click(object sender, EventArgs e) { try { if (this.grdOpp.SelectedRows.Count > 0 && this.grdOpp.SelectedRows[0].Index != this.grdOpp.Rows.Count - 1) { int rowSelected = this.grdOpp.SelectedRows[0].Index; DataGridViewRow gridViewRow = this.grdOpp.Rows[rowSelected]; DataGridViewCell gridViewCell = gridViewRow.Cells[0]; String cellValue = (string)gridViewCell.Value; string subject = ""; string htmlBody = ""; using (var mItem = ClassFactory.Instance.Outlook.GetCurrentInspectorItem()) { subject = mItem.Subject; htmlBody = mItem.HTMLBody; } //Microsoft.Office.Interop.Outlook.MailItem mItem = // (Microsoft.Office.Interop.Outlook.MailItem)Globals.ThisAddIn.Application.ActiveInspector().CurrentItem; Properties.Settings settings = new Properties.Settings(); settings.Reload(); String PPOLUrl = settings.PPOLURL; String ppolAccount = settings.Account; String userName = settings.UserName; String password = settings.Password; OppService.OppNoteAPIService oppService = new OppService.OppNoteAPIService(); oppService.Url = PPOLUrl + "/cxf/OppNoteAPI"; string str = oppService.attachNoteToOpportunity(ppolAccount, userName, password, Convert.ToInt32(cellValue), subject, htmlBody); if (str == "SUCCESS") { MessageBox.Show(String.Format("Attached email as note to the opportunity: " + cellValue + "-" + (string)gridViewRow.Cells[1].Value)); } else { MessageBox.Show(String.Format(str)); } this.Close(); } else { MessageBox.Show("Select an opportunity to attach"); } } catch (Exception ex) { ClassFactory.Instance.ConnectionProblem(ex); } }
public AttachWorkerBase() { Properties.Settings settings = new Properties.Settings(); settings.Reload(); PPOLUrl = settings.PPOLURL; ppolAccount = settings.Account; userName = settings.UserName; password = settings.Password; bccAddressList = ""; toAddress = ""; ccEmails = ""; fromName = ""; /* * var binding = new System.ServiceModel.WSHttpBinding(); * var uri = new Uri(PPOLUrl + "/cxf/PsnNoteAPI"); * binding.Security.Mode = string.Equals(uri.Scheme, "https", StringComparison.OrdinalIgnoreCase) * ? System.ServiceModel.SecurityMode.Transport * : System.ServiceModel.SecurityMode.None; * apiClient = new PPOL.PPOLService.PsnNoteAPIClient(binding,new System.ServiceModel.EndpointAddress(uri));*/ apiClient = new Legacy.PPOLService2.PsnNoteAPIService(); apiClient.Url = PPOLUrl + "/cxf/PsnNoteAPI"; }
private void btnSearch_Click(object sender, EventArgs e) { // searchOpportunities(String companyName, String loginUN, String loginPW,String searchStr) 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; var local = new OppService.OppNoteAPIService(); local.Url = PPOLUrl + "/cxf/OppNoteAPI"; OppService.opportunityList oppList = local.searchOpportunities(ppolAccount, userName, password, this.txtOppName.Text); if (oppList.list == null) { if (oppList.errorMsg.Trim() != "") { MessageBox.Show(oppList.errorMsg); } else { if (this.txtOppName.Text.Trim() == "") { MessageBox.Show("Opportunities are not found in your PlanPlus Online account."); } else { MessageBox.Show("Opportunity name(s) containing '" + this.txtOppName.Text + "' are not found in your PlanPlus Online account."); } } } else { OppService.opportunity[] opp = oppList.list; this.grdOpp.Rows.Clear(); for (int i = 0; i < opp.Length; i++) { OppService.opportunity opportunity = opp[i]; string name = opportunity.oppName; string[] gridRow = new string[6]; gridRow[0] = opportunity.oppId.ToString(); gridRow[1] = opportunity.oppName; gridRow[2] = opportunity.oppDesc; gridRow[3] = opportunity.oppStatus; gridRow[4] = opportunity.oppStage; gridRow[5] = opportunity.oppAmount.ToString(); // gridRow[6] = this.grdOpp.Rows.Add(gridRow); // this.grdOpp.Rows[i].Cells[6].Value = true; } } } catch (Exception ex) { ClassFactory.Instance.ConnectionProblem(ex); } }
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); } }