/// <summary>
    /// Handles the SelectedIndexChanged event of the ddlStages 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 ddlStages_SelectedIndexChanged(object sender, EventArgs e)
    {
        object manageStagesDialog = Page.Session["MANAGESTAGESACTIVE"];

        if (manageStagesDialog != null)
        {
            return;
        }

        string          stageId      = ddlStages.SelectedItem.Value;
        ISalesProcesses salesProcess = Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString());
        string          result       = salesProcess.CanMoveToStage(stageId);

        if (result == string.Empty)
        {
            salesProcess.SetToCurrentStage(stageId);
            salesProcess.Save();
        }
        else
        {
            if (DialogService != null)
            {
                DialogService.ShowMessage(result);
            }
        }
        IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshAll();
    }
Exemplo n.º 2
0
    /// <summary>
    /// Handles the OnClick event of the cmdSetCurrent 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 cmdSetCurrent_OnClick(object sender, EventArgs e)
    {
        string currentContextValue = Request.Form[ResolveClientId(currentContext.ClientID)];

        string[]        args         = currentContextValue.Split(new Char[] { ':' });
        string          spaid        = args[0];
        ISalesProcesses salesProcess = Sage.SalesLogix.SalesProcess.Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString());

        if (args[1] == "False")
        {
            string result = salesProcess.CanMoveToStage(spaid);
            if (result == string.Empty)
            {
                salesProcess.SetToCurrentStage(spaid);
                salesProcess.Save();
            }
            else
            {
                if (DialogService != null)
                {
                    DialogService.ShowMessage(result);
                }
                return;
            }
        }
    }
    /// <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>
    /// Handles the OnClick event of the cmdCompleteStage 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 cmdCompleteStage_OnClick(object sender, EventArgs e)
    {
        string[]        args         = stageContext.Value.Split(':');
        string          spaid        = args[0];
        ISalesProcesses salesProcess = Helpers.GetSalesProcess(EntityContext.EntityID.ToString());

        if (args[1] == "False")
        {
            string result = salesProcess.CanCompleteStage(spaid);
            if (result == string.Empty)
            {
                salesProcess.CompleteStage(spaid, DateTime.Now);
                salesProcess.Save();
            }
            else
            {
                if (DialogService != null)
                {
                    DialogService.ShowMessage(result);
                }
            }
        }
        else
        {
            salesProcess.UnCompleteStage(spaid);
            salesProcess.Save();
        }
    }
    /// <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();
    }
Exemplo n.º 6
0
    /// <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();
        }
    }
    /// <summary>
    /// Handles the OnClick event of the cmdStartDate 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 cmdStartDate_OnClick(object sender, EventArgs e)
    {
        string[]        args         = startDateContext.Value.Split(':');
        string          spaid        = args[0];
        DateTime        startDate    = ResolveDateTime(args[1]);
        ISalesProcesses salesProcess = Helpers.GetSalesProcess(EntityContext.EntityID.ToString());

        salesProcess.StartStage(spaid, startDate);
        salesProcess.Save();
    }
    /// <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>();

        refresher.RefreshAll();
    }
Exemplo n.º 9
0
    /// <summary>
    /// Handles the OnClick event of the cmdStartDate 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 cmdStartDate_OnClick(object sender, EventArgs e)
    {
        string contextValue = Request.Form[ResolveClientId(startDateContext.ClientID)];

        string[]        args         = contextValue.Split(new Char[] { ':' });
        string          spaid        = args[0];
        DateTime        startDate    = ResolveDateTime(args[1]);
        ISalesProcesses salesProcess = Sage.SalesLogix.SalesProcess.Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString());

        salesProcess.StartStage(spaid, startDate);
        salesProcess.Save();
    }
Exemplo n.º 10
0
 /// <summary>
 /// Loads the snap shot.
 /// </summary>
 /// <param name="salesProcess">The sales process.</param>
 private void LoadSnapShot(ISalesProcesses salesProcess)
 {
     foreach (ISalesProcessAudit spAudit in salesProcess.SalesProcessAudits)
     {
         if (spAudit.ProcessType == "STAGE")
         {
             if (spAudit.IsCurrent == true)
             {
                 SetSnapShot(spAudit);
             }
         }
     }
 }
    /// <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();
    }
    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();
    }
    /// <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[]        args         = completeDateContext.Value.Split(new Char[] { ':' });
        string          spaid        = args[0];
        DateTime        completeDate = ResolveDateTime(args[1]);
        ISalesProcesses salesProcess = Sage.SalesLogix.SalesProcess.Helpers.GetSalesProcess(EntityContext.EntityID.ToString());
        string          result       = salesProcess.CanCompleteStage(spaid);

        if (result == string.Empty)
        {
            salesProcess.CompleteStage(spaid, completeDate);
            salesProcess.Save();
        }
        else
        {
            if (DialogService != null)
            {
                DialogService.ShowMessage(result);
            }
        }
    }
Exemplo n.º 15
0
        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} &lt;{1}&gt;", (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>
    /// Handles the OnClick event of the cmdSetCurrent 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 cmdSetCurrent_OnClick(object sender, EventArgs e)
    {
        string[]        args         = currentContext.Value.Split(':');
        string          spaid        = args[0];
        ISalesProcesses salesProcess = Helpers.GetSalesProcess(EntityContext.EntityID.ToString());

        if (args[1] == "False")
        {
            string result = salesProcess.CanMoveToStage(spaid);
            if (result == string.Empty)
            {
                salesProcess.SetToCurrentStage(spaid);
                salesProcess.Save();
            }
            else
            {
                if (DialogService != null)
                {
                    DialogService.ShowMessage(result);
                }
            }
        }
    }
    /// <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();
        }
    }
    /// <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);
            }
        }
    }
Exemplo n.º 19
0
    /// <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();
        }
    }
    /// <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);
            }
        }
    }
Exemplo n.º 21
0
 /// <summary>
 /// Loads the snap shot.
 /// </summary>
 /// <param name="salesProcess">The sales process.</param>
 private void LoadSnapShot(ISalesProcesses salesProcess)
 {
     foreach (ISalesProcessAudit spAudit in salesProcess.SalesProcessAudits)
     {
         if (spAudit.ProcessType == "STAGE")
         {
             if (spAudit.IsCurrent == true)
             {
                 SetSnapShot(spAudit);
             }
         }
     }
 }
 private void UpdateSnapShot()
 {
     ISalesProcesses salesProcess = Helpers.GetSalesProcess(this.EntityContext.EntityID.ToString());
     this._salesProcess = salesProcess;
     IList<ISalesProcessAudit> list = salesProcess.GetSalesProcessAudits();
     foreach (ISalesProcessAudit spAudit in list)
     {
         if (spAudit.ProcessType == "STAGE")
         {
             if (spAudit.IsCurrent == true)
             {
                 LoadSnapShot(spAudit);
             }
         }
     }
 }
    /// <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>
 /// 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;
     }
 }
Exemplo n.º 25
0
    /// <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);
            }
        }
    }