public static XmlElement ToXmlNode(OftenSeat oftenSeat) { XmlDocument doc = new XmlDocument(); XmlElement secNode = doc.CreateElement("OftenSeat"); secNode.InnerText = ConfigConvert.ConvertToString(oftenSeat.Used); secNode.SetAttribute("LengthTime", oftenSeat.LengthDays.ToString()); secNode.SetAttribute("SeatCount", oftenSeat.SeatCount.ToString()); return(secNode); }
public static OftenSeat ToObject(XmlNode node) { OftenSeat oftenSeat = new OftenSeat(); if (node != null) { oftenSeat.Used = ConfigConvert.ConvertToBool(node.InnerText); oftenSeat.LengthDays = int.Parse(node.Attributes["LengthTime"].Value); oftenSeat.SeatCount = int.Parse(node.Attributes["SeatCount"].Value); } return(oftenSeat); }