Пример #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();
 }
Пример #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());
        }
Пример #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);
        }
Пример #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;
 }
Пример #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);
        }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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);
        }
Пример #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);
 }
Пример #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;
 }
Пример #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);
        }
Пример #13
0
 public string GetLine(ReportTemplateParser parser)
 {
     return(ConstructLine(parser, Part, Text ?? String.Empty));
 }
Пример #14
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     return new Lines();
 }
Пример #15
0
 public string GetLine(ReportTemplateParser parser)
 {
     return ConstructLine(parser, Part, Text ?? String.Empty);
 }
Пример #16
0
 public override Table[] GetTables(ReportTemplateParser parser)
 {
     Lines = new Lines();
     Lines.AddRange(ReportTemplate.ConstructHeader(Body));
     return new[] {this};
 }
Пример #17
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     return(new Lines());
 }
Пример #18
0
 public override Table[] GetTables(ReportTemplateParser parser)
 {
     Lines = new Lines();
     Lines.AddRange(ReportTemplate.ConstructHeader(Body));
     return(new[] { this });
 }