Exemplo n.º 1
0
        public void ThisIsApart(int num)
        {
            var Apart = Living_Rooms.Where(x => x.Number == num);

            Apartament[] a = Apart.ToArray();
            IsApartament = a[0];
        }
Exemplo n.º 2
0
        public void LoadFiles()
        {
            string        path         = @"D:\ООП 4 сем\LabProject\LabProject\Files\";
            XmlSerializer formForERoom = new XmlSerializer(typeof(EntertaimentRoom[]));
            XmlSerializer formForLRoom = new XmlSerializer(typeof(Apartament[]));
            XmlSerializer formForStaff = new XmlSerializer(typeof(Personal[]));
            XmlSerializer formForGuest = new XmlSerializer(typeof(Guest[]));

            using (FileStream fs = new FileStream(path + "Staff.xml", FileMode.OpenOrCreate))
            {
                Personal[] MyStaff = (Personal[])formForStaff.Deserialize(fs);

                Staff.Clear();
                foreach (var p in MyStaff)
                {
                    Staff.Add(p);
                }
            }

            using (FileStream fs = new FileStream(path + "Guest.xml", FileMode.OpenOrCreate))
            {
                Guest[] MyGuest = (Guest[])formForGuest.Deserialize(fs);

                List_Of_Order.Clear();
                foreach (var p in MyGuest)
                {
                    List_Of_Order.Add(p);
                }
            }

            using (FileStream fs = new FileStream(path + "ERoom.xml", FileMode.OpenOrCreate))
            {
                EntertaimentRoom[] MyERoom = (EntertaimentRoom[])formForERoom.Deserialize(fs);

                All_Servise_Room.Clear();
                Entertaiment_Room.Clear();
                foreach (var p in MyERoom)
                {
                    All_Servise_Room.Add(p);
                    Entertaiment_Room.Add(p.Name, p);
                }
            }
            using (FileStream fs = new FileStream(path + "LRoom.xml", FileMode.OpenOrCreate))
            {
                Apartament[] MyLRoom = (Apartament[])formForLRoom.Deserialize(fs);

                Living_Rooms.Clear();
                foreach (var p in MyLRoom)
                {
                    Living_Rooms.Add(p);
                }

                ClearListLivingRoom();
                AddListLiving();
            }
        }
Exemplo n.º 3
0
        public void ViewFreeRooms()
        {
            Free_Rooms.Clear();
            var frooms = Living_Rooms.Where(x => !x.use);

            foreach (var r in frooms)
            {
                Free_Rooms.Add(r);
            }
        }
Exemplo n.º 4
0
        public void SaveFile()
        {
            string        path         = @"D:\ООП 4 сем\LabProject\LabProject\Files\";
            XmlSerializer formForERoom = new XmlSerializer(typeof(EntertaimentRoom[]));
            XmlSerializer formForLRoom = new XmlSerializer(typeof(Apartament[]));
            XmlSerializer formForStaff = new XmlSerializer(typeof(Personal[]));
            XmlSerializer formForGuest = new XmlSerializer(typeof(Guest[]));

            DirectoryInfo dirInfo = new DirectoryInfo(path);

            foreach (FileInfo file in dirInfo.GetFiles())
            {
                file.Delete();
            }


            using (FileStream fs = new FileStream(path + "ERoom.xml", FileMode.OpenOrCreate))
            {
                formForERoom.Serialize(fs, All_Servise_Room.ToArray());
            }

            using (FileStream fs = new FileStream(path + "LRoom.xml", FileMode.OpenOrCreate))
            {
                formForLRoom.Serialize(fs, Living_Rooms.ToArray());
            }

            using (FileStream fs = new FileStream(path + "Staff.xml", FileMode.OpenOrCreate))
            {
                formForStaff.Serialize(fs, Staff.ToArray());
            }

            using (FileStream fs = new FileStream(path + "Guest.xml", FileMode.OpenOrCreate))
            {
                formForGuest.Serialize(fs, List_Of_Order.ToArray());
            }
        }