Exemplo n.º 1
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);
    }