/// <summary> /// Handles the OnClick event of the cmdCompleteDate control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void cmdCompleteDate_OnClick(object sender, EventArgs e) { string contextValue = completeDateContext.Value; string[] args = contextValue.Split(new Char[] { ':' }); string spaid = args[0]; DateTime completeDate = ResolveDateTime(args[1]); ISalesProcesses salesProcess = Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString()); string result = salesProcess.CanCompleteStep(spaid); if (result == string.Empty) { salesProcess.CompleteStep(spaid, completeDate); salesProcess.Save(); } else { if (DialogService != null) { DialogService.ShowMessage(result); } return; } IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); refresher.RefreshAll(); }
/// <summary> /// Handles the OnClick event of the cmdCompleteStep control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void cmdCompleteStep_OnClick(object sender, EventArgs e) { string stepContextValue = stepContext.Value; string[] args = stepContextValue.Split(new Char[] { ':' }); string spaid = args[0]; ISalesProcesses salesProcess = Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString()); if (args[1] == "False") { string result = salesProcess.CanCompleteStep(spaid); if (result == string.Empty) { salesProcess.CompleteStep(spaid, DateTime.Now); salesProcess.Save(); } else { if (DialogService != null) { DialogService.ShowMessage(result); } return; } } else { salesProcess.UnCompleteStep(spaid); salesProcess.Save(); } if (ddlStages.SelectedItem != null) { if (ddlStages.SelectedItem.Value != salesProcess.CurrentStageId) { ddlStages.SelectedIndex = ddlStages.Items.IndexOf(ddlStages.Items.FindByValue(salesProcess.CurrentStageId)); } } IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); refresher.RefreshAll(); this.UpdateSnapShot(); }
/// <summary> /// Does the action. /// </summary> /// <param name="spaId">The spa id.</param> private void DoAction(string spaId) { string result = string.Empty; ISalesProcessAudit spAudit = Helpers.GetSalesProcessAudit(spaId); this._opportunity = GetOpportunity(spAudit.EntityId); this._salesProcess = Helpers.GetSalesProcess(spAudit.EntityId); if (spAudit == null) { return; } try { result = _salesProcess.CanCompleteStep(spaId); if (result == string.Empty) { string actionType = spAudit.ActionType; switch (actionType.ToUpper()) { case "NONE": break; case "MAILMERGE": result = DoMailMerge(spAudit); break; case "SCRIPT": result = DoWebAction(spAudit); break; case "FORM": result = DoWebForm(spAudit); break; case "PHONECALL": result = DoActivity(spAudit); break; case "TODO": result = DoActivity(spAudit); break; case "MEETING": result = DoActivity(spAudit); break; case "LITREQUEST": result = DoLitRequest(spAudit); break; case "CONTACTPROCESS": result = DoContactProcess(spAudit); break; case "ACTIVITYNOTEPAD": result = GetLocalResourceObject("ActvityNotePadNotSupported").ToString(); //"Activity Note Pad not in availble in Web."; break; default: break; } } } catch (Exception ex) { if (ErrorHelper.CanShowExceptionMessage(ex)) { result = ex.Message; } else { log.Error( string.Format("The call to SmartParts_OpportunitySalesProcess_SalesProcess.DoAction('{0}') failed", spAudit), ex); result = Resources.SalesLogix.WereSorryMsg; } } if (DialogService != null) { if (!string.IsNullOrEmpty(result)) { // MSG_ProcessActionResult: For step |B|{0}|/B| : + NewLine + {1} string msg = HttpUtility.HtmlEncode(string.Format(GetLocalResourceObject("MSG_ProcessActionResult").ToString(), spAudit.StepName, result)).Replace("|B|", "<b>").Replace( "|/B|", "</b>").Replace(Environment.NewLine, "<br />"); DialogService.ShowHtmlMessage(msg); } } }
/// <summary> /// Does the action. /// </summary> /// <param name="spaId">The spa id.</param> private void DoAction(string spaId) { string result = string.Empty; ISalesProcessAudit spAudit = Helpers.GetSalesProcessAudit(spaId); this._opportunity = GetOpportunity(spAudit.EntityId); this._salesProcess = Helpers.GetSalesProcess(spAudit.EntityId); if (spAudit == null) { return; } try { result = _salesProcess.CanCompleteStep(spaId); if (result == string.Empty) { string actionType = spAudit.ActionType; switch (actionType.ToUpper()) { case "NONE": break; case "MAILMERGE": result = DoMailMerge(spAudit); break; case "SCRIPT": result = DoWebAction(spAudit); break; case "FORM": result = DoWebForm(spAudit); break; case "PHONECALL": result = DoActivity(spAudit); break; case "TODO": result = DoActivity(spAudit); break; case "MEETING": result = DoActivity(spAudit); break; case "LITREQUEST": result = DoLitRequest(spAudit); break; case "CONTACTPROCESS": result = DoContactProcess(spAudit); break; case "ACTIVITYNOTEPAD": result = GetLocalResourceObject("ActvityNotePadNotSupported").ToString(); //"Activity Note Pad not in availble in Web."; break; default: break; } } } catch (Exception ex) { result = ex.Message; } if (DialogService != null) { if (!string.IsNullOrEmpty(result)) { string msg = string.Format(GetLocalResourceObject("MSG_ProcessActionResult").ToString(), spAudit.StepName, result); DialogService.ShowMessage(msg); } } }
/// <summary> /// Does the action. /// </summary> /// <param name="spaId">The spa id.</param> private void DoAction(string spaId) { string result = string.Empty; ISalesProcessAudit spAudit = Helpers.GetSalesProcessAudit(spaId); this._opportunity = GetOpportunity(spAudit.EntityId); this._salesProcess = Helpers.GetSalesProcess(spAudit.EntityId); if (spAudit == null) return; try { result = _salesProcess.CanCompleteStep(spaId); if (result == string.Empty) { string actionType = spAudit.ActionType; switch (actionType.ToUpper()) { case "NONE": break; case "MAILMERGE": result = DoMailMerge(spAudit); break; case "SCRIPT": result = DoWebAction(spAudit); break; case "FORM": result = DoWebForm(spAudit); break; case "PHONECALL": result = DoActivity(spAudit); break; case "TODO": result = DoActivity(spAudit); break; case "MEETING": result = DoActivity(spAudit); break; case "LITREQUEST": result = DoLitRequest(spAudit); break; case "CONTACTPROCESS": result = DoContactProcess(spAudit); break; case "ACTIVITYNOTEPAD": result = GetLocalResourceObject("ActvityNotePadNotSupported").ToString(); //"Activity Note Pad not in availble in Web."; break; default: break; } } } catch (Exception ex) { if (ErrorHelper.CanShowExceptionMessage(ex)) { result = ex.Message; } else { log.Error( string.Format("The call to SmartParts_OpportunitySalesProcess_SalesProcess.DoAction('{0}') failed", spAudit), ex); result = Resources.SalesLogix.WereSorryMsg; } } if (DialogService != null) { if (!string.IsNullOrEmpty(result)) { // MSG_ProcessActionResult: For step |B|{0}|/B| : + NewLine + {1} string msg = HttpUtility.HtmlEncode(string.Format(GetLocalResourceObject("MSG_ProcessActionResult").ToString(), spAudit.StepName, result)).Replace("|B|", "<b>").Replace( "|/B|", "</b>").Replace(Environment.NewLine, "<br />"); DialogService.ShowHtmlMessage(msg); } } }
/// <summary> /// Does the action. /// </summary> /// <param name="spaId">The spa id.</param> private void DoAction(string spaId) { string result = string.Empty; ISalesProcessAudit spAudit = Helpers.GetSalesProcessAudit(spaId); this._opportunity = GetOpportunity(spAudit.EntityId); this._salesProcess = Helpers.GetSalesProcess(spAudit.EntityId); if (spAudit == null) return; try { result = _salesProcess.CanCompleteStep(spaId); if (result == string.Empty) { string actionType = spAudit.ActionType; switch (actionType.ToUpper()) { case "NONE": break; case "MAILMERGE": result = DoMailMerge(spAudit); break; case "SCRIPT": result = DoWebAction(spAudit); break; case "FORM": result = DoWebForm(spAudit); break; case "PHONECALL": result = DoActivity(spAudit); break; case "TODO": result = DoActivity(spAudit); break; case "MEETING": result = DoActivity(spAudit); break; case "LITREQUEST": result = DoLitRequest(spAudit); break; case "CONTACTPROCESS": result = DoContactProcess(spAudit); break; case "ACTIVITYNOTEPAD": result = GetLocalResourceObject("ActvityNotePadNotSupported").ToString(); //"Activity Note Pad not in availble in Web."; break; default: break; } } } catch (Exception ex) { result = ex.Message; } if (DialogService != null) { if (!string.IsNullOrEmpty(result)) { string msg = string.Format(GetLocalResourceObject("MSG_ProcessActionResult").ToString(), spAudit.StepName, result); DialogService.ShowMessage(msg); } } }