Esempio n. 1
0
        public List <BookingSystemEntity> GetSuggestedServices(BookingSystemEntity bookingSystem)
        {
            var listOfServices = context.BookingSystems.Where(b => b.City == bookingSystem.City && b.BookningSystemId != bookingSystem.BookningSystemId &&
                                                              bookingSystem.ServiceType != b.ServiceType).ToList();

            return(listOfServices);
        }
Esempio n. 2
0
        public async void AddBookingSystem(BookingSystemEntity bookingSystem)
        {
            bookingSystem = await GetCoordinates(bookingSystem);

            var url = "http://localhost:60295/api/addbookingsystem";

            var content = new StringContent(JsonConvert.SerializeObject(bookingSystem), Encoding.UTF8, "application/json");
            var result  = await client.PostAsync(url, content);
        }
Esempio n. 3
0
        //hämtar kordinater för en adress
        public async Task <BookingSystemEntity> GetCoordinates(BookingSystemEntity system)
        {
            string cityName   = system.City;
            string streetName = system.Adress;

            string url      = $"https://maps.googleapis.com/maps/api/geocode/json?address={cityName}+{streetName}&key=AIzaSyAxzPnxjGlRXDkjvVNamfloAAx1eMYqyBw";
            var    response = await client.GetAsync(string.Format(url));

            string result = await response.Content.ReadAsStringAsync();

            RootObject root = JsonConvert.DeserializeObject <RootObject>(result);

            foreach (var item in root.results)
            {
                system.Latitude  = item.geometry.location.lat;
                system.Longitude = item.geometry.location.lng;
            }

            return(system);
        }
Esempio n. 4
0
 public async Task <IHttpActionResult> AddBookingSystem(BookingSystemEntity bookingSystem)
 {
     new BookingSystemRepo().AddBookingSystem(bookingSystem);
     return(Ok());
 }
Esempio n. 5
0
        public async Task <List <ArticleEntity> > GetArticlesFromBookingSystems(List <BookingSystemEntity> listOfBookingSystems, BookingTableEntity bookingTable, BookingSystemEntity bookingSystem)
        {
            var listOfArticles     = new List <ArticleEntity>();
            var tempListOfArticles = new List <ArticleEntity>();

            var article = await new ArticleRepo().GetArticleAsync(bookingTable.ArticleId);

            foreach (var item in listOfBookingSystems)
            {
                if (item.ServiceType == bookingSystem.ServiceType)
                {
                    tempListOfArticles = await new ArticleRepo().GetDifferentArticlesFromBookingSystem(item.BookningSystemId, article.Service);
                }

                else
                {
                    tempListOfArticles = await new ArticleRepo().GetArticlesFromBookingSystemAsync(item.BookningSystemId);
                }

                foreach (var i in tempListOfArticles)
                {
                    listOfArticles.Add(i);
                }
            }

            return(listOfArticles);
        }
Esempio n. 6
0
        public async Task <List <ArticleEntity> > ServiceTypeBeuty(List <BookingSystemEntity> listOfBookingSystem, BookingTableEntity bookingTable, BookingSystemEntity bookingSystem)
        {
            var listOfArticles = new List <ArticleEntity>();

            var hairdresserListOfBookingSystem = new List <BookingSystemEntity>();
            var massageListOfBookingSystem     = new List <BookingSystemEntity>();
            var beutySalonListOfBookingSystem  = new List <BookingSystemEntity>();

            foreach (var item in listOfBookingSystem)
            {
                if (item.ServiceType == 1)
                {
                    hairdresserListOfBookingSystem.Add(item);
                }

                if (item.ServiceType == 2)
                {
                    massageListOfBookingSystem.Add(item);
                }

                if (item.ServiceType == 3)
                {
                    beutySalonListOfBookingSystem.Add(item);
                }
            }

            var hairdresserListOfArticles = await GetArticlesFromBookingSystems(hairdresserListOfBookingSystem, bookingTable, bookingSystem);

            var massageListOfArticles = await GetArticlesFromBookingSystems(massageListOfBookingSystem, bookingTable, bookingSystem);

            var beutySalondListOfArticles = await GetArticlesFromBookingSystems(beutySalonListOfBookingSystem, bookingTable, bookingSystem);

            if (hairdresserListOfArticles.Count() > 0)
            {
                listOfArticles.Add(await RandomizeOneArticle(hairdresserListOfArticles));
            }

            if (massageListOfArticles.Count() > 0)
            {
                listOfArticles.Add(await RandomizeOneArticle(massageListOfArticles));
            }

            if (beutySalondListOfArticles.Count() > 0)
            {
                listOfArticles.Add(await RandomizeOneArticle(beutySalondListOfArticles));
            }

            return(listOfArticles);
        }
