Beispiel #1
0
        public void DeleteHostingUnit(int hostingUnitId)
        {
            int index = HostingUnitsList.FindIndex(c => c.stSerialKey == hostingUnitId);

            if (index > -1)
            {
                HostingUnitsList.RemoveAt(index);
                //delete Prev items
                GalleryList.RemoveAll(c => c.HostingUnitId == hostingUnitId);
            }
            UpdateXml <HostingUnit>(HostingUnitsList);
            UpdateXml <GalleryImageItem>(GalleryList);
        }
Beispiel #2
0
        public void UpdatingHostingUnit(BE.HostingUnit hostingUnit)
        {
            var h = GetHostingUnitById(hostingUnit.stSerialKey);

            if (h != null)
            {
                h.HostingUnitName      = hostingUnit.HostingUnitName;
                h.Rooms                = hostingUnit.Rooms;
                h.SubArea              = hostingUnit.SubArea;
                h.OwnerId              = hostingUnit.OwnerId;
                h.Pool                 = hostingUnit.Pool;
                h.Adult                = hostingUnit.Adult;
                h.Area                 = hostingUnit.Area;
                h.Children             = hostingUnit.Children;
                h.ChildrensAttractions = hostingUnit.ChildrensAttractions;
                h.Garden               = hostingUnit.Garden;
                //h.
                h.Status = hostingUnit.Status;
                //h.DiaryState = hostingUnit.DiaryState;

                //delete Prev items
                GalleryList.RemoveAll(c => c.HostingUnitId == hostingUnit.stSerialKey);
                for (int i = 0; i < hostingUnit.TempImages.Count(); i++)
                {
                    int key = Configuration.ImageIdentity;
                    Configuration.ImageIdentity++;
                    GalleryImageItem ii = new GalleryImageItem()
                    {
                        HostingUnitId = hostingUnit.stSerialKey,
                        Id            = key,
                        Url           = hostingUnit.TempImages[i].Url
                    };
                    GalleryList.Add(ii);
                }
                UpdateXml <HostingUnit>(HostingUnitsList);
                UpdateXml <GalleryImageItem>(GalleryList);
            }
        }