public void SetFiltersToStorageValues(StorageValues storageValues) { var filterValues = GetFilterValues(); foreach (var item in storageValues.GetStorageNames()) { if (!filterValues.ContainsKey(item)) { continue; } if (filterValues[item].Count == 0) { storageValues.SetStorageValues(item, ColumnFilterType.None, new object[2]); } else { var filterItem = filterValues[item][0]; storageValues.SetStorageValues(item, filterItem.ColumnFilterType.Value, filterItem.Value1, filterItem.Value2); } } for (int i = 0; i < storageValues.CountListValues; i++) { foreach (var item in storageValues.GetCircleStorageNames(i)) { if (!filterValues.ContainsKey(item) || filterValues[item].Count <= i) { continue; } var filterItem = filterValues[item][i]; storageValues.SetCircleStorageValues(item, i, filterItem.Value1, filterItem.Value2); } } }
private void SaveFiltersState() { StorageValues storageValues = new StorageValues(); bool storageValuesNotSet = true; foreach (ColumnFilterStorage storage in ColumnFilterStorages) { storageValues.AddStorage(storage); if (storage.FilterType != ColumnFilterType.None) { storageValuesNotSet = false; } } if (storageValuesNotSet) { storageValues = null; } var sid = GetSidBytes(); StorageValues.SetStorageValues(string.Format("{0}_{1}", Page.AppRelativeVirtualPath, ClientID), sid, storageValues); }
protected void CreateReport(string culture, bool isSubscriptions) { if (webReportManager.Plugin == null) { return; } errorDisplay.Text = ""; ValidateReportEventArgs args = new ValidateReportEventArgs(); if (!webReportManager.Validate(args)) { errorDisplay.ShowError(webReportManager.ErrorText); WriteErrors(errorDisplay, args); return; } //webReportManager.ShowReport(); //StiWebViewer1.Report = webReportManager.Report; //StiWebViewer1.ResetCurrentPage(); if (webReportManager.Plugin != null) { StorageValues values = webReportManager.GetValues(); var sid = new byte[] { }; switch (this.Context.User.Identity.AuthenticationType) { case "Windows": var windowsIdentity = (WindowsIdentity)this.Context.User.Identity; sid = new byte[windowsIdentity.User.BinaryLength]; windowsIdentity.User.GetBinaryForm(sid, 0); break; case "Forms": // note: Получение сида при идентификации по формам. sid = Encoding.Default.GetBytes(User.GetSID()); break; } if (((IWebReportPlugin)webReportManager.Plugin).AllowSaveValuesConditions) { StorageValues.SetStorageValues(webReportManager.Plugin.GetType().FullName, sid, values); } if (!isSubscriptions) { var redirectReportPlugin = webReportManager.Plugin as IRedirectReportPlugin; var backPath = Request.QueryString["backPath"]; var backText = Request.QueryString["text"]; if (string.IsNullOrEmpty(backPath) && webReportManager.Plugin.Visible) { backPath = WebReportManager.GetReportUrl( string.Empty, webReportManager.Plugin.GetType().FullName, string.Empty, string.Empty, false) + "&open=false&setDefaultParams=true"; } if (string.IsNullOrEmpty(backText)) { backText = Resources.SBack; } if (webReportManager.Plugin.Visible) { RememberReports( WebReportManager.GetReportUrl( string.Empty, webReportManager.Plugin.GetType().FullName, string.Empty, string.Empty, false) + "&open=false&setDefaultParams=true", webReportManager.Plugin); } if (redirectReportPlugin != null) { if (redirectReportPlugin.LogViewReport) { Tools.Security.DBDataContext.AddViewReports( Tools.Security.User.GetSID(), HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, ReportInitializerSection.GetReportInitializerSection().ReportPageViewer + "?ClassName=" + redirectReportPlugin.GetType().FullName, HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority), Environment.MachineName, false, redirectReportPlugin.GetType()); } redirectReportPlugin.OpenReport( webReportManager, values, Request.QueryString["rs:format"], culture, HttpUtility.UrlEncode(backPath), backText, Request.QueryString["rs:command"]); } else { var guid = SetSession(values, webReportManager); Response.Redirect( string.Format( "{6}?reportName={0}&expword={4}&values={1}&text={2}&culture={5}&backPath={3}", webReportManager.Plugin.GetType().FullName, guid, backText, HttpUtility.UrlEncode(backPath), Request.QueryString["expword"], culture, ReportInitializerSection.GetReportInitializerSection().ReportingStiReportResultPage)); } // ScriptManager.RegisterStartupScript(btnCreateReport, // GetType(), // "open new window", // string.Format("window.open('ReportResultPage.aspx?reportName={0}&refPerson={1}', '');", // webReportManager.Plugin.GetType().FullName, // refPerson, // Guid.NewGuid().ToString().Replace("-", "")), // true); } else { var guid = SetSession(values, webReportManager); var url = new MainPageUrlBuilder { UserControl = "ReportSubscriptionsEdit", IsDataControl = true, IsNew = true }; url.CustomQueryParameters.Add("guid", guid); /*Определение типа отчета*/ var isSqlReportingServices = Convert.ToByte(webReportManager.Plugin is ISqlReportingServicesPlugin); url.CustomQueryParameters.Add("isSqlReportingServices", isSqlReportingServices.ToString()); url.CustomQueryParameters.Add("reportName", webReportManager.Plugin.GetType().FullName); url.CustomQueryParameters.Add("qscommand", Request.QueryString["rs:command"]); url.CustomQueryParameters.Add("culture", culture); /*Определениe формата выгрузки отчета в зависимости от типа отчета*/ string format = ""; if (isSqlReportingServices == 0) { var webReportPlugin = (IWebReportPlugin)webReportManager.Plugin; var stiPlugin = (IStimulsoftReportPlugin)webReportPlugin; var expToWord = !string.IsNullOrEmpty(Request.QueryString["expword"]); if (!expToWord && stiPlugin.AutoExportTo == null) { format = Request.QueryString["expword"]; } else if (stiPlugin.AutoExportTo != null) { format = stiPlugin.AutoExportTo.Value.ToString(); } } else { format = Request.QueryString["rs:format"]; } /**/ url.CustomQueryParameters.Add("format", format); Page.Response.Redirect(url.CreateUrl(false, true)); } } }