Ejemplo n.º 1
0
 public override Table[] GetTables(ReportTemplateParser parser)
 {
     var resultTables = new List<Table>();
     try
     {
         if (Body != null)
         {
             parser.RunFor(Each, In,
                           delegate
                           {
                               foreach (Table tableTemplate in Body)
                               {
                                   var table = new Table
                                                   {
                                                       Columns = tableTemplate.Columns,
                                                       IsDotted = tableTemplate.IsDotted,
                                                       Lines = new Lines()
                                                   };
                                 table.Lines.AddRange(ReportTemplate.ConstructHeader(tableTemplate.Body));
                                   resultTables.Add(table);
                               }
                           });
         }
     }
     catch (ReportTemplateParserException pex)
     {
         throw new ApplicationException("Ошибка построения тела таблицы", pex);
     }
     return resultTables.ToArray();
 }
Ejemplo n.º 2
0
        public override Table[] GetTables(ReportTemplateParser parser)
        {
            var resultTables = new List <Table>();

            try
            {
                if (Body != null)
                {
                    parser.RunFor(Each, In,
                                  delegate
                    {
                        foreach (Table tableTemplate in Body)
                        {
                            var table = new Table
                            {
                                Columns  = tableTemplate.Columns,
                                IsDotted = tableTemplate.IsDotted,
                                Lines    = new Lines()
                            };
                            table.Lines.AddRange(ReportTemplate.ConstructHeader(tableTemplate.Body));
                            resultTables.Add(table);
                        }
                    });
                }
            }
            catch (ReportTemplateParserException pex)
            {
                throw new ApplicationException("Ошибка построения тела таблицы", pex);
            }
            return(resultTables.ToArray());
        }
Ejemplo n.º 3
0
        public override Lines ConstructContent(ReportTemplateParser parser)
        {
            var lines = new Lines();

            try
            {
                if (Body != null)
                {
                    parser.RunFor(Each, In,
                                  delegate
                    {
                        foreach (BasePlainElement element in Body)
                        {
                            lines.AddRange(element.ConstructContent(parser));
                        }
                    });
                }
            }
            catch (ReportTemplateParserException pex)
            {
                lines.Add(new ReportLine(
                              new[] { "-+- FOR: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-" },
                              LineAlign.Left, "0", false, false, false, false, -1));
            }
            return(lines);
        }
Ejemplo n.º 4
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     try
     {
         if (Body != null)
         {
             parser.RunFor(Each, In,
                           delegate
                               {
                                   foreach (BasePlainElement element in Body)
                                   {
                                       lines.AddRange(element.ConstructContent(parser));
                                   }
                               });
         }
     }
     catch (ReportTemplateParserException pex)
     {
         lines.Add(new ReportLine(
             new[] {"-+- FOR: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-" },
             LineAlign.Left, "0", false, false, false, false, -1));
     }
     return lines;
 }
Ejemplo n.º 5
0
        public override Lines ConstructContent(ReportTemplateParser parser)
        {
            var lines = new Lines();

            if (parser.Check(Condition, Not))
            {
                if (Columns == null || Columns.Length <= 0)
                {
                    var text = new[]
                    {
                        parser.Format(LinePart.ConstructLine(parser, Part, Text ?? String.Empty))
                    };
                    if (!string.IsNullOrEmpty(SplitChar))
                    {
                        text = text[0].Split(SplitChar.ToCharArray());
                    }
                    foreach (string s in text)
                    {
                        lines.Add(
                            new ReportLine(new[] { NeedTrim?s.Trim() : s },
                                           Align ?? LineAlign.Left,
                                           FontSize, IsBold, IsItalic, false, false, IsLineDotted));
                    }
                }
                else
                {
                    var columns = new ArrayList();
                    foreach (LinePart t in Columns)
                    {
                        if (parser.Check(t.Condition, t.Not))
                        {
                            if (t.In != null && t.Each != null)
                            {
                                parser.RunFor(t.Each, t.In,
                                              () => columns.Add(parser.Format(
                                                                    LinePart.ConstructLine
                                                                        (parser, t.Part, t.Text ?? String.Empty))));
                            }
                            else
                            {
                                columns.Add(parser.Format(
                                                LinePart.ConstructLine(parser, t.Part, t.Text ?? String.Empty)));
                            }
                        }
                    }
                    var arr = new string[columns.Count];
                    columns.CopyTo(arr);
                    lines.Add(new ReportLine(arr,
                                             Align ?? LineAlign.Left,
                                             FontSize, IsBold, IsItalic, NewPage, ResetPageNumber, IsLineDotted));
                }
            }
            return(lines);
        }
