Beispiel #1
0
        private void WriteHeadings(System.IO.StreamWriter wr, PCAxis.Paxiom.PXModel model)
        {
            Variables heading = model.Meta.Heading;

            if (!(heading == null))
            {
                int[] subHeadings = new int[2];
                if ((heading.Count > 0))
                {
                    Array.Resize(ref subHeadings, heading.Count);
                }

                CalculateSubValues(heading, 0, ref subHeadings);
                int timesToWrite = 1;
                //  This keep track of the number of times the current heading shall be written
                int timesWritten = 0;
                //  This keep track of the number of times the current heading has been written
                for (int index = 0; (index
                                     <= (heading.Count - 1)); index++)
                {
                    wr.WriteLine("<tr>");
                    if ((model.Meta.Stub.Count > 0))
                    {
                        wr.WriteLine("<th></th>");
                    }

                    //  Write the heading
                    int valuesCount = heading[index].Values.Count;
                    for (int j = 0; (j
                                     <= (timesToWrite - 1)); j++)
                    {
                        Paxiom.Values headingValues = heading[index].Values;
                        for (int ix = 0; (ix
                                          <= (headingValues.Count - 1)); ix++)
                        {
                            if (index == heading.Count - 1)
                            {
                                wr.Write(@"<th scope=""col""");
                            }
                            else
                            {
                                wr.Write("<th colspan=");
                                wr.Write(subHeadings[index]);
                            }



                            wr.Write(">");
                            wr.Write(headingValues[ix].Text);
                            wr.WriteLine("</th>");
                            timesWritten = (timesWritten + 1);
                        }
                    }

                    timesToWrite = timesWritten;
                    timesWritten = 0;
                    wr.WriteLine("</tr>");
                }
            }
        }
Beispiel #2
0
        public override void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe)
        {
            if (query.Output.Params["layout"] == ChartTypes.CHART_COLUMNLINE)
            {
                ChartManager.Settings.IsColumnLine = true;
            }
            ChartManager.Settings.ChartType       = ChartSettings.ConvertToChartType(query.Output.Params["layout"], System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
            ChartManager.Settings.UseSettingTitle = true;
            //Custom chart title only works for the language that was selected when the saved query was created.
            if (query.Sources[0].Language.ToLower() == model.Meta.CurrentLanguage.ToLower())
            {
                ChartManager.Settings.Title = CheckParameter(query, "chart_title") ? query.Output.Params["chart_title"] : ChartManager.Settings.Title;
            }
            else
            {
                ChartManager.Settings.Title = model.Meta.Title;
            }
            ChartManager.Settings.Width            = CheckParameter(query, "chart_width") ? int.Parse(query.Output.Params["chart_width"]) : ChartManager.Settings.Width;
            ChartManager.Settings.Height           = CheckParameter(query, "chart_height") ? int.Parse(query.Output.Params["chart_height"]) : ChartManager.Settings.Height;
            ChartManager.Settings.LineThickness    = CheckParameter(query, "chart_linethickness") ? int.Parse(query.Output.Params["chart_linethickness"]) : ChartManager.Settings.LineThickness;
            ChartManager.Settings.TimeSortOrder    = CheckParameter(query, "chart_timesortorder") ? (ChartSettings.SortType)Enum.Parse(typeof(ChartSettings.SortType), query.Output.Params["chart_timesortorder"], true) : ChartManager.Settings.TimeSortOrder;
            ChartManager.Settings.LabelOrientation = CheckParameter(query, "chart_labelorientation") ? (ChartSettings.OrientationType)Enum.Parse(typeof(ChartSettings.OrientationType), query.Output.Params["chart_labelorientation"], true) : ChartManager.Settings.LabelOrientation;
            ChartManager.Settings.Guidelines       = CheckParameter(query, "chart_guidelines") ? (ChartSettings.GuidelinesType)Enum.Parse(typeof(ChartSettings.GuidelinesType), query.Output.Params["chart_guidelines"], true) : ChartManager.Settings.Guidelines;
            ChartManager.Settings.ShowLegend       = CheckParameter(query, "chart_showlegend") ? bool.Parse(query.Output.Params["chart_showlegend"]) : ChartManager.Settings.ShowLegend;
            ChartManager.Settings.LegendHeight     = CheckParameter(query, "chart_legendheight") ? int.Parse(query.Output.Params["chart_legendheight"]) : ChartManager.Settings.LegendHeight;

            base.Render(format, query, model, safe, GetFileExtension(format), GetMimeType(format));
        }
Beispiel #3
0
        public virtual void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe, string fileExtension, string mimeType)
        {
            if (!safe)
            {
                model.Meta.Notes.Add(new Note(LocalizationManager.GetLocalizedString("PxWebSavedQueryUnsafeMessage"), NoteType.Table, true));
            }
            var info = PCAxis.Web.Controls.CommandBar.Plugin.CommandBarPluginManager.GetFileType(format);

            PCAxis.Web.Core.ISerializerCreator creator = Activator.CreateInstance(Type.GetType(info.Creator)) as PCAxis.Web.Core.ISerializerCreator;

            if (!mimeType.Contains("json")) // json always use UTF8
            {
                HttpContext.Current.Response.Charset = model.Meta.CodePage;
            }

            HttpContext.Current.Response.ContentType = mimeType;
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + model.Meta.Matrix + "." + fileExtension);

            var serializer = creator.Create(format);

            using (MemoryStream ms = new MemoryStream())
            {
                serializer.Serialize(model, ms);
                ms.Position = 0;
                ms.WriteTo(HttpContext.Current.Response.OutputStream);
            }
        }