Esempio n. 7
0
        public async Task <List <ArticleEntity> > ServiceTypeCar(List <BookingSystemEntity> listOfBookingSystem, BookingTableEntity bookingTable, BookingSystemEntity bookingSystem)
        {
            var listOfArticles = new List <ArticleEntity>();

            var workshopListOfBookingSystem = new List <BookingSystemEntity>();
            var carWashListOfBookingSystem  = new List <BookingSystemEntity>();

            foreach (var item in listOfBookingSystem)
            {
                if (item.ServiceType == 4)
                {
                    workshopListOfBookingSystem.Add(item);
                }

                if (item.ServiceType == 5)
                {
                    carWashListOfBookingSystem.Add(item);
                }
            }

            var workshopListOfArticles = await GetArticlesFromBookingSystems(workshopListOfBookingSystem, bookingTable, bookingSystem);

            var carWashListOfArticles = await GetArticlesFromBookingSystems(carWashListOfBookingSystem, bookingTable, bookingSystem);

            if (workshopListOfArticles.Count() > 0)
            {
                listOfArticles.Add(await RandomizeOneArticle(workshopListOfArticles));
            }

            if (carWashListOfArticles.Count() > 0)
            {
                listOfArticles.Add(await RandomizeOneArticle(carWashListOfArticles));
            }

            return(listOfArticles);
        }
Esempio n. 8
0
        public int GetServiceType(BookingSystemEntity bookingSystem)
        {
            var serviceType = Convert.ToInt32(bookingSystem.ServiceType);

            return(serviceType);
        }
Esempio n. 9
0
        public async Task <List <BookingSystemEntity> > GetSuggestedServicesAsync(BookingSystemEntity bookingSystem)
        {
            var listOfServices = context.BookingSystems.Where(b => b.City == bookingSystem.City && b.BookningSystemId != bookingSystem.BookningSystemId).ToList();

            return(listOfServices);
        }
Esempio n. 10
0
 //Spara ett nytt bokningssystem
 public void AddBookingSystem(BookingSystemEntity bookingSystem)
 {
     context.BookingSystems.Add(bookingSystem);
     context.SaveChanges();
 }
