Пример #1
0
        public async Task <BaseResult <List <HotelFacilityGroupViewModel> > > GetTemplateHotelFacilityFields(int templateId, int languageId)
        {
            DynamicParameters paramCollection = ContractTemplateRequestMapper.CreateTemplateHotelFacilityRequestParams(templateId, languageId, true);
            //return await iTemplateHotelFieldLibrary.ExecuteStoredProcedure(Constants.StoredProcedure.GetHotelFieldsByTemplateId, paramCollection).ConfigureAwait(false);
            var facilityGroup = await iTemplateHotelFieldLibrary.ExecuteStoredProcedure(Constants.StoredProcedure.GetHotelFieldsByTemplateId, paramCollection).ConfigureAwait(false);

            //IConnection<HotelFacilityGroup> iHotelFacilityGroupLibrary,
            //                        IConnection< HotelFacilityType > iHotelFacilityTypeLibrary,
            //                        IConnection<HotelFacility> iHotelFacilityLibrary,
            //                        IConnection< HotelFacilityRelation > iHotelFacilityRelationLibrary,
            //                        IConnection<InOutTime> inOutTimeLibrary


            IFacilities iFacilities = new FacilitiesRepository(new DapperConnection <HotelFacilityGroup>(iConfiguration), new DapperConnection <HotelFacilityType>(iConfiguration), new DapperConnection <HotelFacility>(iConfiguration), null, null);
            BaseResult <List <HotelFacilityGroup> > hotelFacilityGroup = await iFacilities.GeHotelFacilityGroup().ConfigureAwait(false);

            BaseResult <List <HotelFacilityType> > hotelFacilityType = await iFacilities.GeHotelFacilityType().ConfigureAwait(false);

            BaseResult <List <HotelFacility> > hotelFacility = await iFacilities.GeHotelFacility().ConfigureAwait(false);

            var facilities = FacilitiesResponseMapper.MapHotelFacilities(hotelFacility);                             ////maps to facilityViewModel
            var result     = FacilitiesResponseMapper.MapHotelFacilityType(facilities, hotelFacilityType);           ////maps to HotelFacilityTypeViewModel
            var result1    = FacilitiesResponseMapper.MapHotelFacilityGroup(facilities, hotelFacilityGroup, result); ////Maps to HotelFacilityGroupViewModel

            ContractTemplateResponseMapper.MapToFacilityFieldToViewModel(facilityGroup.Result, result1.Result);

            return(result1);
        }
Пример #2
0
        /// <summary>
        /// Get The count of amenities for selected template (while creating contract).
        /// </summary>
        /// <param name="templateId"></param>
        /// <param name="languageId"></param>
        /// <returns> Count of amenities</returns>
        public async Task <BaseResult <int> > GetCountOfAmenitiesForSelectedTemplate(int templateId, int languageId)
        {
            var result = new BaseResult <int>();
            DynamicParameters paramCollection = ContractTemplateRequestMapper.CreateTemplateHotelFacilityRequestParams(templateId, languageId, true);
            var list = await iTemplateRoomFieldLibrary.ExecuteStoredProcedure(Constants.StoredProcedure.GetRooomFieldsByTemplateId, paramCollection).ConfigureAwait(false);

            if (list.IsError == true && list.ExceptionMessage != null)
            {
                result.IsError          = list.IsError;
                result.ExceptionMessage = list.ExceptionMessage;
                return(result);
            }
            if (list != null && list.Result.Any())
            {
                var count = list.Result.Count(a => a.IsSelected == true);
                result.Result = count;
                return(result);
            }
            return(result);
        }
Пример #3
0
        public async Task <BaseResult <List <TemplateRoomField> > > GetTemplateRoomFields(int templateId, bool isFacility = false)
        {
            var paramCollection = ContractTemplateRequestMapper.CreateTemplateHotelFacilityRequestParams(templateId, 1, isFacility);

            return(await iTemplateRoomFieldLibrary.ExecuteStoredProcedure(Constants.StoredProcedure.GetRooomFieldsByTemplateId, paramCollection).ConfigureAwait(false));
        }