/// <summary> /// Retrun the list of navigation links in the View context /// </summary> public List <NavigationLink> GetNavigationLinks(ReportView view) { var result = new List <NavigationLink>(); foreach (var link in Links) { if (link.Type == NavigationType.Drill && !view.IsDrillEnabled) { continue; } if (link.Type == NavigationType.SubReport && !view.IsSubReportsEnabled) { continue; } var newLink = new NavigationLink() { Cell = link.Cell, Href = link.Href, Parameters = link.Parameters, Report = link.Report, Tag = link.Tag, Text = link.Text, Type = link.Type }; Helper.CopyProperties(link, newLink); if (newLink.Type == NavigationType.Drill) { //Add the navigation if exists var modelView = view.ModelView; var navigationView = modelView.GetValue(Parameter.NavigationView); if (!string.IsNullOrEmpty(navigationView)) { newLink.Href += string.Format("&view={0}", modelView.GetValue(Parameter.NavigationView)); } } result.Add(newLink); } return(result); }
public static ReportView Create(ReportViewTemplate template) { ReportView result = new ReportView() { GUID = Guid.NewGuid().ToString(), TemplateName = template.Name }; return(result); }
void changeElementGUID(ReportElement element, string newGUID, ReportView view) { string initialLabel = element.DisplayNameEl; element.ChangeColumnGUID(newGUID); view.ReplaceInParameterValues("nvd3_chart_title", "%" + initialLabel + "%", "%" + element.DisplayNameEl + "%"); view.ReplaceInParameterValues("chartjs_title", "%" + initialLabel + "%", "%" + element.DisplayNameEl + "%"); view.ReplaceInParameterValues("plotly_title", "%" + initialLabel + "%", "%" + element.DisplayNameEl + "%"); }
public void InitTemplates(ReportView view, ref string errors) { view.InitParameters(false); if (!string.IsNullOrEmpty(view.Error)) { errors += string.Format("Error in view template '{0}': {1}\r\n", view.Name, view.Error); } foreach (var child in view.Views) { InitTemplates(child, ref errors); } }
/// <summary> /// True if the column has cells with navigation links /// </summary> public bool HasNavigation(ReportView view, int sourceRow, int col) { if (sourceRow == BodyStartRow - 1) { for (int row = BodyStartRow; row < BodyEndRow && col < ColumnCount; row++) { if (this[row, col].GetNavigationLinks(view).Count > 0) { return(true); } } } return(false); }
void setContext(ITypeDescriptorContext context) { _metaConnection = context.Instance as MetaConnection; _metaEnum = context.Instance as MetaEnum; _metaTable = context.Instance as MetaTable; _metaColumn = context.Instance as MetaColumn; _metaJoin = context.Instance as MetaJoin; _reportView = context.Instance as ReportView; _reportOutput = context.Instance as ReportOutput; _reportSchedule = context.Instance as ReportSchedule; _parameter = context.Instance as Parameter; _security = context.Instance as SealSecurity; _emailDevice = context.Instance as OutputEmailDevice; }
public bool IsAncestorOf(ReportView view) { bool result = false; foreach (ReportView child in Views) { if (child == view) { return(true); } result = child.IsAncestorOf(view); if (result) { break; } } return(result); }
public ReportView GetView(string viewId) { if (ViewId == viewId) { return(this); } ReportView result = null; foreach (var view in Views) { if (view.ViewId == viewId) { return(view); } result = view.GetView(viewId); if (result != null) { break; } } return(result); }
public static void PreLoadTemplates() { lock (_viewLock) { var templates = ViewTemplates; foreach (var template in templates) { if (!template.IsParsed) { template.ParseConfiguration(); } RazorHelper.Compile(template.Text, typeof(Report), template.CompilationKey); //Create a view to compile partial templates ReportView view = ReportView.Create(template); view.InitPartialTemplates(); foreach (var partialTemplate in view.PartialTemplates) { view.GetPartialTemplateKey(partialTemplate.Name, view); } } } }
void initTreeNodeViews(TreeNode node, ReportView view) { foreach (var childView in view.Views) { TreeNode childNode = new TreeNode(childView.Name); childNode.Tag = childView; node.Nodes.Add(childNode); initTreeNodeViews(childNode, childView); } }
public virtual void SetConfigurations(List <string> configurations, ReportView view) { }
/// <summary> /// Function to return partial table data to the report result /// </summary> public string GetLoadTableData(ReportView view, string parameter) { var model = view.ModelView.Model; var parameters = parameter.Replace("<", "<").Replace(">", ">").Split('§'); int echo = 1, len = 50, start = 0; string sort = "", search = ""; try { if (parameters.Length != 5) { throw new Exception("Invalid parameter size"); } echo = int.Parse(parameters[0]); sort = parameters[1]; search = parameters[2]; len = int.Parse(parameters[3]); start = int.Parse(parameters[4]); } catch (Exception ex) { Helper.WriteLogEntry("Seal Get Table Data", EventLogEntryType.Error, string.Format("GetLoadTableData-> Error in parameter:{0}\r\n{1}", parameter, ex.Message)); echo = 1; len = 50; start = 0; sort = ""; search = ""; } var sb = new StringBuilder(); sb.Append("\"aaData\": ["); //Check filter first if (search != _lastSearch || _filteredLines == null) { start = 0; _filteredLines = new List <ResultCell[]>(); var search2 = search.ToLower(); for (int row = BodyStartRow; row < BodyEndRow; row++) { ResultCell[] line = Lines[row]; bool filtered = false; if (string.IsNullOrEmpty(search)) { filtered = true; } else { for (int col = 0; col < line.Length && !filtered; col++) { ResultCell cell = line[col]; var cellValue = cell.HTMLValue; if (!string.IsNullOrEmpty(search) && HttpUtility.HtmlDecode(cellValue).ToLower().Contains(search2)) { filtered = true; break; } } } if (filtered) { _filteredLines.Add(line); } } } _lastSearch = search; //handle sort if (!string.IsNullOrEmpty(sort) && sort.Contains(",") && _filteredLines.Count > 0) { var sortIndex = int.Parse(sort.Split(',')[0]); var refLine = Lines[BodyStartRow]; //Handle hidden columns for (int col = 0; col < refLine.Length; col++) { if (col <= sortIndex && (view.IsColumnHidden(col) || IsColumnHidden(col))) { sortIndex++; } } if (sortIndex < refLine.Length) { //clear other sort foreach (var element in model.Elements) { element.FinalSortOrder = ""; } //set sort to the column, find the related element... foreach (var line in _filteredLines) { ResultCell cell = line[sortIndex]; if (cell.Element != null) { var ascdesc = (sort.ToLower().Contains("asc") ? ReportElement.kAscendantSortKeyword : ReportElement.kDescendantSortKeyword); cell.Element.FinalSortOrder = sortIndex + " " + ascdesc; break; } } } if (ResultCell.ShouldSort(_filteredLines)) { _filteredLines.Sort(ResultCell.CompareCellsForTableLoad); } } //build the json result if (len == -1) { start = 0; len = _filteredLines.Count; } var rowBodyClass = view.GetValue("data_table_body_class"); var rowBodyStyle = view.GetValue("data_table_body_css"); var rowSubClass = view.GetValue("data_table_subtotal_class"); var rowSubStyle = view.GetValue("data_table_subtotal_css"); for (int row = start; row < _filteredLines.Count && row < start + len; row++) { ResultCell[] line = _filteredLines[row]; if (row != start) { sb.Append(","); } sb.Append("["); for (int col = 0; col < line.Length; col++) { if (view.IsColumnHidden(col) || IsColumnHidden(col)) { continue; } ResultCell cell = line[col]; var cellValue = cell.HTMLValue; var fullValue = HttpUtility.JavaScriptStringEncode(string.Format("{0}§{1}§{2}§{3}§{4}§{5}", cell.IsSubTotal ? rowSubStyle : rowBodyStyle, cell.IsSubTotal ? rowSubClass : rowBodyClass, model.GetNavigation(cell, true), cell.CellCssStyle, cell.CellCssClass, cellValue)); sb.AppendFormat("\"{0}\",", fullValue); } sb.Length = sb.Length - 1; sb.Append("]"); } sb.Append("]}"); var sbFinal = new StringBuilder(); sbFinal.Append(@"{" + "\"sEcho\": " + echo.ToString() + ","); sbFinal.Append("\"recordsTotal\": " + _filteredLines.Count.ToString() + ","); sbFinal.Append("\"recordsFiltered\": " + _filteredLines.Count.ToString() + ","); sbFinal.Append("\"iTotalRecords\": " + (BodyEndRow - BodyStartRow).ToString() + ","); sbFinal.Append("\"iTotalDisplayRecords\": " + _filteredLines.Count.ToString() + ","); sbFinal.Append(sb); return(sbFinal.ToString()); }
public ReportView AddChildView(ReportView parent, ReportViewTemplate template) { if (Models.Count == 0) throw new Exception("Unable to create a view: No model available.\r\nPlease create a model first."); ReportView result = ReportView.Create(template); result.Name = Helper.GetUniqueName(template.Name + " View", (from i in parent.Views select i.Name).ToList()); result.Report = this; result.InitReferences(); result.SortOrder = parent.Views.Count > 0 ? parent.Views.Max(i => i.SortOrder) + 1 : 1; if (template.ForModel) result.ModelGUID = Models[0].GUID; parent.Views.Add(result); return result; }
public virtual void InitFromReferenceView(ReportView referenceView) { }
void checkRemoveModel(ReportView view, ReportModel model) { foreach (var childView in view.Views) { if (view.Views.Exists(i => i.ModelGUID == model.GUID)) throw new Exception(string.Format("The model '{0}' is already used by a view.", model.Name)); checkRemoveModel(childView, model); } }
void GetModelsToExecute(ReportView view, List<ReportModel> result) { if (view.Model != null && !result.Contains(view.Model)) result.Add(view.Model); foreach (var child in view.Views) GetModelsToExecute(child, result); }
public virtual void SetConfigurations(List<string> configurations, ReportView view) { }
public void RemoveView(ReportView parent, ReportView view) { if (parent == null) { foreach (ReportOutput output in Outputs) { if (output.ViewGUID == view.GUID) throw new Exception(string.Format("Unable to remove the view '{0}': This view is used by the output '{1}'.", view.Name, output.Name)); } if (Views.Count == 1) throw new Exception("Unable to remove the view: The report must contain at least one View."); Views.Remove(view); //Change the default view if necessary if (view.GUID == ViewGUID) ViewGUID = Views[0].GUID; } else parent.Views.Remove(view); }
void initTreeNodeViews(TreeNode node, ReportView view) { if (view != null) { foreach (var childView in view.Views) { TreeNode childNode = new TreeNode(childView.Name) { ImageIndex = 8, SelectedImageIndex = 8 }; childNode.Tag = childView; node.Nodes.Add(childNode); initTreeNodeViews(childNode, childView); } } }
static void getWidgets(List <DashboardWidget> widgets, Dictionary <string, DateTime> reports, ReportView view, Repository repository) { _widgets.RemoveAll(i => i.GUID == view.WidgetDefinition.GUID); if (!string.IsNullOrEmpty(view.WidgetDefinition.Name)) { view.WidgetDefinition.ReportPath = view.Report.FilePath.Replace(repository.ReportsFolder, ""); view.WidgetDefinition.ReportName = view.Report.DisplayNameEx; view.WidgetDefinition.LastModification = view.Report.LastModification; if (string.IsNullOrEmpty(view.WidgetDefinition.Description)) { view.WidgetDefinition.Description = ""; } widgets.Add(view.WidgetDefinition); } foreach (ReportView child in view.Views) { getWidgets(widgets, reports, child, repository); } }
void addViewsToDestinations(ReportView parentView, string prefix) { string name = string.Format("{0}/{1}", prefix, parentView.Name); if (_destinationItems.FirstOrDefault(i => i.Object == parentView) == null) { if (parentView != _source) { if (!addRadioButton.Checked || ((ReportView)_source).Template.ParentNames.Contains(parentView.Template.Name)) { _destinationItems.Add(new PropertyItem() { Name = name, Object = parentView }); } } foreach (var view in parentView.Views) addViewsToDestinations(view, name); } }
public void InitTemplates(ReportView view, ref string errors) { view.InitParameters(false); if (!string.IsNullOrEmpty(view.Error)) errors += string.Format("Error in view template '{0}': {1}\r\n", view.Name, view.Error); foreach (var child in view.Views) InitTemplates(child, ref errors); }
void exportViewsTranslations(ExecutionLogInterface log, ReportView view, Repository repository, StringBuilder translations, string reportPath, string separator, string extraSeparators, int len) { translations.AppendFormat("ReportViewName{0}{1}{0}{2}{3}\r\n", separator, Helper.QuoteDouble(reportPath.Substring(len)), Helper.QuoteDouble(view.Name), extraSeparators); foreach (var child in view.Views) { exportViewsTranslations(log, child, repository, translations, reportPath, separator, extraSeparators, len); } }
public static ReportView Create(ReportViewTemplate template) { ReportView result = new ReportView() { GUID = Guid.NewGuid().ToString(), TemplateName = template.Name }; return result; }
public bool IsAncestorOf(ReportView view) { bool result = false; foreach (ReportView child in Views) { if (child == view) return true; result = child.IsAncestorOf(view); if (result) break; } return result; }