/// <summary> /// Loads the sales process. /// </summary> /// <param name="opportunityId">The opportunity id.</param> private void LoadSalesProcess(string opportunityId) { ISalesProcesses salesProcess = Helpers.GetSalesProcess(opportunityId); _salesProcess = salesProcess; if (salesProcess != null) { IList <ISalesProcessAudit> list = salesProcess.GetSalesProcessAudits(); LoadStagesDropDown(list); SalesProcessGrid.DataSource = list; SalesProcessGrid.DataBind(); SetDDLSalesProcess(salesProcess.Name); txtNumOfStepsCompleted.Value = Convert.ToString(salesProcess.NumberOfStepsCompleted()); txtCurrentSalesProcessName.Value = salesProcess.Name; txtCurrentSalesProcessId.Value = salesProcess.Id.ToString(); } else { LoadStagesDropDown(null); List <ISalesProcessAudit> list = new List <ISalesProcessAudit>(); SalesProcessGrid.DataSource = list; SalesProcessGrid.DataBind(); IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>(); string defSalesProcess = userOption.GetCommonOption("cboSalesProcess", "OpportunityDefaults"); if (string.IsNullOrEmpty(defSalesProcess)) { defSalesProcess = "NONE"; } SetDDLSalesProcess(defSalesProcess); txtNumOfStepsCompleted.Value = "0"; txtCurrentSalesProcessName.Value = String.Empty; txtCurrentSalesProcessId.Value = String.Empty; } }
/// <summary> /// Loads the sales process. /// </summary> /// <param name="opportunityId">The opportunity id.</param> private void LoadSalesProcess(string opportunityId) { IOpportunity opp = EntityFactory.GetRepository <IOpportunity>().FindFirstByProperty("Id", opportunityId); if (opp != null) { txtOpportunity.Text = opp.Description; } ISalesProcesses salesProcess = Sage.SalesLogix.SalesProcess.Helpers.GetSalesProcess(opportunityId); _salesProcess = salesProcess; if (salesProcess != null) { txtSalesProcess.Text = salesProcess.Name; LoadSnapShot(salesProcess); IList <ISalesProcessAudit> list = salesProcess.GetSalesProcessAudits(); grdStages.DataSource = list; grdStages.DataBind(); } else { List <ISalesProcessAudit> list = new List <ISalesProcessAudit>(); grdStages.DataSource = list; grdStages.DataBind(); } }
private void UpdateSnapShot() { ISalesProcesses salesProcess = Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString()); this._salesProcess = salesProcess; if (salesProcess != null) { IList <ISalesProcessAudit> list = salesProcess.GetSalesProcessAudits(); foreach (ISalesProcessAudit spAudit in list) { if (spAudit.ProcessType == "STAGE") { if (spAudit.IsCurrent == true) { LoadSnapShot(spAudit); } } } } }
/// <summary> /// Handles the SelectedIndexChanged event of the ddLSalesProcess 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 ddLSalesProcess_SelectedIndexChanged(object sender, EventArgs e) { string opportunityId = this.EntityContext.EntityID.ToString(); string pluginID = ddLSalesProcess.SelectedItem.Value; ISalesProcesses salesProcess = EntityFactory.Create <ISalesProcesses>(); salesProcess.InitSalesProcess(pluginID, opportunityId); IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); this.UpdateSnapShot(); if (_salesProcess != null) { IList <ISalesProcessAudit> list = _salesProcess.GetSalesProcessAudits(); LoadStagesDropDown(list); } else { LoadStagesDropDown(null); } refresher.RefreshAll(); }
public static OpportunityRepresentation from(IOpportunity opp) { OpportunityRepresentation or = new OpportunityRepresentation(); or.ID = opp.Id.ToString(); or.Description = opp.Description; or.EstimatedClose = opp.EstimatedClose ?? DateTime.Now; or.Potential = opp.SalesPotential ?? 0; or.Probability = opp.CloseProbability ?? 0; or.Stage = opp.Stage; or.NextStep = opp.NextStep; or.DaysSinceLastActivity = opp.DaysSinceLastActivity; IActivity act = getNextActivity(opp.Id.ToString()); if (act != null) { or.NextActivityId = act.Id.ToString(); or.NextActivityName = String.Format("{0} <{1}>", (act.Description ?? ""), act.StartDate.ToShortDateString()); } ISalesProcesses sp = Sage.SalesLogix.SalesProcess.Helpers.GetSalesProcess(opp.Id.ToString()); if (sp != null) { IList <ISalesProcessAudit> list = sp.GetSalesProcessAudits(); foreach (ISalesProcessAudit spa in list) { if ((spa.ProcessType == "STAGE") && (spa.IsCurrent != null) && ((bool)spa.IsCurrent)) { or.DaysInStage = sp.DaysInStage(spa.StageId); //break; } if ((spa.ProcessType == "STEP") && (spa.IsCurrent != null) && ((bool)spa.IsCurrent)) { or.NextStep = spa.StepName; } } } return(or); }
/// <summary> /// Loads the sales process. /// </summary> /// <param name="opportunityId">The opportunity id.</param> private void LoadSalesProcess(string opportunityId) { IOpportunity opp = EntityFactory.GetById <IOpportunity>(opportunityId); if (opp != null) { txtOpportunity.Text = opp.Description; } ISalesProcesses salesProcess = Helpers.GetSalesProcess(opportunityId); _salesProcess = salesProcess; if (salesProcess != null) { txtSalesProcess.Text = salesProcess.Name; LoadSnapShot(salesProcess); IList <ISalesProcessAudit> list = salesProcess.GetSalesProcessAudits(); var filteredList = new List <ISalesProcessAudit>(); foreach (var spAudit in list) { if (!(spAudit.ProcessType == "HEADER" || spAudit.ProcessType == "FOOTER" || spAudit.ProcessType == "STEP")) { filteredList.Add(spAudit); } } grdStages.DataSource = filteredList; grdStages.DataBind(); } else { List <ISalesProcessAudit> list = new List <ISalesProcessAudit>(); grdStages.DataSource = list; grdStages.DataBind(); } }