/// <summary> /// Saves the state of the action. /// </summary> private void SaveActionState(bool setInt) { ImportManager importManager = GetImportManager(); Action = importManager.ActionManager.GetAction("AddResponse") as ActionAddResponse; Action.Response.Comments = txtComments.Text; if (lueResponseLeadSource.LookupResultValue != null) { Action.Response.LeadSource = ((ILeadSource)lueResponseLeadSource.LookupResultValue).Id.ToString(); //lueResponseLeadSource.Text; } else { Action.Response.LeadSource = string.Empty;//System.Convert.ToString(lueResponseLeadSource.LookupResultValue); } Action.Response.ResponseDate = dtpResponseDate.DateTimeValue; Action.Response.Status = pklResponseStatus.PickListValue; Action.Response.ResponseMethod = pklResponseMethod.PickListValue; Action.Response.Campaign = lueCampaign.LookupResultValue as ICampaign; Action.Response.Stage = lbxStages.SelectedValue; Action.Response.Interest = pklInterest.PickListValue; Action.Response.InterestLevel = pklInterestLevel.PickListValue; if (setInt) { Action.Initialized = true; Action.Active = true; } Action.SaveChanges(); Page.Session["importManager"] = importManager; }
/// <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; } }
/// <summary> /// Handles the OnClick event of the btnCancel 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 btnCancel_OnClick(object sender, EventArgs e) { ImportManager importManager = GetImportManager(); Action = importManager.ActionManager.GetAction("AddResponse") as ActionAddResponse; if (Mode.Value == "ADD") { Action.Initialized = false; Action.Active = false; Action.Response.LeadSource = string.Empty; Page.Session["importManager"] = importManager; } }