/// <summary> /// AutomapperContractHotelTaxRelation /// </summary> /// <param name="hotelTaxRelationViewModel"></param> /// <param name="model"></param> /// <param name="contractStaticViewModel"></param> /// <param name="loggedUser"></param> /// <param name="objectState"></param> /// <returns></returns> public static ContractHotelTaxRelation AutomapperContractHotelTaxRelation(HotelTaxRelationViewModel hotelTaxRelationViewModel, ContractHotelTaxRelation model, ContractStaticViewModel contractStaticViewModel, string loggedUser, ObjectState?objectState) { var mappedModel = AutoMapper.Mapper.Map <ContractHotelTaxRelation>(hotelTaxRelationViewModel); ResolveRemainingParamters(mappedModel, model, contractStaticViewModel, loggedUser, objectState); return(mappedModel); }
/// <summary> /// taxes automapper /// </summary> /// <param name="taxViewModel"></param> /// <param name="taxDatabase"></param> /// <returns>mapped hoteltax</returns> public static HotelTaxRelation AutomapperTaxes(HotelTaxRelationViewModel taxViewModel, HotelTaxRelation taxDatabase) { var taxMapped = AutoMapper.Mapper.Map <HotelTaxRelation>(taxViewModel); ResolveRemainingParamters(taxMapped, taxDatabase); return(taxMapped); }
/// <summary> /// create hotel tax /// </summary> /// <param name="taxVm"></param> /// <returns></returns> public Task <BaseResult <long> > CreateHotelTaxRelation(HotelTaxRelationViewModel taxVm) { HotelTaxRelation tax = new HotelTaxRelation { HotelId = taxVm.HotelId, TaxTypeId = taxVm.TaxTypeId, TaxApplicabilityId = taxVm.TaxApplicabilityId, Amount = taxVm.Amount, IsIncludedInRates = taxVm.IsIncludedInRates }; return(iHotelTaxRelation.InsertEntity(tax)); }
/// <summary> /// Returns Mapped Hotel Details view Model /// </summary> /// <param name="hoteldata"></param> /// <returns> Mapped Hotel Details view Model</returns> public static HotelDetailsViewModel MapHotelDetailsToHotelDetailsViewModel(BaseResult <List <HotelView> > hotelView) { HotelDetailsViewModel hotel = new HotelDetailsViewModel(); foreach (var item in hotelView.Result) { if (!(hotel.HotelId == item.HotelId)) { hotel.HotelCode = item.HotelCode; hotel.Location = item.CityName + ", " + item.CountryName; hotel.HotelId = item.HotelId; hotel.IsActive = item.IsActive; hotel.HotelName = item.HotelName; hotel.HotelChainId = item.HotelChainId; hotel.HotelBrandId = item.HotelBrandId; hotel.HotelTypeId = item.HotelTypeId; hotel.CountryId = item.CountryId; hotel.CityId = item.CityId; hotel.Latitude = item.Latitude; hotel.Longitude = item.Longitude; hotel.ShortDescription = item.ShortDescription; hotel.LongDescription = item.LongDescription; hotel.Website = item.Website; hotel.ReservationEmail = item.ReservationEmail; hotel.ReservationContactNo = item.Telephone; hotel.Address1 = item.Address1; hotel.Address2 = item.Address2; hotel.ZipCode = item.ZipCode; hotel.IsExtranetAccess = item.IsExtranetAccess; hotel.IsChannelManagerConnectivity = item.IsChannelManagerConnectivity; hotel.ChannelManagerId = item.ChannelManagerId; if (item.ChannelManagerId == 0) { hotel.ChannelManagerId = null; } ; hotel.StarRatingId = item.StarRatingID; hotel.MGPoint = item.MGPoint; DateTime dt; if (item.CheckInFrom != null) { dt = new DateTime() + item.CheckInFrom; hotel.CheckInFrom = dt.ToString("hh:mm tt"); } //if (item.CheckInTo != null) //{ // dt = new DateTime() + (TimeSpan)item.CheckInTo; // hotel.CheckInTo = dt.ToString("hh:mm tt"); //} //if (item.CheckOutFrom != null) //{ // dt = new DateTime() + (TimeSpan)item.CheckOutFrom; // hotel.CheckOutFrom = dt.ToString("hh:mm tt"); //} if (item.CheckOutTo != null) { dt = new DateTime() + (TimeSpan)item.CheckOutTo; hotel.CheckOutTo = dt.ToString("hh:mm tt"); } } if (!(hotel.ContactDetails.AsEnumerable().Where(id => id.ContactId == item.ContactId).Count() > 0)) { ContactDetailsViewModel contacts = new ContactDetailsViewModel { ContactId = item.ContactId, IsPrimary = item.IsPrimary, ContactPerson = item.ContactPerson, DesignationId = item.DesignationId, EmailAddress = item.ContactEmailAddress, ContactNumber = item.ContactNumber }; hotel.ContactDetails.Add(contacts); } if (!(hotel.TaxDetails.AsEnumerable().Where(id => id.TaxTypeId == item.TaxTypeId && id.TaxApplicabilityId == item.TaxApplicabilityId).Count() > 0)) { HotelTaxRelationViewModel tax = new HotelTaxRelationViewModel { TaxTypeId = item.TaxTypeId, TaxesType = item.TaxesType, TaxApplicabilityId = item.TaxApplicabilityId, #pragma warning disable CA1305 // Specify IFormatProvider Amount = Convert.ToDecimal(item.TaxAmount), #pragma warning restore CA1305 // Specify IFormatProvider IsIncludedInRates = item.IsIncludedInRates }; hotel.TaxDetails.Add(tax); } HotelPaymentMethodRelationViewModel payment = new HotelPaymentMethodRelationViewModel() { HotelPaymentMethodRelationId = item.HotelPaymentMethodRelationId, PaymentMethodId = item.PaymentMethodId, CurrencyId = item.CurrencyId, RateTypeId = item.RateTypeId }; hotel.HotelPaymentMethodRelation = payment; } return(hotel); }