public string PostDuesPayment(DuesPayment duesPayment)
 {
     string lodgeFileName = Server.MapPath("\\App_Data\\") + MasonMasterData.GetUserProfile(User.Identity.Name).DatabaseName;
     var d = new List<DuesPayment>(); d.Add(duesPayment);
     string success = CashDataXml.PostDuesPayment(d, lodgeFileName);
     return success;
 }
 public static List<DuesPayment> GetDuesGrid(string masonicYear, string xmlFileName)
 {
     var duesPayments = new List<DuesPayment>();
     string personId; string firstName; string middleName; string lastName;
     XmlNode duesPaymentNode; XmlNode personNode;
     XmlDocument xdoc = new XmlDocument();
     xdoc.Load(xmlFileName);
     XmlNodeList members = xdoc.SelectNodes("//Members/Member");
     string currentStatus = "";
     string[] desiredStatuses = new[] { "MBA", "MBC", "MBD", "MBG", "MBH", "MBI", "MBE", "MBJ", "LIF" };
     //{ "Active", "Endowed Member", "Elected", "Life Member", "Entered Apprentice", "Fellowcraft", "Life & Endowed Mbr", "Petition Read" };
     foreach (XmlNode memberNode in members)
     {
         currentStatus = memberNode.Attributes["Status"].InnerText;
         if (desiredStatuses.Contains(currentStatus))
         {
             var duesPayment = new DuesPayment();
             duesPaymentNode = memberNode.SelectSingleNode("DuesPayments/Payment[@MasonicYear='" + masonicYear + "']");
             if (duesPaymentNode != null)
             {
                 duesPayment.DuesPaymentId = duesPaymentNode.Attributes["PaymentId"].InnerText;
                 duesPayment.Amount = duesPaymentNode.Attributes["Amount"].InnerText;
                 duesPayment.PostedDate = duesPaymentNode.Attributes["PostedDate"].InnerText;
             }
             else
             {
                 duesPayment.Amount = "";
                 duesPayment.PostedDate = "";
             }
             duesPayment.CurrentStatus = xdoc.SelectSingleNode("//Refs/refItem[@refCode='" + currentStatus + "']").Attributes["refDescription"].InnerText;
             duesPayment.MasonId = int.Parse(memberNode.Attributes["MasonId"].InnerText);
             personId = memberNode.Attributes["PersonId"].InnerText;
             personNode = xdoc.SelectSingleNode("//People/Person[@PersonId='" + personId + "']");
             firstName = personNode.Attributes["FirstName"].InnerText;
             lastName = personNode.Attributes["LastName"].InnerText;
             middleName = personNode.Attributes["MiddleName"].InnerText;
             duesPayment.FullName = firstName + (middleName == "" ? " " : " " + middleName + " ") + lastName;
             duesPayments.Add(duesPayment);
         }
     }
     return duesPayments;
 }
 public static IList<DuesPayment> GetDuesHistory(int masonId, string xmlFileName)
 {
     var duesPayments = new List<DuesPayment>();
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(xmlFileName);
         XmlNode DuesPaymentsNode = xdoc.SelectSingleNode("//Members//Member[@MasonId='" + masonId + "']//DuesPayments");
         if (DuesPaymentsNode != null)
         {
             foreach (XmlNode payment in DuesPaymentsNode.ChildNodes)
             {
                 var duesPayment = new DuesPayment();
                 duesPayment.DuesPaymentId = payment.Attributes["PaymentId"].InnerText;
                 duesPayment.MasonicYear = xdoc.SelectSingleNode("//Refs/refItem[@refCode='" + payment.Attributes["MasonicYear"].InnerText + "']").Attributes["refDescription"].InnerText;
                 duesPayment.Amount = payment.Attributes["Amount"].InnerText;
                 duesPayment.PostedDate = payment.Attributes["PostedDate"].InnerText;
                 duesPayments.Add(duesPayment);
             }
         }
     }
     catch (Exception ex) { duesPayments.Add(new DuesPayment() { MasonicYear = ex.Message }); }
     return duesPayments;
 }