Ejemplo n.º 1
0
 public MainFile(string path, string fileName, BudgetFile budget, CategoryFile category, PaystubFile paystub) : base(path)
 {
     FileName = fileName;
     Budget   = budget;
     Category = category;
     Paystub  = paystub;
 }
Ejemplo n.º 2
0
 private static XDocument WritePaystubDoc(PaystubFile paystub)
 {
     return new XDocument(CreateDeclaration(),
         new XElement(Element.Root, new XAttribute(Element.PaystubName, paystub.Name),
         new XAttribute(Element.PaystubDescription, paystub.Description),
         EnumeratePaystubData(paystub.Paystubs)
         )
     );
 }
Ejemplo n.º 3
0
        private static PaystubFile OpenPaystub(Message message, string path)
        {
            PaystubFile output = new PaystubFile();

            XDocument doc  = XDocument.Load(path);
            XElement  root = doc.Element(Element.Root);

            output.Name        = root.Attribute(Element.PaystubName).Value;
            output.Description = root.Attribute(Element.PaystubDescription).Value;

            XElement[] paystubElements = root.Descendants(Element.Paystub).ToArray();

            if (paystubElements.Length > 0)
            {
                output.Paystubs = IteratePaystubData(paystubElements);
            }
            else
            {
                message("Paystub data is empty.");
            }

            return(output);
        }