Beispiel #1
0
        /// <summary>
        /// payment automapper
        /// </summary>
        /// <param name="paymentViewModel"></param>
        /// <param name="paymentDatabase"></param>
        /// <returns>mapped payment instance</returns>
        public static HotelPaymentMethodRelation AutomapperPaymentMethodRelation(HotelPaymentMethodRelationViewModel paymentViewModel, HotelPaymentMethodRelation paymentDatabase)
        {
            var paymentMapped = AutoMapper.Mapper.Map <HotelPaymentMethodRelation>(paymentViewModel);

            ResolveRemainingParamters(paymentMapped, paymentDatabase);
            return(paymentMapped);
        }
Beispiel #2
0
        /// <summary>
        /// create payment
        /// </summary>
        /// <param name="paymentVm"></param>
        /// <returns></returns>
        public Task <BaseResult <long> > CreateHotelPaymentMethodRelation(HotelPaymentMethodRelationViewModel paymentVm)
        {
            HotelPaymentMethodRelation payment = new HotelPaymentMethodRelation
            {
                HotelId         = paymentVm.HotelId,
                PaymentMethodId = paymentVm.PaymentMethodId,
                CurrencyId      = paymentVm.CurrencyId,
                RateTypeId      = paymentVm.RateTypeId
            };

            return(iHotelPaymentMethodRelation.InsertEntity(payment));
        }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
 public HotelDetailsViewModel()
 {
     ContactDetails             = new List <ContactDetailsViewModel>();
     TaxDetails                 = new List <HotelTaxRelationViewModel>();
     HotelPaymentMethodRelation = new HotelPaymentMethodRelationViewModel();
 }