public MainFile(string path, string fileName, BudgetFile budget, CategoryFile category, PaystubFile paystub) : base(path) { FileName = fileName; Budget = budget; Category = category; Paystub = paystub; }
private static CategoryFile OpenCategory(Message message, string path) { CategoryFile output = new CategoryFile(); XDocument doc = XDocument.Load(path); XElement root = doc.Element(Element.Root); output.CategoryName = root.Attribute(Element.CategoryName).Value; XElement incomeRoot = root.Element(Element.IncomeCategoryData); XElement[] incomeElements = incomeRoot.Descendants(Element.Category).ToArray(); XElement expenseRoot = root.Element(Element.ExpenseCategoryData); XElement[] expenseElements = expenseRoot.Descendants(Element.Category).ToArray(); if (incomeElements.Length > 0) { output.IncomeCategories = IterateCategoryData(incomeElements); } else { message("Income Categories are empty."); } if (expenseElements.Length > 0) { output.ExpenseCategories = IterateCategoryData(expenseElements); } return(output); }
private static XDocument WriteCategoryDoc(CategoryFile category) { return new XDocument(CreateDeclaration(), new XElement(Element.Root, new XAttribute(Element.CategoryName, category.CategoryName), EnumerateCategoryData(category.IncomeCategories, true), EnumerateCategoryData(category.ExpenseCategories, false) ) ); }