Esempio n. 11
0
        protected override void Seed(ApplicationDbContext context)
        {
            var bookingsystem1 = new BookingSystemEntity()
            {
                ServiceType       = 4,
                BookningSystemId  = 1,
                SystemName        = "Bil och Däck",
                SystemDescription = "Verkstad",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.bilochdack.se",
                CompanyName       = "Bil och Däck",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Glanshammarsvägen 16",
                Latitude          = 59.294810,
                Longitude         = 15.231510,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem1);

            var bookingsystem2 = new BookingSystemEntity()
            {
                ServiceType       = 1,
                BookningSystemId  = 2,
                SystemName        = "Salong Klipp",
                SystemDescription = "Frisör",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.salongklipp.se",
                CompanyName       = "Salong Klipp",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Skolgatan 42",
                Latitude          = 59.280750,
                Longitude         = 15.223650,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem2);

            var bookingsystem3 = new BookingSystemEntity()
            {
                ServiceType       = 1,
                BookningSystemId  = 3,
                SystemName        = "Klipp och Trimm",
                SystemDescription = "Frisör",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.klippochtrimm.se",
                CompanyName       = "Klipp och Trimm",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Sandkullsvägen 24",
                Latitude          = 59.382580,
                Longitude         = 17.917903,
                PostaICode        = "703 64",
                City = "Stockholm",
            };

            context.BookingSystems.Add(bookingsystem3);

            var bookingsystem4 = new BookingSystemEntity()
            {
                ServiceType       = 2,
                BookningSystemId  = 4,
                SystemName        = "Saras Massage",
                SystemDescription = "Massage",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.sarasmassage.se",
                CompanyName       = "Saras Massage",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Glanshammarsvägen 16",
                Latitude          = 59.294810,
                Longitude         = 15.231510,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem4);

            var bookingsystem5 = new BookingSystemEntity()
            {
                ServiceType       = 3,
                BookningSystemId  = 5,
                SystemName        = "Stefans Skön och Fin",
                SystemDescription = "Skönhetssalong",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.stefansskonochfin.se",
                CompanyName       = "Stefans Skön och Fin",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Skolgatan 42",
                Latitude          = 59.281750,
                Longitude         = 15.223650,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem5);

            var bookingsystem6 = new BookingSystemEntity()
            {
                ServiceType       = 3,
                BookningSystemId  = 6,
                SystemName        = "Salong Finast",
                SystemDescription = "Skönhetssalong",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.salongfinast.se",
                CompanyName       = "Salong Finast",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Skolgatan 42",
                Latitude          = 59.280750,
                Longitude         = 15.233650,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem6);

            var bookingsystem7 = new BookingSystemEntity()
            {
                ServiceType       = 5,
                BookningSystemId  = 7,
                SystemName        = "Aspholmens Biltvätt",
                SystemDescription = "Biltvätt",
                Email             = "*****@*****.**",
                PhoneNumber       = "070-000 00 00",
                Website           = "www.aspholmensbiltvatt.se",
                CompanyName       = "Aspholmens Biltvätt",
                ContactEmail      = "*****@*****.**",
                ContactPhone      = "070-000 00 00",
                Adress            = "Skolgatan 42",
                Latitude          = 59.280750,
                Longitude         = 15.233650,
                PostaICode        = "703 64",
                City = "Örebro",
            };

            context.BookingSystems.Add(bookingsystem7);

            var bookedTime1 = new BookingTableEntity()
            {
                BookingTableId = 1,
                Date           = DateTime.Now,
                StartTime      = DateTime.Now,
                EndTime        = DateTime.Now,
                ArticleId      = 1
            };

            context.BookingTabels.Add(bookedTime1);

            var bookedTime2 = new BookingTableEntity()
            {
                BookingTableId = 1,
                Date           = DateTime.Now,
                StartTime      = DateTime.Now,
                EndTime        = DateTime.Now,
                ArticleId      = 1
            };

            context.BookingTabels.Add(bookedTime2);

            var article1 = new ArticleEntity()
            {
                ArticleId       = 1,
                Name            = "Däck Byte",
                Length          = 20,
                Price           = 150,
                BookingSystemId = 1,
                Service         = 1
            };

            context.Articles.Add(article1);

            var article2 = new ArticleEntity()
            {
                ArticleId       = 2,
                Name            = "Service",
                Length          = 60,
                Price           = 1000,
                BookingSystemId = 1,
                Service         = 1
            };

            context.Articles.Add(article2);

            var article3 = new ArticleEntity()
            {
                ArticleId       = 3,
                Name            = "Besiktning",
                Length          = 30,
                Price           = 600,
                BookingSystemId = 1,
                Service         = 2
            };

            context.Articles.Add(article3);

            var article4 = new ArticleEntity()
            {
                ArticleId       = 4,
                Name            = "Herrklippning",
                Length          = 20,
                Price           = 300,
                BookingSystemId = 2,
                Service         = 1
            };

            context.Articles.Add(article4);

            var article5 = new ArticleEntity()
            {
                ArticleId       = 5,
                Name            = "Damklippning",
                Length          = 30,
                Price           = 400,
                BookingSystemId = 2,
                Service         = 1
            };

            context.Articles.Add(article5);

            var article6 = new ArticleEntity()
            {
                ArticleId       = 6,
                Name            = "Permanenta",
                Length          = 60,
                Price           = 700,
                BookingSystemId = 2,
                Service         = 2
            };

            context.Articles.Add(article6);

            var article7 = new ArticleEntity()
            {
                ArticleId       = 7,
                Name            = "Herrklippning",
                Length          = 20,
                Price           = 300,
                BookingSystemId = 3,
                Service         = 1
            };

            context.Articles.Add(article7);

            var article8 = new ArticleEntity()
            {
                ArticleId       = 8,
                Name            = "Damklippning",
                Length          = 30,
                Price           = 400,
                BookingSystemId = 3,
                Service         = 1
            };

            context.Articles.Add(article8);

            var article9 = new ArticleEntity()
            {
                ArticleId       = 9,
                Name            = "Permanenta",
                Length          = 60,
                Price           = 700,
                BookingSystemId = 3,
                Service         = 2
            };

            context.Articles.Add(article9);

            var article10 = new ArticleEntity()
            {
                ArticleId       = 10,
                Name            = "Svensk Massage",
                Length          = 30,
                Price           = 500,
                BookingSystemId = 4,
                Service         = 1
            };

            context.Articles.Add(article10);

            var article11 = new ArticleEntity()
            {
                ArticleId       = 11,
                Name            = "Thailändsk Massage",
                Length          = 30,
                Price           = 500,
                BookingSystemId = 4,
                Service         = 1
            };

            context.Articles.Add(article11);

            var article12 = new ArticleEntity()
            {
                ArticleId       = 12,
                Name            = "Kiropraktor",
                Length          = 45,
                Price           = 600,
                BookingSystemId = 4,
                Service         = 2
            };

            context.Articles.Add(article12);

            var article13 = new ArticleEntity()
            {
                ArticleId       = 13,
                Name            = "Ansiktsbehandling",
                Length          = 30,
                Price           = 400,
                BookingSystemId = 5,
                Service         = 1
            };

            context.Articles.Add(article13);

            var article14 = new ArticleEntity()
            {
                ArticleId       = 14,
                Name            = "Ansiktsmask",
                Length          = 30,
                Price           = 350,
                BookingSystemId = 5,
                Service         = 1
            };

            context.Articles.Add(article14);

            var article15 = new ArticleEntity()
            {
                ArticleId       = 15,
                Name            = "Pedekyr",
                Length          = 30,
                Price           = 300,
                BookingSystemId = 5,
                Service         = 2
            };

            context.Articles.Add(article15);

            var article16 = new ArticleEntity()
            {
                ArticleId       = 16,
                Name            = "Ansiktsbehandling",
                Length          = 30,
                Price           = 400,
                BookingSystemId = 6,
                Service         = 1
            };

            context.Articles.Add(article16);

            var article17 = new ArticleEntity()
            {
                ArticleId       = 17,
                Name            = "Ansiktsmask",
                Length          = 30,
                Price           = 350,
                BookingSystemId = 6,
                Service         = 1
            };

            context.Articles.Add(article17);

            var article18 = new ArticleEntity()
            {
                ArticleId       = 18,
                Name            = "Pedekyr",
                Length          = 30,
                Price           = 300,
                BookingSystemId = 6,
                Service         = 2
            };

            context.Articles.Add(article18);

            var article19 = new ArticleEntity()
            {
                ArticleId       = 19,
                Name            = "Biltvätt",
                Length          = 20,
                Price           = 200,
                BookingSystemId = 7,
                Service         = 1
            };

            context.Articles.Add(article19);

            var article20 = new ArticleEntity()
            {
                ArticleId       = 20,
                Name            = "Städning",
                Length          = 15,
                Price           = 150,
                BookingSystemId = 7,
                Service         = 1
            };

            context.Articles.Add(article20);

            var article21 = new ArticleEntity()
            {
                ArticleId       = 21,
                Name            = "Biltvätt och Städning",
                Length          = 45,
                Price           = 300,
                BookingSystemId = 7,
                Service         = 1
            };

            context.Articles.Add(article21);

            var article22 = new ArticleEntity()
            {
                ArticleId       = 22,
                Name            = "Waxning",
                Length          = 30,
                Price           = 300,
                BookingSystemId = 7,
                Service         = 2
            };

            context.Articles.Add(article22);

            context.SaveChanges();
            base.Seed(context);
        }