public void initilizeListToXml() { XmlDataSource.SaveToXML <List <HostingUnit> >(DataSource.HostingUnitsCollection, HostingUnitPath); // XmlDataSource.SaveToXML<List<GuestRequest>>(DataSource.GuestRequestsCollection ,XG.GuestRequestPath); //XmlDataSource.SaveToXML<List<Order>>(DataSource.OrdersCollection,XO.OrderPath); //XC.AddConfiguration(); }
public void RemoveUnit(HostingUnit hostingUnit) { List <HostingUnit> lis = XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath); lis.RemoveAll(item => item.HostingUnitKey == hostingUnit.HostingUnitKey); XmlDataSource.SaveToXML <List <HostingUnit> >(lis, HostingUnitPath); }
public void initilizeListToXml() { XmlDataSource.SaveToXML <List <HostingUnit> >(DataSource.ListHostingUnits, HostingUnitPath); XmlDataSource.SaveToXML <List <GuestRequest> >(DataSource.ListGuestRequest, XG.GuestRequestPath); XmlDataSource.SaveToXML <List <Order> >(DataSource.ListOrder, XO.OrderPath); XC.AddConfiguration(); }
public bool DeleteHostingUnit(HostingUnit Dunit) { List <HostingUnit> lis = XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath); lis.RemoveAll(item => item.HostingUnitKey == Dunit.HostingUnitKey); XmlDataSource.SaveToXML <List <HostingUnit> >(lis, HostingUnitPath); return(true); }
public long AddUnit(HostingUnit hostingUnit) { HostingUnit hostingUnitCopy = (HostingUnit)hostingUnit.Clone(); hostingUnitCopy.HostingUnitKey = XC.GetConfiguration <long>("HostUnitKey"); DataSource.HostingUnitsCollection.Add(hostingUnitCopy); XmlDataSource.SaveToXML <List <HostingUnit> >(DataSource.HostingUnitsCollection, HostingUnitPath); XC.UpdateConfiguration <long>("HostUnitKey", (hostingUnitCopy.HostingUnitKey + 1)); return(hostingUnitCopy.HostingUnitKey); //XH.AddUnit(hostingUnit); }
public bool AddHostingUnit(HostingUnit hostingUnit) { HostingUnit hostingUnitCopy = (HostingUnit)hostingUnit.Clone(); hostingUnitCopy.HostingUnitKey = XC.GetConfiguration <int>("HostUnitKey"); List <HostingUnit> unitList = Lunit(); unitList.Add(hostingUnitCopy); XmlDataSource.SaveToXML <List <HostingUnit> >(unitList, HostingUnitPath); XC.UpdateConfiguration <int>("HostUnitKey", (hostingUnitCopy.HostingUnitKey + 1)); return(true); }
public void UpdateUnit(HostingUnit hostingUnit) { List <HostingUnit> lis = XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath); HostingUnit unit = lis.FirstOrDefault(item => item.HostingUnitKey == hostingUnit.HostingUnitKey); foreach (var Property in unit.GetType().GetProperties()) { ParameterInfo[] myParameters = Property.GetIndexParameters(); if (myParameters.Length == 0) { Property.SetValue(unit, Property.GetValue(hostingUnit)); } } XmlDataSource.SaveToXML <List <HostingUnit> >(lis, HostingUnitPath); }