/// <summary> /// Handles the OnClick event of the DeleteTargets 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 DeleteTargets_OnClick(object sender, EventArgs e) { TargetsViewDataSource dataSource = new TargetsViewDataSource(); dataSource.OnSetCriteriaEvent += OnSetFilters; dataSource.SelectedFilterState = GetFilterState(); if (dataSource.SelectedFilterState.SelectedStates.Count > 0 || dataSource.SelectedFilterState.SelectedALL) { dataSource.DeleteSelectedTargets(); } }
/// <summary> /// Handles the OnClick event of the cmdOK 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 cmdOK_OnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtGroupName.Text)) { DialogService.ShowMessage(GetLocalResourceObject("error_NoGroupName").ToString()); return; } if (DialogService.DialogParameters.Count > 0) { if (DialogService.DialogParameters.ContainsKey("TargetSelectedFilterState")) { string groupId = String.Empty; TargetSelectedFilterState filterState = DialogService.DialogParameters["TargetSelectedFilterState"] as TargetSelectedFilterState; TargetsViewDataSource ds = new TargetsViewDataSource(); string targetIds = null; ds.SelectedFilterState = filterState; if (lbxGroupType.SelectedValue.Equals("Contact")) { filterState.IncludeContacts = true; filterState.IncludeLeads = false; } else { filterState.IncludeContacts = false; filterState.IncludeLeads = true; } targetIds = ConvertToString(rdgGroupMembers.SelectedIndex == 0 ? ds.GetEntityIds(false) : ds.GetEntityIds(true)); if (!string.IsNullOrEmpty(targetIds)) { groupId = GroupInfo.CreateAdHocGroup(targetIds, lbxGroupType.SelectedValue, txtGroupName.Text); } else { throw new ValidationException(String.Format(GetLocalResourceObject("error_NoTargetsFound").ToString(), lbxGroupType.SelectedValue)); } if (!String.IsNullOrEmpty(groupId)) { Response.Redirect(lbxGroupType.SelectedValue.Equals("Contact") ? string.Format("Contact.aspx?gid={0}", groupId) : string.Format("Lead.aspx?gid={0}", groupId)); } } else { DialogService.ShowMessage(GetLocalResourceObject("error_NoDataSourceFound").ToString()); } DialogService.CloseEventHappened(sender, e); Refresh(); } }
/// <summary> /// Gets the data source. /// </summary> /// <returns> /// /// </returns> private TargetsViewDataSource GetDataSource() { TargetsViewDataSource ds = new TargetsViewDataSource(); if (DialogService.DialogParameters.Count > 0) { object filterStateObj; if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj)) { _filterState = filterStateObj as TargetSelectedFilterState; _filterState.IncludeSelectedOnly = true; } } ds.SelectedFilterState = _filterState; return(ds); }
/// <summary> /// Does the add response. /// </summary> /// <param name="campaign">The campaign.</param> private void DoAddResponse(ICampaign campaign) { string stage = Request.Form[ddlStage.ClientID.Replace("_", "$")]; string comment = txtComment.Text; string responseMethod = Request.Form[ddlResponseMethods.ClientID.Replace("_", "$")]; string Id = luLeadSource.ClientID + "_LookupText"; string leadSource = Request.Form[Id.Replace("_", "$")]; string responseInterest = Request.Form[ddlResponseInterests.ClientID.Replace("_", "$")]; string responseInterestLevel = Request.Form[ddlResponseInterestLevels.ClientID.Replace("_", "$")]; DateTime?responseDate = dtpResponseDate.DateTimeValue; String[] propNames = { "Stage", "Comment", "ResponseMethod", "LeadSource", "ResponseDate", "Interest", "InterestLevel" }; object[] propValues = { stage, comment, responseMethod, leadSource, responseDate, responseInterest, responseInterestLevel }; ComponentView responseData = new ComponentView(propNames, propValues); TargetsViewDataSource ds = GetDataSource(); Helpers.AddTargetResponses(ds, campaign, responseData); }
/// <summary> /// Gets the seleceted target ids. /// </summary> /// <returns></returns> private object[] GetSelecetedTargetIds() { object[] ids = null; TargetsViewDataSource ds = new TargetsViewDataSource(); if (DialogService.DialogParameters.Count > 0) { object filterStateObj; if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj)) { _filterState = filterStateObj as TargetSelectedFilterState; _filterState.IncludeSelectedOnly = true; } } ds.SelectedFilterState = _filterState; ids = ds.GetTargetIds(true); return(ids); }
/// <summary> /// Creates the targets view data source. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.ObjectDataSourceEventArgs"/> instance containing the event data.</param> protected void CreateTargetsViewDataSource(object sender, ObjectDataSourceEventArgs e) { TargetsViewDataSource dataSource = new TargetsViewDataSource(); dataSource.SelectedFilterState = _filterState; if (!String.IsNullOrEmpty(grdTargets.SortExpression)) { dataSource.SortExpression = grdTargets.SortExpression; } dataSource.IsAscending = grdTargets.SortDirection.Equals(SortDirection.Ascending); if (_setLastPageIndex) { int pageIndex = 0; int recordCount = dataSource.GetDataCount(); int pageSize = grdTargets.PageSize; decimal numberOfPages = recordCount / pageSize; pageIndex = Convert.ToInt32(Math.Ceiling(numberOfPages)); grdTargets.PageIndex = pageIndex; } e.ObjectInstance = dataSource; }
/// <summary> /// Creates the targets view data source. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.ObjectDataSourceEventArgs"/> instance containing the event data.</param> protected void CreateTargetsViewDataSource(object sender, ObjectDataSourceEventArgs e) { TargetsViewDataSource dataSource = new TargetsViewDataSource(); dataSource.OnSetCriteriaEvent += OnSetFilters; dataSource.SelectedFilterState = GetFilterState(); dataSource.CacheResult = false; if (!String.IsNullOrEmpty(grdTargets.SortExpression)) dataSource.SortExpression = grdTargets.SortExpression; dataSource.IsAscending = grdTargets.SortDirection.Equals(SortDirection.Ascending); if (_SetLastPageIndex) { int pageIndex = 0; int recordCount = dataSource.GetDataCount(); int pageSize = grdTargets.PageSize; decimal numberOfPages = recordCount / pageSize; pageIndex = Convert.ToInt32(Math.Ceiling(numberOfPages)); grdTargets.PageIndex = pageIndex; } e.ObjectInstance = dataSource; }
/// <summary> /// Gets the seleceted target ids. /// </summary> /// <returns></returns> private object[] GetSelecetedTargetIds() { object[] ids = null; TargetsViewDataSource ds = new TargetsViewDataSource(); if (DialogService.DialogParameters.Count > 0) { object filterStateObj; if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj)) { _filterState = filterStateObj as TargetSelectedFilterState; _filterState.IncludeSelectedOnly = true; } } ds.SelectedFilterState = _filterState; ids = ds.GetTargetIds(true); return ids; }
/// <summary> /// Creates the targets view data source. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.ObjectDataSourceEventArgs"/> instance containing the event data.</param> protected void CreateTargetsViewDataSource(object sender, ObjectDataSourceEventArgs e) { TargetsViewDataSource dataSource = new TargetsViewDataSource(); dataSource.SelectedFilterState = _filterState; if (_SetLastPageIndex) { int pageIndex = 0; int recordCount = dataSource.GetDataCount(); int pageSize = grdTargets.PageSize; decimal numberOfPages = recordCount / pageSize; pageIndex = Convert.ToInt32(Math.Ceiling(numberOfPages)); grdTargets.PageIndex = pageIndex; } e.ObjectInstance = dataSource; }
/// <summary> /// Does the update init. /// </summary> /// <param name="initTarget">if set to <c>true</c> [init target].</param> private void DoUpdateInit(Boolean initTarget) { TargetsViewDataSource ds = GetDataSource(); Helpers.UpdateTargetInit(initTarget, ds); }
/// <summary> /// Does the update stage. /// </summary> /// <param name="stage">The stage.</param> private void DoUpdateStage(string stage) { TargetsViewDataSource ds = GetDataSource(); Helpers.UpdateTargetStage(stage, ds); }
/// <summary> /// Gets the data source. /// </summary> /// <returns> /// /// </returns> private TargetsViewDataSource GetDataSource() { TargetsViewDataSource ds = new TargetsViewDataSource(); if (DialogService.DialogParameters.Count > 0) { object filterStateObj; if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj)) { _filterState = filterStateObj as TargetSelectedFilterState; _filterState.IncludeSelectedOnly = true; } } ds.SelectedFilterState = _filterState; return ds; }