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"; local.Url = serviceUtil.getPpolURL() + "/cxf/OppNoteAPI"; string rtn = local.transferEmailToOpp(serviceUtil.getPpolAccount(), serviceUtil.getUserName(), serviceUtil.getPassword(), 0, subject, htmlBody, this.rchTxtComment.Text, psn.id, senderName, fromName, this.chkAttachNote.Checked); 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); } }
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); } }
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); } }