Ejemplo n.º 1
0
 public void AddApartment(Apartment apartment)
 {
     if (Apartments == null)
     {
         Apartments = new List <Apartment>();
     }
     Apartments.Add(apartment);
     Document.SetPropertyValue("Apartments", Apartments);
 }
Ejemplo n.º 2
0
        public void LoadApartments()
        {
            Apartments.Add(new Apartment(1001, "street 1", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(1002, "street 2", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(1003, "street 2", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(2001, "street 1", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(2002, "street 2", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(2003, "street 2", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(3001, "street 1", 1, "3 star",
                                         new AparType(3, 3, 50, true, true, true, true, "very well located")));

            Apartments.Add(new Apartment(3002, "street 2", 1, "3 star",
                                         new FrCity {
                Name = "Marseille", ImageUrl = "../assets/Marsay.jpg"
            },
                                         new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                         new Owner("id 1", "mmm", "123456")));
            Apartments.Add(new Apartment(3003, "street 2", 1, "3 star",
                                         new FrCity {
                Name = "Marseille", ImageUrl = "../assets/Marsay.jpg"
            },
                                         new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                         new Owner("id 1", "ttt", "123456")));
            Apartments.Add(new Apartment(4001, "street 1", 1, "3 star",
                                         new FrCity {
                Name = "Montpellie", ImageUrl = "../assets/Nice.jpg"
            },
                                         new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                         new Owner("id 1", "ggg", "123456")));
            Apartments.Add(new Apartment(4002, "street 2", 1, "3 star",
                                         new FrCity {
                Name = "Nice", ImageUrl = "../assets/Nice.jpg"
            },
                                         new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                         new Owner("id 1", "sss", "123456")));
            Apartments.Add(new Apartment(4003, "street 2", 1, "3 star",
                                         new FrCity {
                Name = "Lion", ImageUrl = "../assets/Nice.jpg"
            },
                                         new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                         new Owner("id 1", "xxx", "123456")));
        }
Ejemplo n.º 3
0
 public void Add(Apartment apartment)
 {
     if (Apartments == null)
     {
         Apartments = new List <Apartment>();
     }
     if (Contain(apartment))
     {
         throw new InvalidOperationException("Apartment has already existed!");
     }
     Apartments.Add(apartment);
 }
Ejemplo n.º 4
0
        public Apartment AddApartment(Apartment apartment)
        {
            var user = Users.Where(u => u.IsDeleted == false && u.Username == apartment.Host.Username).FirstOrDefault();

            apartment.Host = user as Host;

            ICollection <Amenities> amenities = new List <Amenities>();

            foreach (var item in apartment.Amenities)
            {
                amenities.Add(Amenities.SingleOrDefault(a => item.Id == a.Id));
            }
            apartment.Amenities = amenities;

            Apartments.Add(apartment);
            SaveChanges();
            var apartment1 = Apartments.Where(a => a.Id == apartment.Id).FirstOrDefault();

            apartment1.PicturesLocation += $"{apartment.Id}";
            SaveChanges();
            return(apartment1);
        }
Ejemplo n.º 5
0
 public void AddApartment(Apartment apartment)
 {
     Apartments.Add(apartment);
 }
Ejemplo n.º 6
0
 public void AddApartments(Apartment apr)
 {
     Apartments.Add(apr);
 }
Ejemplo n.º 7
0
        private void InitializeApartments(IQueryable <Apartment> q)
        {
            using (var db = new DB.DomenaDBContext())
            {
                foreach (var apar in q)
                {
                    var a = new ApartmentDataGrid
                    {
                        ApartmentBinding                = apar.BindingParent,
                        BuildingName                    = db.Buildings.Where(x => x.BuildingId == apar.BuildingId).FirstOrDefault().Name,
                        BulidingAddress                 = db.Buildings.Where(x => x.BuildingId == apar.BuildingId).FirstOrDefault().GetAddress(),
                        ApartmentId                     = apar.ApartmentId,
                        ApartmentNumber                 = apar.ApartmentNumber,
                        ApartmentArea                   = apar.ApartmentArea,
                        ApartmentAdditionalArea         = apar.AdditionalArea,
                        ApartmentTotalArea              = apar.ApartmentArea + apar.AdditionalArea,
                        ApartmentOwner                  = db.Owners.Where(x => x.OwnerId == apar.OwnerId).FirstOrDefault().OwnerName,
                        ApartmentPercentageDistribution =
                            (100 * (apar.ApartmentArea + apar.AdditionalArea) /
                             db.Apartments
                             .Where(x => x.BuildingId == apar.BuildingId && !x.IsDeleted && x.SoldDate == null)
                             .Select(x => x.AdditionalArea + x.ApartmentArea)
                             .Sum()).ToString("0.00") + " %",
                        BoughtDate            = apar.BoughtDate,
                        ApartmentOwnerAddress = db.Owners.Where(x => x.OwnerId == apar.OwnerId).FirstOrDefault().MailAddress,
                        LocatorsAmount        = apar.Locators,
                        SoldDate = apar.SoldDate,

                        ApartmentAreaSeries = new SeriesCollection
                        {
                            new PieSeries
                            {
                                Title = "Powierzchnia mieszkania (m2)", Values = new ChartValues <ObservableValue> {
                                    new ObservableValue(apar.ApartmentArea)
                                },
                                LabelPoint = chartPoint => string.Format("{0} m2 ({1:P})", chartPoint.Y, chartPoint.Participation)
                            },

                            new PieSeries
                            {
                                Title = "Powierzchnie przynależne (m2)", Values = new ChartValues <ObservableValue> {
                                    new ObservableValue(apar.AdditionalArea)
                                },
                                LabelPoint = chartPoint => string.Format("{0} m2 ({1:P})", chartPoint.Y, chartPoint.Participation)
                            }
                        },

                        BuildingAreaSeries = new SeriesCollection
                        {
                            new PieSeries
                            {
                                Title = "Całkowita powierzchnia (m2)", Values = new ChartValues <ObservableValue> {
                                    new ObservableValue(apar.ApartmentArea + apar.AdditionalArea)
                                },
                                LabelPoint = chartPoint => string.Format("{0} m2 ({1:P})", chartPoint.Y, chartPoint.Participation)
                            },

                            new PieSeries
                            {
                                Title = "Reszta budynku (m2)", Values = new ChartValues <ObservableValue>
                                {
                                    new ObservableValue(
                                        db.Apartments.Where(x => x.BuildingId == apar.BuildingId && x.ApartmentId != apar.ApartmentId && x.IsDeleted == false && x.SoldDate == null).Select(x => x.ApartmentArea).DefaultIfEmpty(0).Sum() +
                                        db.Apartments.Where(x => x.BuildingId == apar.BuildingId && x.ApartmentId != apar.ApartmentId && x.IsDeleted == false && x.SoldDate == null).Select(x => x.AdditionalArea).DefaultIfEmpty(0).Sum()
                                        )
                                },
                                LabelPoint = chartPoint => string.Format("{0} m2 ({1:P})", chartPoint.Y, chartPoint.Participation)
                            }
                        },
                    };
                    a.Balance        = Math.Floor(100 * (Payments.CalculateSaldo(DateTime.Today.Year, db.Apartments.FirstOrDefault(x => x.ApartmentId.Equals(a.ApartmentId))))) / 100;
                    a.CostHistory    = new ObservableCollection <string>(db.Charges.Include(x => x.Components).Where(x => x.ApartmentId.Equals(a.ApartmentId) && !x.IsDeleted).OrderByDescending(x => x.ChargeDate).Take(5).ToList().Select(x => new { costConc = x.ChargeDate.ToString("dd-MM-yyyy") + " : " + x.Components.Select(y => y.Sum).DefaultIfEmpty(0).Sum() + " zł" }).Select(x => x.costConc).ToList());
                    a.PaymentHistory = new ObservableCollection <string>(db.Payments.Where(x => !x.IsDeleted && x.ApartmentId.Equals(a.ApartmentId)).OrderByDescending(x => x.PaymentRegistrationDate).Take(5).ToList().Select(x => new { paymConc = x.PaymentRegistrationDate.ToString("dd-MM-yyyy") + " : " + x.PaymentAmount + " zł" }).Select(x => x.paymConc).ToList());
                    Apartments.Add(a);
                }
            }
        }
 public void LoadApartments()
 {
     Apartments.Add(new Apartment(1001, "street 1", 1, "3 star",
                                  new FrCity {
         Name = "Paris", ImageUrl = "../assets/paris.jpg", Description = "Paris, France's capital, is a major European city and a global center for art, fashion, gastronomy and culture.", LongDescription = "France's capital, is a major European city and a global center for art, fashion, gastronomy and culture. Its 19th-century cityscape is crisscrossed by wide boulevards and the River Seine. Beyond such landmarks as the Eiffel Tower and the 12th-century, Gothic Notre-Dame cathedral, the city is known for its cafe culture and designer boutiques along the Rue du Faubourg Saint-Honoré."
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "Hansen", "123456")));
     Apartments.Add(new Apartment(1002, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Dingeo", ImageUrl = "../assets/Dingeo.jpg", Description = "The village of Dingé is a small french village located north west of France.", LongDescription = "The village of Dingé is a small french village located north west of France. The town of Dingé is located in the department of Ille-et-Vilaine of the french region Bretagne.	The town of Dingé is located in the township of Hédé part of the district of Rennes. The area code for Dingé is 35094 (also known as code INSEE), and the Dingé zip code is 35440. "
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "jacob", "123456")));
     Apartments.Add(new Apartment(1003, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Orange", ImageUrl = "../assets/Orange.jpg", Description = "*********************************"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "poul", "123456")));
     Apartments.Add(new Apartment(2001, "street 1", 1, "3 star",
                                  new FrCity {
         Name = "Nice", ImageUrl = "../assets/Nice.jpg", Description = "*************************************"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "Ib", "123456")));
     Apartments.Add(new Apartment(2002, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Cannes", ImageUrl = "../assets/Cannes.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "fff", "123456")));
     Apartments.Add(new Apartment(2003, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Nice", ImageUrl = "../assets/Nice.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "Hvvvansen", "123456")));
     Apartments.Add(new Apartment(3001, "street 1", 1, "3 star",
                                  new FrCity {
         Name = "Lion", ImageUrl = "../assets/Marsay.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "nnn", "123456")));
     Apartments.Add(new Apartment(3002, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Marseille", ImageUrl = "../assets/Marsay.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "mmm", "123456")));
     Apartments.Add(new Apartment(3003, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Marseille", ImageUrl = "../assets/Marsay.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "ttt", "123456")));
     Apartments.Add(new Apartment(4001, "street 1", 1, "3 star",
                                  new FrCity {
         Name = "Montpellie", ImageUrl = "../assets/Nice.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "ggg", "123456")));
     Apartments.Add(new Apartment(4002, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Nice", ImageUrl = "../assets/Nice.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "sss", "123456")));
     Apartments.Add(new Apartment(4003, "street 2", 1, "3 star",
                                  new FrCity {
         Name = "Lion", ImageUrl = "../assets/Nice.jpg"
     },
                                  new AparType(3, 3, 50, true, true, true, true, "very well located"),
                                  new Owner("id 1", "xxx", "123456")));
 }