Beispiel #4
0
        public void Serialize(PCAxis.Paxiom.PXModel model, ResponseBucket cacheResponse)
        {
            cacheResponse.ContentType = "application/json; charset=" + System.Text.Encoding.UTF8.WebName;
            PCAxis.Paxiom.IPXModelStreamSerializer serializer = new PX.Serializers.Json.JsonSerializer();

            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
            {
                serializer.Serialize(model, stream);

                cacheResponse.ResponseData = stream.ToArray();
            }
        }
Beispiel #5
0
        public override void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe)
        {
            ChartManager.Settings.ChartType        = ChartSettings.ConvertToChartType(query.Output.Params["layout"], System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
            ChartManager.Settings.UseSettingTitle  = true;
            ChartManager.Settings.Title            = CheckParameter(query, "chart_title") ? query.Output.Params["chart_title"] : ChartManager.Settings.Title;
            ChartManager.Settings.Width            = CheckParameter(query, "chart_width") ? int.Parse(query.Output.Params["chart_width"]) : ChartManager.Settings.Width;
            ChartManager.Settings.Height           = CheckParameter(query, "chart_height") ? int.Parse(query.Output.Params["chart_height"]) : ChartManager.Settings.Height;
            ChartManager.Settings.LineThickness    = CheckParameter(query, "chart_linethickness") ? int.Parse(query.Output.Params["chart_linethickness"]) : ChartManager.Settings.LineThickness;
            ChartManager.Settings.TimeSortOrder    = CheckParameter(query, "chart_timesortorder") ? (ChartSettings.SortType)Enum.Parse(typeof(ChartSettings.SortType), query.Output.Params["chart_timesortorder"], true) : ChartManager.Settings.TimeSortOrder;
            ChartManager.Settings.LabelOrientation = CheckParameter(query, "chart_labelorientation") ? (ChartSettings.OrientationType)Enum.Parse(typeof(ChartSettings.OrientationType), query.Output.Params["chart_labelorientation"], true) : ChartManager.Settings.LabelOrientation;
            ChartManager.Settings.Guidelines       = CheckParameter(query, "chart_guidelines") ? (ChartSettings.GuidelinesType)Enum.Parse(typeof(ChartSettings.GuidelinesType), query.Output.Params["chart_guidelines"], true) : ChartManager.Settings.Guidelines;
            ChartManager.Settings.ShowLegend       = CheckParameter(query, "chart_showlegend") ? bool.Parse(query.Output.Params["chart_showlegend"]) : ChartManager.Settings.ShowLegend;
            ChartManager.Settings.LegendHeight     = CheckParameter(query, "chart_legendheight") ? int.Parse(query.Output.Params["chart_legendheight"]) : ChartManager.Settings.LegendHeight;

            base.Render(format, query, model, safe, GetFileExtension(format), GetMimeType(format));
        }
Beispiel #6
0
        private void WriteDataLine(System.IO.StreamWriter wr, PCAxis.Paxiom.PXModel model, System.Globalization.CultureInfo ci, int precision, int row)
        {
            string value;
            string n        = String.Empty;
            string dataNote = String.Empty;

            PCAxis.Paxiom.PXData data = model.Data;
            for (int c = 0; (c
                             <= (data.MatrixColumnCount - 1)); c++)
            {
                wr.Write("<td>");
                value = _fmt.ReadElement(row, c, ref n, ref dataNote);
                wr.Write(value);
                wr.WriteLine("</td>");
            }
        }
Beispiel #7
0
        public void Serialize(PCAxis.Paxiom.PXModel model, ResponseBucket cacheResponse)
        {
            if (_encoding == "base64")
            {
                cacheResponse.ContentType = "text/plain; charset=" + System.Text.Encoding.Default.WebName;
            }
            else
            {
                cacheResponse.ContentType = "image/png; charset=" + System.Text.Encoding.Default.WebName;
            }

            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
            {
                Serialize(model, stream);
                stream.Flush();
                cacheResponse.ResponseData = stream.ToArray();
            }
        }
Beispiel #8
0
        public virtual void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe)
        {
            //if (!safe)
            //{
            //    model.Meta.Notes.Add(new Note(LocalizationManager.GetLocalizedString("PxWebSavedQueryUnsafeMessage"), NoteType.Table, true));
            //}
            var info = PCAxis.Web.Controls.CommandBar.Plugin.CommandBarPluginManager.GetFileType(format);

            //PCAxis.Web.Core.ISerializerCreator creator = Activator.CreateInstance(Type.GetType(info.Creator)) as PCAxis.Web.Core.ISerializerCreator;

            //HttpContext.Current.Response.ContentType = info.MimeType;
            //HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + model.Meta.Matrix + "." + info.FileExtension);

            //var serializer = creator.Create(query.Output.Type);

            //using (MemoryStream ms = new MemoryStream())
            //{
            //    serializer.Serialize(model, ms);
            //    ms.Position = 0;
            //    ms.WriteTo(HttpContext.Current.Response.OutputStream);
            //}
            Render(format, query, model, safe, info.FileExtension, info.MimeType);
        }
Beispiel #9
0
 public abstract void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe);