Esempio n. 1
0
    /// <summary>
    /// Sets the state of the action.
    /// </summary>
    private void SetActionState()
    {
        ImportManager importManager = GetImportManager();

        Action = importManager.ActionManager.GetAction("AddResponse") as ActionAddResponse;
        Action.HydrateChanges();
        if (Action == null)
        {
            return;
        }
        if (!Action.Initialized)
        {
            dtpResponseDate.DateTimeValue   = DateTime.UtcNow;
            pklResponseStatus.PickListValue = GetLocalResourceObject("DefaultResponseStatus").ToString();
            ImportTargetProperty tpLeadSource = importManager.EntityManager.GetEntityProperty("LeadSource");
            if (tpLeadSource != null && !String.IsNullOrEmpty(tpLeadSource.DefaultValue.ToString()))
            {
                ILeadSource ls = EntityFactory.GetById <ILeadSource>(tpLeadSource.DefaultValue);
                if (ls != null)
                {
                    lueResponseLeadSource.LookupResultValue = ls;
                    lueResponseLeadSource.Text = ls.Description;
                }
            }
            txtComments.Text = Action.Response.Comments;
            pklResponseMethod.PickListValue = Action.Response.ResponseMethod;
            lueCampaign.LookupResultValue   = Action.Response.Campaign;
            lbxStages.SelectedValue         = Action.Response.Stage;
            pklInterest.PickListValue       = Action.Response.Interest;
            pklInterestLevel.PickListValue  = Action.Response.InterestLevel;

            if (Mode.Value == "")
            {
                Action.Initialized = true;
                Mode.Value         = "ADD";
            }
        }
        else
        {
            if (!String.IsNullOrEmpty(Action.Response.LeadSource))
            {
                ILeadSource ls = EntityFactory.GetById <ILeadSource>(Action.Response.LeadSource);
                if (ls != null)
                {
                    lueResponseLeadSource.LookupResultValue = ls;
                    lueResponseLeadSource.Text = ls.Description;
                }
            }

            txtComments.Text = Action.Response.Comments;
            dtpResponseDate.DateTimeValue   = Action.Response.ResponseDate;
            pklResponseStatus.PickListValue = Action.Response.Status;
            pklResponseMethod.PickListValue = Action.Response.ResponseMethod;
            lueCampaign.LookupResultValue   = Action.Response.Campaign;
            lbxStages.SelectedValue         = Action.Response.Stage;
            pklInterest.PickListValue       = Action.Response.Interest;
            pklInterestLevel.PickListValue  = Action.Response.InterestLevel;
        }
    }
        public MasterSettingsController(ILeadSource LeadSource, IIndustryCategory industryCategory, IRole role)
        {
            //_LeadSource = new LeadSourceService();
            _LeadSource       = LeadSource;
            _IndustryCategory = industryCategory;
            _IRole            = role;

            client             = new HttpClient();
            client.BaseAddress = new Uri(apiUrl);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        }
 /// <summary>
 /// Handles the RowCommand event of the grdCampaignLeadSource control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
 protected void grdCampaignLeadSource_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Associate"))
     {
         int rowIndex = Convert.ToInt32(e.CommandArgument);
         if (grdCampaignLeadSource != null)
         {
             string id = grdCampaignLeadSource.DataKeys[rowIndex].Value.ToString();
             if (!String.IsNullOrEmpty(id))
             {
                 ICampaign   campaign   = BindingSource.Current as ICampaign;
                 ILeadSource leadsource = EntityFactory.GetRepository <ILeadSource>().Get(id);
                 if (!String.IsNullOrEmpty(campaign.CampaignLeadSources))
                 {
                     campaign.CampaignLeadSources += String.Format(", {0}", leadsource.Description);
                 }
                 else
                 {
                     campaign.CampaignLeadSources = leadsource.Description;
                 }
             }
         }
     }
 }