Exemplo n.º 1
0
 public bool IsBookingAssociatedHostingUnit(long key)
 {
     return(XmlDataSource.LoadFromXML <List <Order> >(XO.OrderPath)
            .Where(item => item.HostingUnitKey == key)
            .Select(item => GetGuestRequest(item.GuestRequestKey))
            .Any(item => item.Status == StatusCode.Open));
 }
Exemplo n.º 2
0
 public bool IsBookingAssociatedHostingUnit(long key)
 {
     return(XmlDataSource.LoadFromXML <List <Order> >(XO.OrderPath)
            .Where(item => item.HostingUnitKey == key)
            .Select(item => GetClientRequest(item.GuestRequestKey))
            .Any(item => item.StatusRequest == Request_Status.Active));
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        public HostingUnit GetHostingUnit(int HKey)
        {
            HostingUnit hosting = XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath).Where(item => item.HostingUnitKey == HKey).FirstOrDefault();

            if (hosting == null)
            {
                throw new Exception("Unit with Key [" + HKey + "] does not exist");
            }
            return(hosting.Clone());
        }
Exemplo n.º 6
0
        public List <HostingUnit> Lunit(Func <HostingUnit, bool> predicat = null)
        {
            List <HostingUnit> hostingUnits = XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath);

            if (predicat == null)
            {
                return(hostingUnits);
            }
            var v = from item in hostingUnits
                    where predicat(item) == true
                    select item.Clone();

            return(v.ToList());
        }
Exemplo n.º 7
0
        public List <GuestRequest> LGrequest(Func <GuestRequest, bool> predicat = null)
        {
            List <GuestRequest> guestRequests = XmlDataSource.LoadFromXML <List <GuestRequest> >(XG.GuestRequestPath);

            if (predicat == null)
            {
                return(guestRequests);
            }
            var v = from item in guestRequests
                    where predicat(item) == true
                    select item.Clone();

            return(v.ToList());
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 public HostingUnit GetHostingUnit(long key)
 {
     return(XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath).Where(item => item.HostingUnitKey == key).FirstOrDefault());
     //XH.GetHostingUnit(key);
 }
Exemplo n.º 10
0
 public List <HostingUnit> GetAllHostingUnits()
 {
     return(XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath));
 }
Exemplo n.º 11
0
 public List <GuestRequest> GetAllGuestRequests()
 {
     return(XmlDataSource.LoadFromXML <List <GuestRequest> >(XG.GuestRequestPath));
 }
Exemplo n.º 12
0
 public bool IsUnitExist(long key)
 {
     return(XmlDataSource.LoadFromXML <List <HostingUnit> >(HostingUnitPath).Any(item => item.HostingUnitKey == key));
 }