/// <summary> /// Applies the check box filter. /// </summary> /// <param name="checkBox">The check box.</param> private void ApplyCheckBoxFilter(CheckBox checkBox) { var analyticFilterId = Guid.Parse(checkBox.Attributes["AnalyticFilterID"]); var checkedValue = checkBox.Checked; var analyticFilter = DataManager.AnalyticReportSystem.SelectById(analyticFilterId); if (analyticFilter != null) { var filterValues = analyticFilter.tbl_AnalyticAxis.tbl_AnalyticAxisFilterValues; if (filterValues.Count > 0) { var reportFilter = new AnalyticReportFilter() { FilterId = analyticFilterId, Operator = FilterOperator.None, Query = filterValues.SingleOrDefault(o => o.Value == (checkedValue ? "1" : "0")).Query }; var existsReportFilter = ReportFilters.SingleOrDefault(o => o.FilterId == analyticFilterId); if (existsReportFilter != null) { ReportFilters.Remove(existsReportFilter); } ReportFilters.Add(reportFilter); ReportFilterChanged(this); } } }
/// <summary> /// Handles the AjaxRequest event of the radAjaxManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AjaxRequestEventArgs"/> instance containing the event data.</param> protected void radAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e) { if (e.Argument == "BuildCharts") { if (!string.IsNullOrEmpty(hfWidth.Value)) { ucChart1.AnalyticReportId = Guid.Parse("67566bb9-5dec-422a-bc0f-eaff5dc40a3c"); ucChart2.AnalyticReportId = Guid.Parse("a00fd583-24de-4f75-8f79-f5de236576e8"); ucChart1.ColumnSystemNameValueToBuildChart = "Conversion"; ucChart2.ColumnSystemNameValueToBuildChart = "Conversion"; ucChart1.ReportFilters.Clear(); ucChart2.ReportFilters.Clear(); var filter = new AnalyticReportFilter { FilterId = Guid.NewGuid(), ColumnName = "TBLMassWorkflow.ID", Operator = FilterOperator.Equal, Value = _massWorkflowId.ToString() }; ucChart1.ReportFilters.Add(filter); ucChart2.ReportFilters.Add(filter); ucChart1.Visible = true; ucChart2.Visible = true; ucChart1.Width = int.Parse(hfWidth.Value) - 295; ucChart2.Width = int.Parse(hfWidth.Value) - 295; ucChart1.BindData(); ucChart2.BindData(); } } }
/// <summary> /// Handles the SelectedIndexChanged event of the dropDownList 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 dropDownList_SelectedIndexChanged(object sender, EventArgs e) { if (ReportFilterChanged != null) { var dropDownList = (DropDownList)sender; var analyticFilterId = Guid.Parse(dropDownList.Attributes["AnalyticFilterID"]); var selectedValue = Guid.Parse(dropDownList.SelectedValue); var analyticFilter = DataManager.AnalyticReportSystem.SelectById(analyticFilterId); //Обработка заранеее добавленных фильтров if (analyticFilter.tbl_AnalyticAxis.tbl_AnalyticAxisFilterValues.Count > 0) { var analyticFilterValue = analyticFilter.tbl_AnalyticAxis.tbl_AnalyticAxisFilterValues.SingleOrDefault(o => o.ID == selectedValue); if (analyticFilterValue != null) { var reportFilter = new AnalyticReportFilter() { FilterId = analyticFilterId, ColumnName = analyticFilterValue.ColumnName, Value = analyticFilterValue.Value, Operator = (FilterOperator)analyticFilterValue.FilterOperatorID, Query = analyticFilterValue.Query }; var existsReportFilter = ReportFilters.SingleOrDefault(o => o.FilterId == analyticFilterId); if (existsReportFilter != null) { ReportFilters.Remove(existsReportFilter); } ReportFilters.Add(reportFilter); ReportFilterChanged(this); } } //Обработка фильтров справочников else if (!string.IsNullOrEmpty(analyticFilter.tbl_AnalyticAxis.DataSet)) { var reportFilter = new AnalyticReportFilter() { FilterId = analyticFilterId, ColumnName = analyticFilter.tbl_AnalyticAxis.DataSet.Replace("_", string.Empty) + ".ID", Value = selectedValue.ToString(), Operator = FilterOperator.Equal }; var existsReportFilter = ReportFilters.SingleOrDefault(o => o.FilterId == analyticFilterId); if (existsReportFilter != null) { ReportFilters.Remove(existsReportFilter); } if (selectedValue != Guid.Empty) { ReportFilters.Add(reportFilter); } ReportFilterChanged(this); } } }