public int CompareTo(CheckOutLogBLL other) { int output = CheckOutDate.CompareTo(other.CheckOutDate); if (output == 0) { return(Book.Title.CompareTo(other.Book.Title)); } return(output); }
public override int GetHashCode() { int hash = 1; if (ResourceName.Length != 0) { hash ^= ResourceName.GetHashCode(); } if (CommissionId.Length != 0) { hash ^= CommissionId.GetHashCode(); } if (OrderId.Length != 0) { hash ^= OrderId.GetHashCode(); } if (Campaign.Length != 0) { hash ^= Campaign.GetHashCode(); } if (HotelCenterId != 0L) { hash ^= HotelCenterId.GetHashCode(); } if (HotelId.Length != 0) { hash ^= HotelId.GetHashCode(); } if (CheckInDate.Length != 0) { hash ^= CheckInDate.GetHashCode(); } if (CheckOutDate.Length != 0) { hash ^= CheckOutDate.GetHashCode(); } if (ReconciledValueMicros != 0L) { hash ^= ReconciledValueMicros.GetHashCode(); } if (Billed != false) { hash ^= Billed.GetHashCode(); } if (Status != global::Google.Ads.GoogleAds.V10.Enums.HotelReconciliationStatusEnum.Types.HotelReconciliationStatus.Unspecified) { hash ^= Status.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public async Task <string> ToUrlParamsString() { var urlParams = new Dictionary <string, string>(); urlParams.Add("cityCode", CityCode); urlParams.Add("radius", Radius.ToString()); urlParams.Add("radiusUnit", RadiusUnit.ToString()); urlParams.Add("checkInDate", CheckInDate.ToString("yyyy-MM-dd")); urlParams.Add("checkOutDate", CheckOutDate.ToString("yyyy-MM-dd")); urlParams.Add("adults", Adults.ToString()); urlParams.Add("includeClosed", IncludeClosed.ToString().ToLower()); urlParams.Add("bestRateOnly", BestRateOnly.ToString().ToLower()); urlParams.Add("sort", Sort.ToString().ToUpper()); using (HttpContent content = new FormUrlEncodedContent(urlParams)) return(await content.ReadAsStringAsync()); }
public NameValueCollection GetQueryParameters(bool addFilterParameters) { var parameters = new NameValueCollection(); parameters["location"] = Metro_Area.ID.ToString(); parameters["checkin"] = CheckInDate.ToString("M-d-yyyy"); parameters["checkout"] = CheckOutDate.ToString("M-d-yyyy"); parameters["rooms"] = RoomsCount.ToString(); parameters["adults"] = AdultsCount.ToString(); parameters["children"] = ChildrenCount.ToString(); if (Hotel != null) { parameters["hotelID"] = Hotel.ID.ToString(); } if (Room != null) { parameters["roomID"] = Room.ID.ToString(); } if (addFilterParameters) { if (!string.IsNullOrEmpty(FilterCustomerRating)) { parameters["custrating"] = FilterCustomerRating; } if (!string.IsNullOrEmpty(FilterLocationRating)) { parameters["locrating"] = FilterLocationRating; } if (!string.IsNullOrEmpty(FilterMaxPrice)) { parameters["maxprice"] = FilterMaxPrice; } if (!string.IsNullOrEmpty(FilterMinPrice)) { parameters["minprice"] = FilterMinPrice; } if (!string.IsNullOrEmpty(FilterOurRating)) { parameters["ourrating"] = FilterOurRating; } } return(parameters); }
public bool CheckDates() { if (CheckInDate[3] == CheckOutDate[3] && CheckInDate[2] == CheckOutDate[2]) { if (CheckInDate[5] == CheckOutDate[5] && CheckInDate[6] == CheckOutDate[6]) { string start = CheckInDate.Substring(8, 2); string end = CheckOutDate.Substring(8, 2); int x = Int32.Parse(start); int y = Int32.Parse(end); int count = y - x; if (count > 0) { return(true); } } } return(false); }
public decimal CalculateReservationCost() { Total = 0M; string start = CheckInDate.Substring(8, 2); string end = CheckOutDate.Substring(8, 2); int x = Int32.Parse(start); int y = Int32.Parse(end); int count = y - x; if (count > 0) { foreach (var r in Rooms) { Total += r.DailyRate; } return(Total * count); } return(Total); }
public void CalculatePrice() { int checkInSeasson, checkOutSeasson; //if Price[i] gets addressed PropertyChanged is not working. Why? Setter is not invoked that way? ///priceArray[0] - room price out of the seasson ///priceArray[1] - room price in low seasson ///priceArray[2] - room price in high seasson ///priceArray[3] - total item price decimal[] priceArray = new decimal[4]; DateTime date0 = new DateTime(CheckInDate.Year, Settings.seassons[0].month, Settings.seassons[0].day); DateTime date1 = new DateTime(CheckInDate.Year, Settings.seassons[1].month, Settings.seassons[1].day); DateTime date2 = new DateTime(CheckInDate.Year, Settings.seassons[2].month, Settings.seassons[2].day); DateTime date3 = new DateTime(CheckInDate.Year, Settings.seassons[3].month, Settings.seassons[3].day); ///Determine in which tourist seassons are Check-In and Check-Out dates ///No need to validate the dates since UI does that if (CheckInDate.CompareTo(date0) < 0) { checkInSeasson = 0; } else if (CheckInDate.CompareTo(date1) < 0) { checkInSeasson = 1; } else if (CheckInDate.CompareTo(date2) < 0) { checkInSeasson = 2; } else if (CheckInDate.CompareTo(date3) < 0) { checkInSeasson = 3; } else { checkInSeasson = 0; } if (CheckOutDate.CompareTo(date0.AddDays(1)) < 0) { checkOutSeasson = 0; } else if (CheckOutDate.CompareTo(date1.AddDays(1)) < 0) { checkOutSeasson = 1; } else if (CheckOutDate.CompareTo(date2.AddDays(1)) < 0) { checkOutSeasson = 2; } else if (CheckOutDate.CompareTo(date3.AddDays(1)) < 0) { checkOutSeasson = 3; } else { checkOutSeasson = 0; } if (checkInSeasson == checkOutSeasson) { coveredSeassons = 1; Days[checkInSeasson] = (int)(Math.Round((CheckOutDate - CheckInDate).TotalHours) / 24); switch (checkInSeasson) { case 0: priceArray[checkInSeasson] = Days[checkInSeasson] * Settings.room[this.Name].Out; break; case 1: priceArray[checkInSeasson] = Days[checkInSeasson] * Settings.room[this.Name].Low; break; case 2: priceArray[checkInSeasson] = Days[checkInSeasson] * Settings.room[this.Name].High; break; case 3: priceArray[1] = Days[1] * Settings.room[this.Name].Low; break; } } else if (checkInSeasson == 0 && checkOutSeasson == 1) { coveredSeassons = 2; Days[0] = (int)(Math.Round((date0 - CheckInDate).TotalHours) / 24); priceArray[0] = Days[0] * Settings.room[this.Name].Out; Days[1] = (int)(Math.Round((CheckOutDate - date0).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; } else if (checkInSeasson == 1 && checkOutSeasson == 2) { coveredSeassons = 2; Days[1] = (int)(Math.Round((date1 - CheckInDate).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; Days[2] = (int)(Math.Round((CheckOutDate - date1).TotalHours) / 24); priceArray[2] = Days[2] * Settings.room[this.Name].High; } else if (checkInSeasson == 2 && checkOutSeasson == 3) { coveredSeassons = 2; Days[2] = (int)(Math.Round((date2 - CheckInDate).TotalHours) / 24); priceArray[2] = Days[2] * Settings.room[this.Name].High; Days[1] = (int)(Math.Round((CheckOutDate - date2).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; } else if (checkInSeasson == 3 && checkOutSeasson == 0) { coveredSeassons = 2; Days[1] = (int)(Math.Round((date3 - CheckInDate).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; Days[0] = (int)(Math.Round((CheckOutDate - date3).TotalHours) / 24); priceArray[0] = Days[0] * Settings.room[this.Name].Out; } else if (checkInSeasson == 0 && checkOutSeasson == 2) { coveredSeassons = 3; Days[0] = (int)(Math.Round((CheckInDate - date0).TotalHours) / 24); priceArray[0] = Days[0] * Settings.room[this.Name].Out; Days[1] = (int)(Math.Round((date1 - date0).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; Days[2] = (int)(Math.Round((CheckOutDate - date1).TotalHours) / 24); priceArray[2] = Days[2] * Settings.room[this.Name].High; } else if (checkInSeasson == 1 && checkOutSeasson == 3) { coveredSeassons = 2; Days[1] = (int)(Math.Round((date1 - CheckInDate).TotalHours) / 24); Days[2] = (int)(Math.Round((date2 - date1).TotalHours) / 24); priceArray[2] = Days[2] * Settings.room[this.Name].High; Days[1] += (int)(Math.Round((CheckOutDate - date2).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; } else if (checkInSeasson == 2 && checkOutSeasson == 0) { coveredSeassons = 3; Days[2] = (int)(Math.Round((date2 - CheckInDate).TotalHours) / 24); priceArray[2] = Days[2] * Settings.room[this.Name].High; Days[1] = (int)(Math.Round((date3 - date2).TotalHours) / 24); priceArray[1] = Days[1] * Settings.room[this.Name].Low; Days[0] = (int)(Math.Round((CheckOutDate - date3).TotalHours) / 24); priceArray[0] = Days[0] * Settings.room[this.Name].Out; } priceArray[3] = priceArray[0] + priceArray[1] + priceArray[2]; Array.Copy(priceArray, CleanPrice, priceArray.Length); if (BedsBig > 0) { priceArray[0] += BedsBig * Days[0] * Settings.bedPrices[this.Name].bigOut; priceArray[1] += BedsBig * Days[1] * Settings.bedPrices[this.Name].bigLow; priceArray[2] += BedsBig * Days[2] * Settings.bedPrices[this.Name].bigHigh; } if (BedsSmall > 0) { priceArray[0] += BedsSmall * Days[0] * Settings.bedPrices[this.Name].smallOut; priceArray[1] += BedsSmall * Days[1] * Settings.bedPrices[this.Name].smallLow; priceArray[2] += BedsSmall * Days[2] * Settings.bedPrices[this.Name].smallHigh; } priceArray[3] = priceArray[0] + priceArray[1] + priceArray[2]; Days[3] = Days[0] + Days[1] + Days[2]; TotalNoDiscount = priceArray[3]; priceArray[3] -= ((Discount / (decimal)100) * priceArray[3]); priceArray[3] = Decimal.Round(priceArray[3], 2); //if using Price items and not assingning to Price, Notify... wont work. Price = priceArray; }
public async Task <IActionResult> OnGetAsync(int accommodationId, string checkInDate, string checkOutDate) { if (accommodationId == 0) { return(BadRequest()); } if (User.Identity.IsAuthenticated) { CurrentUser = await userManager.FindByEmailAsync(User.Identity.Name); } AccommodationId = accommodationId; Accommodation = await AccommodationLogic.GetAccommodationByIdAsync(accommodationId); if (Accommodation == null) { return(NotFound()); } CheckInDateString = checkInDate; CheckOutDateString = checkOutDate; var dateformat = "dd.MM.yyyy."; var listOfDatesOccupied = await AccommodationLogic.GetDatesOccupiedForAccommodationAsync(accommodationId); try { CheckInDate = DateTime.ParseExact(checkInDate, dateformat, CultureInfo.InvariantCulture); CheckOutDate = DateTime.ParseExact(checkOutDate, dateformat, CultureInfo.InvariantCulture); if (CheckInDate < DateTime.Now.Date || CheckOutDate < DateTime.Now.AddDays(1).Date || CheckInDate >= CheckOutDate) { throw new Exception("Invalid dates!"); } if (!await AccommodationLogic.CheckIfBookingDatesAreValid(CheckInDate, CheckOutDate, accommodationId)) { throw new Exception("Dates are occupied!"); } } catch { CheckInDate = DateTime.Now.Date; CheckOutDate = DateTime.Now.Date; CheckInDateString = CheckInDate.ToString(dateformat); CheckOutDateString = CheckOutDate.ToString(dateformat); } DatesOccupiedArray = listOfDatesOccupied.ToArray(); var accommodationPhotosFolder = AccommodationLogic.GetPhotosFolderPathForAccommodation(Accommodation); HeaderPhotoPath = accommodationPhotosFolder + "Header/" + Accommodation.HeaderPhotoFileName; //removing wwwroot prefix HeaderPhotoPath = HeaderPhotoPath.Substring(7); try { AccommodationPhotos = Directory.GetFiles(accommodationPhotosFolder, "*", SearchOption.TopDirectoryOnly).ToList(); } catch (Exception) { AccommodationPhotos = new List <string>(); } return(Page()); }
public override string ToString() { return(CheckOutDate.ToString()); }