Blame view

Vrh.OneReport/XmlProcessing/FolderElement.cs 2.82 KB
ab9f2fbe   Schwirg László   Add project files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  using System.Xml.Linq;
  
  using Vrh.XmlProcessing;
  
  namespace Vrh.OneReport
  {
      /// <summary>
      /// A "DefaultFolder" elemet reprezentáló osztály.
      /// "General" és "Report" elemben is előfordul.
      /// </summary>
      public class FolderElement : XmlLinqBase
      {
          #region AttributeNames static class
          /// <summary>
          /// Az XML fájlban ilyen attribútum nevek találhatóak egy "Output" elemben.
          /// </summary>
          public static class AttributeNames
          {
              /// <summary>
              /// 'action' attribútum név.
              /// </summary>
              public const string EXPORT = "Export";
  
              /// <summary>
              /// 'file' attribútum név.
              /// </summary>
              public const string FILE = "File";
  
              /// <summary>
              /// 'folder' attribútum név.
              /// </summary>
              public const string RDL = "Rdl";
          }
          #endregion AttributeNames static class
  
          #region Properties
  
          /// <summary>
          /// Exportok számára alapértelmezett mappa.
          /// </summary>
          public string Export { get; set; }
  
          /// <summary>
          /// Az oputput-ok (riportok) számára alapértelmezett mappa.
          /// </summary>
          public string File { get; set; }
  
          /// <summary>
          /// Az RDL fájlok forrásmappája.
          /// </summary>
          public string Rdl { get; set; }
  
          #endregion Properties
  
          #region Constructor
          /// <summary>
          /// Példány létrehozása egy XElement alapján.
          /// </summary>
          /// <param name="xelement">A "DefaultFolder" elem.</param>
          /// <param name="defaultFolder">
          /// Egy FolderElement objektum, mely alapértelmezett értékeket tartalmaz.
          /// </param>
          public FolderElement(XElement xelement, FolderElement defaultFolder = null)
          {
              if (xelement != null)
              {
                  this.Export = GetValue(
                      xelement.Attribute(AttributeNames.EXPORT),
                      defaultFolder == null ? "" : defaultFolder.Export
                  );
                  this.File = GetValue(
                      xelement.Attribute(AttributeNames.FILE),
                      defaultFolder == null ? "" : defaultFolder.File
                  );
                  this.Rdl = GetValue(
                      xelement.Attribute(AttributeNames.RDL),
                      defaultFolder == null ? "" : defaultFolder.Rdl
                  );
              }
              else
              {
                  if (defaultFolder != null)
                  {
                      this.Export = defaultFolder.Export;
                      this.File = defaultFolder.File;
                      this.Rdl = defaultFolder.Rdl;
                  }
              }
          }
          #endregion Constructor
      }
  }