Пример #1
0
 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();
 }
Пример #2
0
        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);
        }
Пример #3
0
 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();
 }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }