Esempio n. 1
0
        // Add the views
        public virtual void AddViews()
        {
            if (_report == null)
            {
                return;
            }

            // Sanity clear
            _report.Views.Clear();

            var rootView = _report.AddRootView();

            rootView.SortOrder = _report.Views.Count > 0 ? _report.Views.Max(i => i.SortOrder) + 1 : 1;
            rootView.Name      = Seal.Helpers.Helper.GetUniqueName("View", (from i in _report.Views select i.Name).ToList());

            var containerView = _report.AddChildView(rootView, "Container");

            containerView.InitParameters(false);
            containerView.Parameters.FirstOrDefault(p => p.Name == "grid_layout").Value = "col-sm-4;col-sm-4;col-sm-4";

            foreach (var model in _report.Models)
            {
                AddModelView(containerView, model);
            }
        }
Esempio n. 2
0
        public static void AddViews(Report report)
        {
            var rootView = report.AddRootView();

            rootView.SortOrder = report.Views.Count > 0 ? report.Views.Max(i => i.SortOrder) + 1 : 1;
            rootView.Name      = Helper.GetUniqueName("View", (from i in report.Views select i.Name).ToList());

            var containerView = report.AddChildView(rootView, "Container");

            containerView.InitParameters(false);
            containerView.Parameters.FirstOrDefault(p => p.Name == "grid_layout").Value = "col-sm-4;col-sm-4;col-sm-4";

            foreach (var model in report.Models)
            {
                var modelView = report.AddChildView(containerView, ReportViewTemplate.ModelName);
                modelView.Views.RemoveRange(0, modelView.Views.Count);                 // Supprimer les vues par défaut ajoutées lorsque c'est le template Model
                modelView.Name      = model.Name;
                modelView.ModelGUID = model.GUID;

                var chartJSView = report.AddChildView(modelView, ReportViewTemplate.ChartJSName);

                chartJSView.InitParameters(false);
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_doughnut").BoolValue        = true;
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_show_legend").BoolValue     = true;
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_legend_position").TextValue = "bottom";
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_colors").Value = GetColor(model.Name);
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_options_circumference").Value = "1.25*Math.PI";
                chartJSView.Parameters.FirstOrDefault(p => p.Name == "chartjs_options_rotation").Value      = "0.5*Math.PI";
            }
        }