/// <summary>
    /// Does the mail merge.
    /// </summary>
    /// <param name="spAudit">The sp audit.</param>
    /// <returns></returns>
    private string DoMailMerge(ISalesProcessAudit spAudit)
    {
        string result = string.Empty;

        result = GetLocalResourceObject("MSG_MailMergeCompleted").ToString();
        return(result);
    }
Пример #2
0
    private string ScheduleActivity(string scheduleContext)
    {
        string activityId = string.Empty;

        try
        {
            string[]           args          = scheduleContext.Split(new Char[] { ',' });
            string             spaId         = args[0];
            string             contactId     = args[1];
            string             opportunityId = args[2];
            string             leaderId      = args[3];
            ISalesProcessAudit spAudit       = EntityFactory.GetById <ISalesProcessAudit>(spaId);
            if (spAudit != null)
            {
                IContact     contact  = EntityFactory.GetById <IContact>(contactId);
                IOpportunity opp      = EntityFactory.GetById <IOpportunity>(opportunityId);
                IUser        leader   = EntityFactory.GetById <IUser>(leaderId);
                Activity     activity = (Activity)spAudit.SalesProcess.ScheduleActivity(spaId, opp, leader, contact, true);
                activityId = (string)activity.Id;
            }
        }
        catch
        {
            activityId = string.Empty;
        }
        return(activityId);
    }
    /// <summary>
    /// Does the lit request.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoLitRequest(ISalesProcessAudit step)
    {
        string result   = string.Empty;
        string authorId = selectedUserId.Value;
        IUser  author   = GetUser(authorId);

        if (author == null)
        {
            throw new Exception(GetLocalResourceObject("Error_AuthorNotFound").ToString());
        }

        string   contactId = selectedContactId.Value;
        IContact contact   = GetContact(contactId);

        if (contact == null)
        {
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        }

        string reqId = this._salesProcess.ScheduleLitRequest(step.Id.ToString(), this._opportunity, author, contact);

        if (reqId != string.Empty)
        {
            string url = string.Format("~/LitRequest.aspx?entityid={0}", reqId);
            Response.Redirect(url);
        }
        else
        {
            result = GetLocalResourceObject("Error_LitRequestNotScheduled").ToString();
        }

        return(result);
    }
Пример #4
0
    /// <summary>
    /// Handles the RowDataBound event of the grdStages control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
    protected void grdStages_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ISalesProcessAudit spAudit = (ISalesProcessAudit)e.Row.DataItem;
            if ((spAudit.ProcessType == "HEADER") || (spAudit.ProcessType == "FOOTER") || (spAudit.ProcessType == "STEP"))
            {
                e.Row.Cells.Clear();
                return;
            }
            if (spAudit.ProcessType == "STAGE")
            {
                CheckBox chkStageComplete = ((CheckBox)e.Row.FindControl("chkStageComplete"));
                if (chkStageComplete != null)
                {
                    chkStageComplete.Attributes.Add("onClick", string.Format("return onCompleteStage('{0}','{1}','{2}');", cmdCompleteStage.ClientID, stageContext.ClientID, spAudit.Id.ToString() + ":" + spAudit.Completed));
                    chkStageComplete.Checked = (spAudit.Completed == true);
                }

                CheckBox chkStageCurrnet = ((CheckBox)e.Row.FindControl("chkStageCurrent"));
                if (chkStageCurrnet != null)
                {
                    chkStageCurrnet.Attributes.Add("onClick", string.Format("return onSetCurrent('{0}','{1}','{2}');", cmdSetCurrent.ClientID, currentContext.ClientID, spAudit.Id.ToString() + ":" + spAudit.IsCurrent));
                    chkStageCurrnet.Checked = (spAudit.IsCurrent == true);
                    chkStageCurrnet.Enabled = (spAudit.IsCurrent != true);
                }


                Sage.SalesLogix.Web.Controls.DateTimePicker dtpStartDate = (Sage.SalesLogix.Web.Controls.DateTimePicker)e.Row.FindControl("dtpStartDate");
                if (dtpStartDate != null)
                {
                    dtpStartDate.SetClientSideChangeHandler(string.Format("onStartStageWithDate(this,'{0}','{1}','{2}');", cmdStartDate.ClientID, startDateContext.ClientID, spAudit.Id.ToString()));
                    if (spAudit.StartDate != null)
                    {
                        dtpStartDate.DateTimeValue = (DateTime)spAudit.StartDate;
                    }
                    else
                    {
                        dtpStartDate.DateTimeValue = DateTime.MinValue;
                        dtpStartDate.Text          = string.Empty;
                    }
                }
                Sage.SalesLogix.Web.Controls.DateTimePicker dtpCompletedDate = (Sage.SalesLogix.Web.Controls.DateTimePicker)e.Row.FindControl("dtpCompleteDate");
                if (dtpCompletedDate != null)
                {
                    dtpCompletedDate.SetClientSideChangeHandler(string.Format("onCompleteStageWithDate(this,'{0}','{1}','{2}');", cmdCompleteDate.ClientID, completeDateContext.ClientID, spAudit.Id.ToString()));
                    if (spAudit.CompletedDate != null)
                    {
                        dtpCompletedDate.DateTimeValue = (DateTime)spAudit.CompletedDate;
                    }
                    else
                    {
                        dtpCompletedDate.DateTimeValue = DateTime.MinValue;
                        dtpCompletedDate.Text          = string.Empty;
                    }
                }
            }
        }
    }
