public async Task <ActionResult> Create([Bind(Include = "Id,RoomTypeId,MealTypeId,HotelId,RoomName,PeopleNum,Cancelation,Prepayment,City,HotelName,MealName")] Parser_RoomInfo parser_RoomInfo)
        {
            if (ModelState.IsValid)
            {
                db.Parser_RoomInfos.Add(parser_RoomInfo);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", new { hotelId = parser_RoomInfo.HotelId }));
            }

            ViewBag.HotelId = parser_RoomInfo.HotelId;
            HotelSettings     hotel = db.HotelSettings.Find(parser_RoomInfo.HotelId);
            DefoConfiguration conf  = new DefoConfiguration(hotel.Settings);
            var roomTypes           = db.RoomTypes.Where(c => c.HotelId == parser_RoomInfo.HotelId).ToList();

            ViewBag.RoomTypes = new SelectList(roomTypes, "Id", "Name");

            if (conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions != null)
            {
                var mealIds = conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions.Select(c => c.Number);
                if (mealIds.Any())
                {
                    var mealTypes = db.MealTypes.Where(c => mealIds.Contains(c.Id)).ToList();
                    ViewBag.MealTypes = new SelectList(mealTypes, "Id", "Name");
                }
            }
            return(View(parser_RoomInfo));
        }
        // GET: Calculations
        public async Task <ActionResult> Index(int id)
        {
            HotelSettings hotel = await _db.HotelSettings.FindAsync(id);

            if (hotel == null)
            {
                return(HttpNotFound("The hotel not found."));
            }

            var calculations = await GetCalculations(0, id);

            DefoConfiguration conf = new DefoConfiguration(hotel.Settings);
            var total = conf.ConfigurationRoot.Categories.BookingPeriods.Any() ? conf.ConfigurationRoot.Categories.BookingPeriods.Count() : 1;
            Dictionary <int, string> stayNames    = new Dictionary <int, string>();
            Dictionary <int, string> bookingNames = new Dictionary <int, string>();

            for (int i = 0; i < conf.ConfigurationRoot.Categories.Total; i++)
            {
                int l  = (i / total);
                int b  = i - l * total;
                var bp = conf.ConfigurationRoot.Categories.BookingPeriods?.FirstOrDefault(c => c.Number == b);
                var sp = conf.ConfigurationRoot.Categories.StayPeriods?.FirstOrDefault(c => c.Number == l);
                bookingNames.Add(i, bp?.LowerBound + "-" + bp?.UpperBound);
                stayNames.Add(i, sp?.LowerBound + "-" + sp?.UpperBound);
            }
            ViewBag.Id           = id;
            ViewBag.Num          = 0;
            ViewBag.StayNames    = stayNames;
            ViewBag.BookingNames = bookingNames;
            return(View(calculations));
        }
        public ActionResult GetCsv(int hotelId)
        {
            HotelSettings     hotel = _db.HotelSettings.Find(hotelId);
            DefoConfiguration conf  = new DefoConfiguration(hotel.Settings);
            var total = conf.ConfigurationRoot.Categories.BookingPeriods.Any() ? conf.ConfigurationRoot.Categories.BookingPeriods.Count() : 1;
            Dictionary <int, string> stayNames    = new Dictionary <int, string>();
            Dictionary <int, string> bookingNames = new Dictionary <int, string>();

            for (int i = 0; i < conf.ConfigurationRoot.Categories.Total; i++)
            {
                int l  = (i / total);
                int b  = i - l * total;
                var bp = conf.ConfigurationRoot.Categories.BookingPeriods?.FirstOrDefault(c => c.Number == b);
                var sp = conf.ConfigurationRoot.Categories.StayPeriods?.FirstOrDefault(c => c.Number == l);
                bookingNames.Add(i, bp?.LowerBound + " - " + bp?.UpperBound);
                stayNames.Add(i, sp?.LowerBound + " - " + sp?.UpperBound);
            }
            var queryResult = _db.Calculations
                              .Include(c => c.Predictions)
                              .Where(c => c.HotelId == hotelId).ToList();

            var calcs = queryResult.GroupBy(c => c.PredictionDate.Date).Select(c => c.OrderBy(s => s.CalculatedOn).LastOrDefault()).ToList();
            var sb    = new StringBuilder();

            sb.AppendLine(string.Join(";", new string[] { "Date", "Room Type", "Meal Type", "Stay period", "Booking period", "People Number", "Price", "Expected Load", "Cancelation", "No Shows" }));
            foreach (var calc in calcs)
            {
                foreach (var pred in calc.Predictions)
                {
                    sb.AppendLine(string.Join(";", new string[] { calc.PredictionDate.ToShortDateString(), pred.RoomType.Name, pred.MealType.Name, stayNames[pred.CategoryType], bookingNames[pred.CategoryType], pred.PeopleNum.ToString(), pred.Price.ToString(), pred.ExpectedLoad.ToString(), pred.Cancelation.ToString(), pred.NoShows.ToString() }));
                }
            }
            return(File(Encoding.Default.GetBytes(sb.ToString()), System.Net.Mime.MediaTypeNames.Application.Octet, "ResultsCsv.csv"));
        }
        public void Run(int hotelId)
        {
            using (var context = new RmsDbContext())
            {
                HotelSettings hotel = context.HotelSettings.Find(hotelId);

                if (hotel == null || !hotel.IsRmsEnalbed)
                {
                    RecurringJob.RemoveIfExists(GetJobName(hotelId));
                    return;
                }

                if (string.IsNullOrWhiteSpace(hotel.Settings))
                {
                    context.Logs.Add(new Log {
                        LogType = LogType.Error, CreatedOn = DateTime.Now, Body = "Configuration not found.", HotelId = hotelId
                    });
                    context.SaveChanges();
                    return;
                }
                var info = context.Parser_RoomInfos.Where(c => c.HotelId == hotelId).ToList();
                if (!info.Any())
                {
                    context.Logs.Add(new Log {
                        LogType = LogType.Error, CreatedOn = DateTime.Now, Body = "Parser hotel configuration not found.", HotelId = hotelId
                    });
                    context.SaveChanges();
                    return;
                }

                try
                {
                    IParserAdapter parserAdapter = new ParserAdapter();

                    var    calculatedOn = DateTime.Now;
                    double rating       = 0.0;
                    var    result       = parserAdapter.Run(calculatedOn, hotel.PlanningHorizon, info, hotel.Settings, hotel.BookingName, out rating).ToList();

                    if (result.Any())
                    {
                        context.Parser_RoomDatas.AddRange(result);
                        context.Logs.Add(new Log {
                            LogType = LogType.Info, CreatedOn = DateTime.Now, Body = "New booking data have been successfully obtained.", HotelId = hotelId
                        });
                        hotel.BookingRating        = rating;
                        context.Entry(hotel).State = System.Data.Entity.EntityState.Modified;
                        context.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    context.Logs.Add(new Log {
                        LogType = LogType.Error, CreatedOn = DateTime.Now, Body = ex.Message + Environment.NewLine + ex.InnerException?.Message, HotelId = hotelId
                    });
                    context.SaveChanges();
                    throw;
                }
            }
        }
Beispiel #5
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            HotelSettings hotel = await db.HotelSettings.FindAsync(id);

            db.HotelSettings.Remove(hotel);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #6
0
        public async Task <ActionResult> Create([Bind(Include = "Name,Settings,IsRmsEnalbed")] HotelSettings hotel)
        {
            if (ModelState.IsValid)
            {
                db.HotelSettings.Add(hotel);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(hotel));
        }
        // GET: Parser_RoomInfo
        public async Task <ActionResult> Index(int hotelId)
        {
            var parser_RoomInfos = db.Parser_RoomInfos.Where(c => c.HotelId == hotelId).Include(p => p.Hotel);

            ViewBag.HotelId = hotelId;
            HotelSettings hotel = await db.HotelSettings.FindAsync(hotelId);

            DefoConfiguration conf = new DefoConfiguration(hotel.Settings);

            ViewBag.Config = conf;
            return(View(await parser_RoomInfos.ToListAsync()));
        }
Beispiel #8
0
        public async Task <ActionResult> Index(int hotelId, ConfigurationViewModel config)
        {
            var roomTypes = db.RoomTypes.Where(c => c.HotelId == hotelId).ToList();

            if (ModelState.IsValid)
            {
                if (config.RoomTypes.IsEditable)
                {
                    var newRoomTypes = config.RoomTypes.RoomTypes.Where(c => c.Number == 0).ToList();
                    if (newRoomTypes.Any())
                    {
                        db.RoomTypes.AddRange(newRoomTypes.Select(c => new RoomType {
                            Name = c.Name, RoomTypeCode = c.RoomTypeCode, HotelId = hotelId
                        }));
                    }
                    db.RoomTypes.RemoveRange(roomTypes.Where(c => !config.RoomTypes.RoomTypes.Any(s => s.Number == c.Id)));
                    foreach (var item in config.RoomTypes.RoomTypes.Where(c => c.Number > 0).ToList())
                    {
                        var entity = roomTypes.FirstOrDefault(c => c.Id == item.Number);
                        if (entity != null)
                        {
                            entity.RoomTypeCode    = item.RoomTypeCode;
                            entity.Name            = item.Name;
                            db.Entry(entity).State = EntityState.Modified;
                        }
                    }
                    await db.SaveChangesAsync();

                    roomTypes = db.RoomTypes.Where(c => c.HotelId == hotelId).ToList();
                }

                HotelSettings hotel = await db.HotelSettings.FindAsync(hotelId);

                if (config.MealTypes.UseInDynamicCalculation)
                {
                    config.RoomTypes.RoomTypeCoefs.Clear();
                }
                hotel.Settings        = JsonConvert.SerializeObject(ConfigurationViewModel.Map(config, roomTypes), Formatting.Indented);
                db.Entry(hotel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", "HotelSettings"));
            }
            ViewBag.HotelId = hotelId;
            var mealTypes = db.MealTypes.ToList();

            ViewBag.DbMealTypes = new SelectList(mealTypes, "Id", "Name");
            ViewBag.DbRoomTypes = new SelectList(roomTypes, "RoomTypeCode", "Name");
            return(View(config));
        }
Beispiel #9
0
        // GET: Hotels/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HotelSettings hotel = await db.HotelSettings.FindAsync(id);

            if (hotel == null)
            {
                return(HttpNotFound());
            }
            return(View(hotel));
        }
Beispiel #10
0
        // GET: Configuration
        public async Task <ActionResult> Index(int hotelId)
        {
            ViewBag.HotelId = hotelId;
            HotelSettings hotel = await db.HotelSettings.FindAsync(hotelId);

            var roomTypes          = db.RoomTypes.Where(c => c.HotelId == hotelId).ToList();
            var mealTypes          = db.MealTypes.ToList();
            DefoConfiguration conf = new DefoConfiguration(hotel.Settings);
            var model = ConfigurationViewModel.Map(conf.ConfigurationRoot, roomTypes);

            model.RoomTypes.IsEditable = !hotel.IsSettingsBlocked;
            ViewBag.DbMealTypes        = new SelectList(mealTypes, "Id", "Name");
            ViewBag.DbRoomTypes        = new SelectList(roomTypes, "RoomTypeCode", "Name");
            return(View(model));
        }
Beispiel #11
0
        public async Task <bool> InsertEvents(IEnumerable <Event> events)
        {
            using (var context = new RmsDbContext())
            {
                if (events.Any())
                {
                    context.Events.AddRange(events);
                    HotelSettings hotel = await context.HotelSettings.FindAsync(events.FirstOrDefault().HotelId);

                    hotel.IsNeedRecalc = true;
                    await context.SaveChangesAsync();
                }
                return(true);
            }
        }
Beispiel #12
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Settings,IsRmsEnalbed,IsNeedRecalc")] HotelSettings hotel)
        {
            if (ModelState.IsValid)
            {
                HotelSettings hotelUp = await db.HotelSettings.FindAsync(hotel.Id);

                hotelUp.Name            = hotel.Name;
                hotelUp.IsNeedRecalc    = hotel.IsNeedRecalc;
                hotelUp.IsRmsEnalbed    = hotel.IsRmsEnalbed;
                hotelUp.Settings        = hotel.Settings;
                db.Entry(hotelUp).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(hotel));
        }
Beispiel #13
0
        public async Task <bool> DeleteEvents(IEnumerable <int> ids)
        {
            using (var context = new RmsDbContext())
            {
                var events = await context.Events.Where(c => ids.Contains(c.Id)).ToListAsync();

                if (events.Any())
                {
                    HotelSettings hotel = await context.HotelSettings.FindAsync(events.FirstOrDefault().HotelId);

                    context.Events.RemoveRange(events);
                    hotel.IsNeedRecalc = true;
                    await context.SaveChangesAsync();
                }
                return(true);
            }
        }
Beispiel #14
0
        public async Task <bool> UpdateEvents(IEnumerable <Event> events)
        {
            using (var context = new RmsDbContext())
            {
                if (events.Any())
                {
                    foreach (var item in events)
                    {
                        context.Entry(item).State = EntityState.Modified;
                    }
                    HotelSettings hotel = await context.HotelSettings.FindAsync(events.FirstOrDefault().HotelId);

                    hotel.IsNeedRecalc = true;
                    await context.SaveChangesAsync();
                }
                return(true);
            }
        }
Beispiel #15
0
    public void Initsentence()
    {
        // chois entre hotel et resto
        isHotel = UnityEngine.Random.Range(0, 2) < 1;


        // chois phrase
        if (isHotel)
        {
            HotelSettings hotel = hotels[UnityEngine.Random.Range(0, hotels.Count)];
            goodHotelName    = hotel.name;
            fullSentenses[0] = string.Format(sentenseHotel[UnityEngine.Random.Range(0, sentenseHotel.Count)], "<color=red>" + sentenseHotelWords[UnityEngine.Random.Range(0, sentenseHotelWords.Count)] + "<color=white>");
            fullSentenses[1] = (string.Format(sentenseHotelRoom[UnityEngine.Random.Range(0, sentenseHotelRoom.Count)], "<color=red>" + hotel.rooms[UnityEngine.Random.Range(0, hotel.rooms.Count)] + "<color=white>"));


            fullSentenses[2] = (string.Format(sentenseVisual[UnityEngine.Random.Range(0, sentenseVisual.Count)], "<color=red>" + hotel.visual + "<color=white>"));
            fullSentenses[3] = (string.Format(sentenseDate[UnityEngine.Random.Range(0, sentenseDate.Count)], "<color=red>" + hotel.jours[0] + "<color=white>", "<color=red>" + hotel.jours[1] + "<color=white>"));
            fullSentenses[4] = (string.Format(sentensePrise[UnityEngine.Random.Range(0, sentensePrise.Count)], "<color=red>" + hotel.prix + "<color=white>"));
            fullSentenses[5] = (string.Format(sentenseFake[UnityEngine.Random.Range(0, sentenseFake.Count)]));
            langue           = hotel.langages[UnityEngine.Random.Range(0, hotel.langages.Count)];
        }
        else
        {
            RestoSettings resto = restos[UnityEngine.Random.Range(0, restos.Count)];
            goodHotelName    = resto.name;
            fullSentenses[0] = (string.Format(sentenseResto[UnityEngine.Random.Range(0, sentenseResto.Count)], "<color=red>" + sentenseRestoWords[UnityEngine.Random.Range(0, sentenseRestoWords.Count)] + "<color=white>"));
            fullSentenses[1] = (string.Format(sentenseRestoMenu[UnityEngine.Random.Range(0, sentenseRestoMenu.Count)], "<color=red>" + resto.menus[UnityEngine.Random.Range(0, resto.menus.Count)] + "<color=white>"));


            fullSentenses[2] = (string.Format(sentenseVisual[UnityEngine.Random.Range(0, sentenseVisual.Count)], "<color=red>" + resto.visual + "<color=white>"));
            fullSentenses[3] = (string.Format(sentenseDate[UnityEngine.Random.Range(0, sentenseDate.Count)], "<color=red>" + resto.jours[UnityEngine.Random.Range(0, resto.jours.Count)] + "<color=white>"));
            fullSentenses[4] = (string.Format(sentensePrise[UnityEngine.Random.Range(0, sentensePrise.Count)], "<color=red>" + resto.prix + "<color=white>"));
            fullSentenses[5] = (string.Format(sentenseFake[UnityEngine.Random.Range(0, sentenseFake.Count)]));
            langue           = resto.langages[UnityEngine.Random.Range(0, resto.langages.Count)];
        }


        // randomiser l'array

        usableSentense = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n", fullSentenses[0], fullSentenses[1], fullSentenses[2], fullSentenses[3], fullSentenses[4], fullSentenses[5]);
    }
Beispiel #16
0
        // GET: GroupCalculation
        public async Task <ActionResult> Index(int id)
        {
            HotelSettings hotel = await _db.HotelSettings.FindAsync(id);

            if (hotel == null)
            {
                return(HttpNotFound());
            }
            var configurationRoot = JsonConvert.DeserializeObject <ConfigurationRoot>(hotel.Settings);

            var rmsAdapter = await _BLManager.InitRmsAdapter(DateTime.Today, DateTime.Today, id, _db);

            var roomTypes = _db.RoomTypes.Where(c => c.HotelId == id).ToList();
            var mealTypes = _db.MealTypes.ToList();

            Session["rmsAdapter"] = rmsAdapter;
            var input = _BLManager.GetCalcInputForIndex(rmsAdapter, configurationRoot.RoomTypes.RoomTypeDescriptions.ToDictionary(c => c.Number, c => roomTypes.FirstOrDefault(s => s.Id == c.Number)?.Name), configurationRoot.MealTypes.MealTypeDescriptions.ToDictionary(c => c.Number, c => mealTypes.FirstOrDefault(s => s.Id == c.Number)?.Name));

            input.HotelId = id;
            return(View(input));
        }
        // GET: Parser_RoomInfo/Create
        public ActionResult Create(int hotelId)
        {
            ViewBag.HotelId = hotelId;
            HotelSettings     hotel = db.HotelSettings.Find(hotelId);
            DefoConfiguration conf  = new DefoConfiguration(hotel.Settings);
            var roomTypes           = db.RoomTypes.Where(c => c.HotelId == hotelId).ToList();

            ViewBag.RoomTypes = new SelectList(roomTypes, "Id", "Name");

            if (conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions != null)
            {
                var mealIds = conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions.Select(c => c.Number);
                if (mealIds.Any())
                {
                    var mealTypes = db.MealTypes.Where(c => mealIds.Contains(c.Id)).ToList();
                    ViewBag.MealTypes = new SelectList(mealTypes, "Id", "Name");
                }
            }
            //ViewBag.MealTypes = conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions.ToDictionary(c => c.Number.ToString(), c => c.DisplayName);
            return(View());
        }
Beispiel #18
0
        public async Task <RmsAdapter> InitRmsAdapter(DateTime start, DateTime end, int hotelId, RmsDbContext db)
        {
            return(await
                   Task.Run(() =>
            {
                HotelSettings hotel = db.HotelSettings.Find(hotelId);

                if (hotel == null || !hotel.IsRmsEnalbed)
                {
                    return null;
                }
                var calculations = new List <Calculation>();
                for (var s = start.Date; s <= end.Date; s = s.AddDays(1))
                {
                    calculations.Add(db.Calculations.Where(c => c.HotelId == hotelId && DbFunctions.TruncateTime(c.PredictionDate) == s).OrderByDescending(c => c.CalculatedOn).FirstOrDefault());
                }
                IEnumerable <Reservation> reservations = db.Reservations.Where(r => r.HotelId == hotelId && (r.CheckInDate <= end.Date && DbFunctions.AddDays(r.CheckInDate, r.DaysCount - 1) >= start.Date)).ToList();
                IEnumerable <Reservation> groupReservations = db.Reservations.Where(r => r.HotelId == hotelId && r.ReservationType == ReservationType.Group).ToList();
                var rmsAdapter = new RmsAdapter();
                rmsAdapter.RunGroupCalculation(start, end, reservations, groupReservations, calculations, hotel.Settings);
                return rmsAdapter;
            }));
        }
Beispiel #19
0
        public async Task <bool> InsertReservations(IEnumerable <Reservation> reservations, int hotelId)
        {
            using (var context = new RmsDbContext())
            {
                HotelSettings hotel = await context.HotelSettings.FindAsync(hotelId);

                if (hotel == null)
                {
                    return(false);
                }

                DateTime createdOn = DateTime.Now;
                reservations.ToList().ForEach(f =>
                {
                    f.HotelId   = hotelId;
                    f.CreatedOn = createdOn;
                });
                while (reservations.Any())
                {
                    context.Reservations.AddRange(reservations.Take(250));
                    try
                    {
                        await context.SaveChangesAsync();
                    }
                    catch (Exception ex)
                    {
                        return(false);
                    }
                    finally
                    {
                        reservations = reservations.Skip(250).ToList();
                    }
                }
                hotel.IsNeedRecalc = true;
                return(true);
            }
        }
Beispiel #20
0
 public UpdateSettingsOutgoingPacket(HotelSettings settings)
 {
     this.Settings = settings;
 }
 public void UpdateHotelSettingsAsync(HotelSettings settings, Action <bool> completed)
 {
     this.SendPacket(new UpdateSettingsOutgoingPacket(settings), completed);
 }
        public void Run(int hotelId)
        {
            using (var context = new RmsDbContext())
            {
                HotelSettings hotel = context.HotelSettings.Find(hotelId);

                if (hotel == null || !hotel.IsRmsEnalbed)
                {
                    RecurringJob.RemoveIfExists(GetJobName(hotelId));
                    return;
                }

                if (string.IsNullOrWhiteSpace(hotel.Settings))
                {
                    context.Logs.Add(new Log {
                        LogType = LogType.Error, CreatedOn = DateTime.Now, Body = "Configuration not found.", HotelId = hotelId
                    });
                    context.SaveChanges();
                    return;
                }

                //Calculation lastCalculation = context.Calculations.Where(c => c.HotelId == hotelId).OrderByDescending(c => c.CalculatedOn).FirstOrDefault();

                //if ((lastCalculation == null && context.Reservations.Any(r => r.HotelId == hotelId)) ||
                //    (lastCalculation != null && context.Reservations.Any(r => r.HotelId == hotelId && r.CreatedOn > lastCalculation.CalculatedOn)))
                if (hotel.IsNeedRecalc)
                {
                    IEnumerable <Reservation> reservations = context.Reservations.Where(r => r.HotelId == hotelId).ToList();
                    IEnumerable <Event>       events       = context.Events.Where(r => r.HotelId == hotelId).ToList();

                    IEnumerable <Parser_RoomData> actualParserData = new List <Parser_RoomData>();
                    if (context.Parser_RoomDatas.Any(r => r.Parser_RoomInfo.HotelId == hotelId))
                    {
                        var lastDate = context.Parser_RoomDatas.Where(r => r.Parser_RoomInfo.HotelId == hotelId).Max(r => r.CreationDate);
                        actualParserData = context.Parser_RoomDatas.Where(r => r.Parser_RoomInfo.HotelId == hotelId && r.CreationDate == lastDate).ToList();
                    }

                    IEnumerable <Inflation> inflations = context.Inflations.ToList();

                    IRmsAdapter rmsAdapter   = new RmsAdapter();
                    string      startDateStr = ConfigurationManager.AppSettings["start_date"];
                    DateTime    startDate    = DateTime.Now;
                    if (!string.IsNullOrEmpty(startDateStr))
                    {
                        startDate = DateTime.ParseExact(startDateStr, "dd.MM.yyyy", null);
                    }
                    var result = rmsAdapter.Run(startDate, hotel.PlanningHorizon, hotel.HistoryPeriod, reservations, inflations, events, actualParserData, hotel.Settings, hotel.BookingRating).ToList();

                    var calculatedOn = DateTime.Now;
                    foreach (Calculation calculation in result)
                    {
                        calculation.CalculatedOn = calculatedOn;
                        calculation.HotelId      = hotel.Id;
                        calculation.Settings     = hotel.Settings;
                    }

                    if (result.Any())
                    {
                        context.Calculations.AddRange(result);
                        context.Logs.Add(new Log {
                            LogType = LogType.Info, CreatedOn = DateTime.Now, Body = "New predictions have been successfully calculated.", HotelId = hotelId
                        });
                        hotel.IsNeedRecalc = false;
                        context.SaveChanges();
                    }
                }
                else
                {
                    context.Logs.Add(new Log {
                        LogType = LogType.Info, CreatedOn = DateTime.Now, Body = "New data not found for calculate predictions.", HotelId = hotelId
                    });
                    context.SaveChanges();
                }
            }
        }