public static Committee AddEditCommittee(Committee committee, string xmlFileName)
 {
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(xmlFileName);
         XmlNode CommitteesNode = xdoc.SelectSingleNode("//Committees");
         XmlNode committeeNode;
         if (committee.CommitteeId == null)
         {
             committeeNode = xdoc.CreateElement("Committee");
             committee.CommitteeId = Guid.NewGuid().ToString();
             XmlAttribute committeeId = xdoc.CreateAttribute("Id"); committeeId.InnerText = committee.CommitteeId; committeeNode.Attributes.Append(committeeId);
             XmlAttribute committeeName = xdoc.CreateAttribute("Name"); committeeName.InnerText = committee.CommitteeName; committeeNode.Attributes.Append(committeeName);
             XmlAttribute committeeType = xdoc.CreateAttribute("Type"); committeeType.InnerText = committee.CommitteeType; committeeNode.Attributes.Append(committeeType);
             XmlAttribute masonicYear = xdoc.CreateAttribute("MasonicYear"); masonicYear.InnerText = committee.MasonicYear; committeeNode.Attributes.Append(masonicYear);
             CommitteesNode.AppendChild(committeeNode);
         }
         else
         {
             committeeNode = xdoc.SelectSingleNode("//Committees//Committee[@Id='" + committee.CommitteeId + "']");
             committeeNode.Attributes["Name"].InnerText = committee.CommitteeName;
             committeeNode.Attributes["Type"].InnerText = committee.CommitteeType;
             committeeNode.Attributes["MasonicYear"].InnerText = committee.MasonicYear;
         }
         xdoc.Save(xmlFileName);
     }
     catch (Exception ex) { committee.CommitteeId = "ERROR: " + ex.Message; }
     return committee;
 }
 public static Committee DeleteCommitteeMember(Committee committee, string xmlFileName)
 {
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(xmlFileName);
         XmlNode committeeNode = xdoc.SelectSingleNode("//Committees/Committee[@Id='" + committee.CommitteeId + "']");
         XmlNode memberNode = committeeNode.SelectSingleNode("Member[@Id='" + committee.CommitteeMemberId + "']");
         committeeNode.RemoveChild(memberNode);
         xdoc.Save(xmlFileName);
     }
     catch (Exception ex) { committee.CommitteeId = "ERROR: " + ex.Message; }
     return committee;
 }
 public static Committee GetCommitteeMember(string  committeeId, string  committeeMemberId, string xmlFileName)
 {
     var committee = new Committee();
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(xmlFileName);
         XmlNode committeeNode = xdoc.SelectSingleNode("//Committees/Committee[@Id='" + committeeId + "']/Member[@Id='" + committeeMemberId + "']");
         committee.CommitteeId = committeeId;
         committee.CommitteeMemberId = committeeNode.Attributes["Id"].InnerText;
         committee.CommitteeMemberName = committeeNode.Attributes["Name"].InnerText;
         committee.CommitteeMemberType = committeeNode.Attributes["Type"].InnerText;
     }
     catch (Exception ex) { committee.CommitteeId = "ERROR: " + ex.Message; }
     return committee;
 }
 public JsonResult DeleteCommitteeMember(Committee committee)
 {
     var lodgeFileName = Server.MapPath("\\App_Data\\") + MasonMasterData.GetUserProfile(User.Identity.Name).DatabaseName;
     Committee committiee = CommitteeDataXml.DeleteCommitteeMember(committee, lodgeFileName);
     return Json(new { Data = committiee }, JsonRequestBehavior.AllowGet);
 }