Пример #5
0
    private string CanCompleteStep(string stepId)
    {
        string             result  = string.Empty;
        ISalesProcessAudit spAudit = EntityFactory.GetById <ISalesProcessAudit>(stepId);

        if (spAudit != null)
        {
            result = spAudit.SalesProcess.CanCompleteStep(stepId);
        }

        return(result);
    }
    /// <summary>
    /// Does the web form.
    /// </summary>
    /// <param name="spAudit">The sp audit.</param>
    /// <returns></returns>
    private string DoWebForm(ISalesProcessAudit spAudit)
    {
        string result = string.Empty;

        string      xmlData = UnicodeEncoding.UTF8.GetString(spAudit.Data);
        XmlDocument xmlDoc  = new XmlDocument();

        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/FormAction");
        string  family     = actionNode.SelectSingleNode("WebForm/Family").InnerText;
        string  name       = actionNode.SelectSingleNode("WebForm/Name").InnerText;

        result = GetLocalResourceObject("MSG_WebFormsNotSupported").ToString();
        return(result);
    }
Пример #7
0
    /// <summary>
    /// Does the activity.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoActivity(ISalesProcessAudit step)
    {
        string      result  = string.Empty;
        string      xmlData = System.Text.UnicodeEncoding.UTF8.GetString(step.Data);
        XmlDocument xmlDoc  = new XmlDocument();

        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/ActivityAction");

        string strAutoSchedule = string.Empty;

        strAutoSchedule = actionNode.SelectSingleNode("AutoSchedule").InnerText;
        string leaderId = selectedUserId.Value;

        IUser leader = GetUser(leaderId);

        if (leader == null)
        {
            throw new Exception(GetLocalResourceObject("Error_LeaderNotFound").ToString());
        }

        string contactId = selectedContactId.Value;

        IContact contact = GetContact(contactId);

        if (contact == null)
        {
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        }
        if (strAutoSchedule == "F")
        {
            //Show the user the new Activity.

            IActivity activity = (Activity)_salesProcess.ScheduleActivity(step.Id.ToString(), _opportunity, leader, contact, false);
            Session["activitysession"] = activity;
            Dictionary <string, string> args = new Dictionary <string, string>();
            args.Add("type", activity.Type.ToString());
            Link.ScheduleActivity(args);
        }
        else
        {
            //schedule the activity
            Activity activity = (Activity)this._salesProcess.ScheduleActivity(step.Id.ToString(), this._opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        return(result);
    }
    /// <summary>
    /// Does the activity.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoActivity(ISalesProcessAudit step)
    {
        string      result  = string.Empty;
        string      xmlData = System.Text.UnicodeEncoding.UTF8.GetString(step.Data);
        XmlDocument xmlDoc  = new XmlDocument();

        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/ActivityAction");

        string strAutoSchedule = string.Empty;

        strAutoSchedule = actionNode.SelectSingleNode("AutoSchedule").InnerText;
        string leaderId = selectedUserId.Value;

        IUser leader = GetUser(leaderId);

        if (leader == null)
        {
            throw new Exception(GetLocalResourceObject("Error_LeaderNotFound").ToString());
        }

        string contactId = selectedContactId.Value;

        IContact contact = GetContact(contactId);

        if (contact == null)
        {
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        }
        if (strAutoSchedule == "F")
        {
            //This will now be processed by the web service and then calle the client side script to open the activity dialog.
            IActivity activity = (Activity)_salesProcess.ScheduleActivity(step.Id.ToString(), _opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        else
        {
            //schedule the activity
            Activity activity = (Activity)this._salesProcess.ScheduleActivity(step.Id.ToString(), this._opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        return(result);
    }
 /// <summary>
 /// Loads the snap shot.
 /// </summary>
 /// <param name="stage">The stage.</param>
 private void LoadSnapShot(ISalesProcessAudit stage)
 {
     if (stage != null)
     {
         valueCurrnetStage.Text    = stage.StageName;
         valueProbabilty.Text      = stage.Probability.ToString() + "%";
         valueDaysInStage.Text     = Convert.ToString(this._salesProcess.DaysInStage(stage.Id.ToString()));
         valueEstDays.Text         = Convert.ToString(_salesProcess.EstimatedDaysToClose());
         dtpEstClose.DateTimeValue = (DateTime)_salesProcess.EstimatedCloseDate();
     }
     else
     {
         valueCurrnetStage.Text    = "''";
         valueProbabilty.Text      = "0%";
         valueDaysInStage.Text     = "0";
         valueEstDays.Text         = "0";
         dtpEstClose.DateTimeValue = DateTime.MinValue;
         dtpEstClose.Text          = string.Empty;
     }
 }
    /// <summary>
    /// Does the contact process.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoContactProcess(ISalesProcessAudit step)
    {
        string result = string.Empty;

        string   contactId = selectedContactId.Value;
        IContact contact   = GetContact(contactId);

        if (contact == null)
        {
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        }

        string processId = this._salesProcess.ScheduleContactProcess(step.Id.ToString(), contact);

        if (processId != string.Empty)
        {
            result = string.Format(GetLocalResourceObject("MSG_ContactProcessScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        else
        {
            result = GetLocalResourceObject("Error_ContactProcessNotAssigned").ToString();
        }
        return(result);
    }
    /// <summary>
    /// Does the activity.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoActivity(ISalesProcessAudit step)
    {
        string result = string.Empty;
        string xmlData = System.Text.UnicodeEncoding.UTF8.GetString(step.Data);
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/ActivityAction");

        string strAutoSchedule = string.Empty;

        strAutoSchedule = actionNode.SelectSingleNode("AutoSchedule").InnerText;
        string leaderId = selectedUserId.Value;

        IUser leader = GetUser(leaderId);
        if (leader == null)
            throw new Exception(GetLocalResourceObject("Error_LeaderNotFound").ToString());

        string contactId = selectedContactId.Value;

        IContact contact = GetContact(contactId);
        if (contact == null)
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        if (strAutoSchedule == "F")
        {
            //Show the user the new Activity.

            Activity activity = (Activity)this._salesProcess.ScheduleActivity(step.Id.ToString(), _opportunity, leader, contact, false);
            //Remot the Attendee since the ui will try to re add it.
            activity.Attendees.Remove(0);
            string activitySessionId = step.Id.ToString();
            Session.Add(activitySessionId, activity);

            Dictionary<string, string> args = new Dictionary<string, string>();
            args.Add("activitysession", activitySessionId);
            Link.ScheduleActivity(args);
        }
        else
        {
            //schedule the activity
            Activity activity = (Activity)this._salesProcess.ScheduleActivity(step.Id.ToString(), this._opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        return result;
    }
    /// <summary>
    /// Does the contact process.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoContactProcess(ISalesProcessAudit step)
    {
        string result = string.Empty;

        string contactId = selectedContactId.Value;
        IContact contact = GetContact(contactId);

        if (contact == null)
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());

        string processId = this._salesProcess.ScheduleContactProcess(step.Id.ToString(), contact);
        if (processId != string.Empty)
        {
            result = string.Format(GetLocalResourceObject("MSG_ContactProcessScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        else
        {
            result = GetLocalResourceObject("Error_ContactProcessNotAssigned").ToString();
        }
        return result;
    }
    /// <summary>
    /// Does the lit request.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoLitRequest(ISalesProcessAudit step)
    {
        string result = string.Empty;
        string authorId = selectedUserId.Value;
        IUser author = GetUser(authorId);
        if (author == null)
            throw new Exception(GetLocalResourceObject("Error_AuthorNotFound").ToString());

        string contactId = selectedContactId.Value;
        IContact contact = GetContact(contactId);
        if (contact == null)
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());

        string reqId = this._salesProcess.ScheduleLitRequest(step.Id.ToString(), this._opportunity, author, contact);
        if (reqId != string.Empty)
        {
            string url = string.Format("~/LitRequest.aspx?entityid={0}", reqId);
            Response.Redirect(url);
        }
        else
        {
            result = GetLocalResourceObject("Error_LitRequestNotScheduled").ToString();
        }

        return result;
    }
    /// <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>
    /// Handles the RowDataBound event of the SalesProcessGrid control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
    protected void SalesProcessGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ISalesProcessAudit spAudit = (ISalesProcessAudit)e.Row.DataItem;
            // process header and footer records
            if ((spAudit.ProcessType == "HEADER") || (spAudit.ProcessType == "FOOTER"))
            {
                e.Row.Cells.Clear();
                return;
            }
            // process step records
            if (spAudit.ProcessType == "STEP")
            {
                CheckBox cbComplete = ((CheckBox)e.Row.FindControl("chkComplete"));
                cbComplete.Attributes.Add("onClick", string.Format("return onCompleteStep('{0}','{1}','{2}');", cmdCompleteStep.ClientID, stepContext.ClientID, spAudit.Id.ToString() + ":" + spAudit.Completed));

                Label lblReq = ((Label)e.Row.FindControl("lblReq"));

                lblReq.ForeColor = Color.Red;
                lblReq.Text      = (spAudit.Required == true ? "*" : "&nbsp;&nbsp;");

                LinkButton linkAction = ((LinkButton)e.Row.FindControl("linkAction"));
                linkAction.Text = spAudit.StepName;
                linkAction.Attributes.Add("href", string.Format("javascript:executeAction('{0}','{1}');", spAudit.Id.ToString(), spAudit.ActionType));

                DateTimePicker dtpStartDate = (DateTimePicker)e.Row.FindControl("dtpStartDate");
                if (dtpStartDate != null)
                {
                    dtpStartDate.SetClientSideChangeHandler(string.Format("onStartStepWithDate(this,'{0}','{1}','{2}');", cmdStartDate.ClientID, startDateContext.ClientID, spAudit.Id.ToString()));
                    if (spAudit.StartDate != null)
                    {
                        dtpStartDate.DateTimeValue = (DateTime)spAudit.StartDate;
                    }
                    else
                    {
                        dtpStartDate.DateTimeValue = DateTime.MinValue;
                        dtpStartDate.Text          = string.Empty;
                    }
                }
                DateTimePicker dtpCompletedDate = (DateTimePicker)e.Row.FindControl("dtpCompleteDate");
                if (dtpCompletedDate != null)
                {
                    dtpCompletedDate.SetClientSideChangeHandler(string.Format("onCompleteStepWithDate(this,'{0}','{1}','{2}');", cmdCompleteDate.ClientID, completeDateContext.ClientID, spAudit.Id.ToString()));
                    if (spAudit.CompletedDate != null)
                    {
                        dtpCompletedDate.DateTimeValue = (DateTime)spAudit.CompletedDate;
                    }
                    else
                    {
                        dtpCompletedDate.DateTimeValue = DateTime.MinValue;
                        dtpCompletedDate.Text          = string.Empty;
                    }
                }
            }
            // process stage records
            if (spAudit.ProcessType == "STAGE")
            {
                e.Row.Cells[0].ColumnSpan      = 6;
                e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Left;
                e.Row.Cells[0].Font.Bold       = (spAudit.IsCurrent == true);
                e.Row.BackColor     = Color.FromArgb(220, 233, 247);
                e.Row.Cells[0].Text = string.Format("{0} {1}:{2}-{3}%", GetLocalResourceObject("Stage").ToString(), spAudit.StageOrder, spAudit.StageName, spAudit.Probability);
                e.Row.Cells.RemoveAt(1);
                e.Row.Cells.RemoveAt(1);
                e.Row.Cells.RemoveAt(1);
                e.Row.Cells.RemoveAt(1);
            }
        }
    }
    /// <summary>
    /// Does the activity.
    /// </summary>
    /// <param name="step">The step.</param>
    /// <returns></returns>
    private string DoActivity(ISalesProcessAudit step)
    {
        string result = string.Empty;
        string xmlData = System.Text.UnicodeEncoding.UTF8.GetString(step.Data);
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/ActivityAction");

        string strAutoSchedule = string.Empty;

        strAutoSchedule = actionNode.SelectSingleNode("AutoSchedule").InnerText;
        string leaderId = selectedUserId.Value;

        IUser leader = GetUser(leaderId);
        if (leader == null)
            throw new Exception(GetLocalResourceObject("Error_LeaderNotFound").ToString());

        string contactId = selectedContactId.Value;

        IContact contact = GetContact(contactId);
        if (contact == null)
            throw new Exception(GetLocalResourceObject("Error_ContactNotFound").ToString());
        if (strAutoSchedule == "F")
        {
            //This will now be processed by the web service and then calle the client side script to open the activity dialog.
            IActivity activity = (Activity)_salesProcess.ScheduleActivity(step.Id.ToString(), _opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        else
        {
            //schedule the activity
            Activity activity = (Activity)this._salesProcess.ScheduleActivity(step.Id.ToString(), this._opportunity, leader, contact, true);
            result = string.Format(GetLocalResourceObject("MSG_ActivityScheduled").ToString(), contact.FirstName, contact.LastName);
        }
        return result;
    }
 /// <summary>
 /// Does the mail merge.
 /// </summary>
 /// <param name="spAudit">The sp audit.</param>
 /// <returns></returns>
 private string DoMailMerge(ISalesProcessAudit spAudit)
 {
     string result = string.Empty;
     result = GetLocalResourceObject("MSG_MailMergeCompleted").ToString();
     return result;
 }
Пример #18
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);
            }
        }
    }
 /// <summary>
 /// Loads the snap shot.
 /// </summary>
 /// <param name="stage">The stage.</param>
 private void LoadSnapShot(ISalesProcessAudit stage)
 {
     if (stage != null)
     {
         valueCurrnetStage.Text = stage.StageName;
         valueProbabilty.Text = stage.Probability.ToString() + "%";
         valueDaysInStage.Text = Convert.ToString(this._salesProcess.DaysInStage(stage.Id.ToString()));
         valueEstDays.Text = Convert.ToString(_salesProcess.EstimatedDaysToClose());
         dtpEstClose.DateTimeValue = (DateTime)_salesProcess.EstimatedCloseDate();
     }
     else
     {
         valueCurrnetStage.Text = "''";
         valueProbabilty.Text = "0%";
         valueDaysInStage.Text = "0";
         valueEstDays.Text = "0";
         dtpEstClose.DateTimeValue = DateTime.MinValue;
         dtpEstClose.Text = string.Empty;
     }
 }
    /// <summary>
    /// Does the web form.
    /// </summary>
    /// <param name="spAudit">The sp audit.</param>
    /// <returns></returns>
    private string DoWebForm(ISalesProcessAudit spAudit)
    {
        string result = string.Empty;

        string xmlData = UnicodeEncoding.UTF8.GetString(spAudit.Data);
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlData);
        XmlNode actionNode = xmlDoc.DocumentElement.SelectSingleNode("//Action/FormAction");
        string family = actionNode.SelectSingleNode("WebForm/Family").InnerText;
        string name = actionNode.SelectSingleNode("WebForm/Name").InnerText;
        result = GetLocalResourceObject("MSG_WebFormsNotSupported").ToString();
        return result;
    }