Ejemplo n.º 6
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     if (parser.Check(Condition, Not))
     {
         if (Columns == null || Columns.Length <= 0)
         {
             var text = new[]
             {
                 parser.Format(LinePart.ConstructLine(parser, Part, Text ?? String.Empty))
             };
             if (!string.IsNullOrEmpty(SplitChar))
             {
                 text = text[0].Split(SplitChar.ToCharArray());
             }
             foreach (string s in text)
             {
                 lines.Add(
                     new ReportLine(new[] {NeedTrim ? s.Trim() : s},
                                    Align ?? LineAlign.Left,
                                    FontSize, IsBold, IsItalic, false, false, IsLineDotted));
             }
         }
         else
         {
             var columns = new ArrayList();
             foreach (LinePart t in Columns)
             {
                 if (parser.Check(t.Condition, t.Not))
                 {
                     if (t.In != null && t.Each != null)
                     {
                         parser.RunFor(t.Each, t.In,
                                       () => columns.Add(parser.Format(
                                           LinePart.ConstructLine
                                               (parser, t.Part, t.Text ?? String.Empty))));
                     }
                     else
                     {
                         columns.Add(parser.Format(
                             LinePart.ConstructLine(parser, t.Part, t.Text ?? String.Empty)));
                     }
                 }
             }
             var arr = new string[columns.Count];
             columns.CopyTo(arr);
             lines.Add(new ReportLine(arr,
                                      Align ?? LineAlign.Left,
                                      FontSize, IsBold, IsItalic, NewPage, ResetPageNumber, IsLineDotted));
         }
     }
     return lines;
 }
Ejemplo n.º 7
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     Lines lines = new Lines();
     int rowNumber = 0;
     if (!Int32.TryParse(Value, out rowNumber))
     {
         if (!Int32.TryParse(parser.Format(Value), out rowNumber))
         {
             rowNumber = 0;
         }
     }
     lines.Add(new ServiceLine(rowNumber));
     return lines;
 }
Ejemplo n.º 8
0
 public static string ConstructLine(ReportTemplateParser parser, LinePart[] parts, string defaultText)
 {
     if (parts != null && parts.Length > 0)
     {
         defaultText = "";
         foreach (LinePart part in parts)
         {
             if (parser.Check(part.Condition, part.Not))
             {
                 defaultText += part.GetLine(parser);
             }
         }
     }
     return defaultText;
 }
Ejemplo n.º 9
0
        public override Lines ConstructContent(ReportTemplateParser parser)
        {
            Lines lines     = new Lines();
            int   rowNumber = 0;

            if (!Int32.TryParse(Value, out rowNumber))
            {
                if (!Int32.TryParse(parser.Format(Value), out rowNumber))
                {
                    rowNumber = 0;
                }
            }
            lines.Add(new ServiceLine(rowNumber));
            return(lines);
        }
Ejemplo n.º 10
0
 public static string ConstructLine(ReportTemplateParser parser, LinePart[] parts, string defaultText)
 {
     if (parts != null && parts.Length > 0)
     {
         defaultText = "";
         foreach (LinePart part in parts)
         {
             if (parser.Check(part.Condition, part.Not))
             {
                 defaultText += part.GetLine(parser);
             }
         }
     }
     return(defaultText);
 }
Ejemplo n.º 11
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     try
     {
         BasePlainElement[] branch = parser.Check(Condition, Not) ? Then : Else;
         if (branch != null)
         {
             foreach (BasePlainElement element in branch)
             {
                 lines.AddRange(element.ConstructContent(parser));
             }
         }
     }
     catch (ReportTemplateParserException pex)
     {
         lines.Add(new ReportLine(
             new[]{"-+- IF: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-"},
             LineAlign.Left, "0", false, false, false, false, -1));
     }
     return lines;
 }
Ejemplo n.º 12
0
        public override Lines ConstructContent(ReportTemplateParser parser)
        {
            var lines = new Lines();

            try
            {
                BasePlainElement[] branch = parser.Check(Condition, Not) ? Then : Else;
                if (branch != null)
                {
                    foreach (BasePlainElement element in branch)
                    {
                        lines.AddRange(element.ConstructContent(parser));
                    }
                }
            }
            catch (ReportTemplateParserException pex)
            {
                lines.Add(new ReportLine(
                              new[] { "-+- IF: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-" },
                              LineAlign.Left, "0", false, false, false, false, -1));
            }
            return(lines);
        }
Ejemplo n.º 13
0
 public string GetLine(ReportTemplateParser parser)
 {
     return(ConstructLine(parser, Part, Text ?? String.Empty));
 }
Ejemplo n.º 14
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     return new Lines();
 }
Ejemplo n.º 15
0
 public string GetLine(ReportTemplateParser parser)
 {
     return ConstructLine(parser, Part, Text ?? String.Empty);
 }
Ejemplo n.º 16
0
 public override Table[] GetTables(ReportTemplateParser parser)
 {
     Lines = new Lines();
     Lines.AddRange(ReportTemplate.ConstructHeader(Body));
     return new[] {this};
 }
Ejemplo n.º 17
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     return(new Lines());
 }
Ejemplo n.º 18
0
 public override Table[] GetTables(ReportTemplateParser parser)
 {
     Lines = new Lines();
     Lines.AddRange(ReportTemplate.ConstructHeader(Body));
     return(new[] { this });
 }