Example #1
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage)
        {
            //Add LanguageName
            if (policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode != null)
            {
                LanguageRepository languageRepository = new LanguageRepository();
                Language           language           = new Language();
                language = languageRepository.GetLanguage(policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode);
                if (language != null)
                {
                    policyAirMissedSavingsThresholdGroupItemLanguage.LanguageName = language.LanguageName;
                }
            }

            //Add PolicyGroupName
            PolicyAirMissedSavingsThresholdGroupItemRepository policyAirMissedSavingsThresholdGroupItemRepository = new PolicyAirMissedSavingsThresholdGroupItemRepository();
            PolicyAirMissedSavingsThresholdGroupItem           policyAirMissedSavingsThresholdGroupItem           = new PolicyAirMissedSavingsThresholdGroupItem();

            policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId);


            if (policyAirMissedSavingsThresholdGroupItem != null)
            {
                PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
                PolicyGroup           policyGroup           = new PolicyGroup();
                policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId);

                //policyAirMissedSavingsThresholdGroupItemRepository.EditItemForDisplay(policyAirMissedSavingsThresholdGroupItem);
                policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupName = policyGroup.PolicyGroupName;
                policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupId   = policyAirMissedSavingsThresholdGroupItem.PolicyGroupId;
            }
        }
Example #2
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyHotelCapRateGroupItem policyHotelCapRateGroupItem)
        {
            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyHotelCapRateGroupItem.PolicyGroupId);
            policyHotelCapRateGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //Currency
            if (policyHotelCapRateGroupItem.CurrencyCode != null)
            {
                string             currencyCode       = policyHotelCapRateGroupItem.CurrencyCode;
                CurrencyRepository currencyRepository = new CurrencyRepository();
                Currency           currency           = new Currency();
                currency = currencyRepository.GetCurrency(currencyCode);
                policyHotelCapRateGroupItem.CurrencyName = currency.Name;
            }

            //PolicyLocation
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation           policyLocation           = new PolicyLocation();

            policyLocation = policyLocationRepository.GetPolicyLocation(policyHotelCapRateGroupItem.PolicyLocationId);
            if (policyLocation != null)
            {
                policyHotelCapRateGroupItem.PolicyLocation = policyLocation.PolicyLocationName;
            }
        }
Example #3
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyCountryGroupItem policyCountryGroupItem)
        {
            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = policyGroupRepository.GetGroup(policyCountryGroupItem.PolicyGroupId);

            policyCountryGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //PolicyCountryStatus
            if (policyCountryGroupItem.PolicyCountryStatusId != null)
            {
                int policyCountryStatusId = (int)policyCountryGroupItem.PolicyCountryStatusId;
                PolicyCountryStatusRepository policyCountryStatusRepository = new PolicyCountryStatusRepository();
                PolicyCountryStatus           policyCountryStatus           = new PolicyCountryStatus();
                policyCountryStatus = policyCountryStatusRepository.GetPolicyCountryStatus(policyCountryStatusId);
                if (policyCountryStatus != null)
                {
                    policyCountryGroupItem.PolicyCountryStatusDescription = policyCountryStatus.PolicyCountryStatusDescription;
                }
            }

            //CountryName
            CountryRepository countryRepository = new CountryRepository();
            Country           country           = new Country();

            country = countryRepository.GetCountry(policyCountryGroupItem.CountryCode);
            if (country != null)
            {
                policyCountryGroupItem.CountryName = country.CountryName;
            }
        }
Example #4
0
        //Export Items to CSV
        public byte[] Export(int id)
        {
            StringBuilder sb = new StringBuilder();

            //Add Headers
            List <string> headers = new List <string>();

            headers.Add("Policy Group Name");
            headers.Add("City Name");
            headers.Add("City Code");
            headers.Add("PolicyCityStatusDescription");
            headers.Add("Enabled Flag");
            headers.Add("Enabled Date");
            headers.Add("Expiry Date");
            headers.Add("Travel Date Valid From");
            headers.Add("Travel Date Valid To");
            headers.Add("Inherit From Parent Flag");
            headers.Add("Creation TimeStamp");
            headers.Add("Last Update Time Stamp");
            headers.Add("Advice");

            sb.AppendLine(String.Join(",", headers.Select(x => x.ToString()).ToArray()));

            //Add Items
            List <PolicyCityGroupItem> policyCityGroupItems = db.PolicyCityGroupItems.Where(x => x.PolicyGroupId == id).ToList();

            foreach (PolicyCityGroupItem item in policyCityGroupItems)
            {
                //PolicyGroupName
                PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
                PolicyGroup           policyGroup           = new PolicyGroup();
                policyGroup = policyGroupRepository.GetGroup(item.PolicyGroupId);
                string PolicyGroupName = policyGroup.PolicyGroupName;

                int adviceCount = 0;

                string date_format = "MM/dd/yy HH:mm";

                string short_date_format = "yyyy/MM/dd";

                sb.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}",
                                !string.IsNullOrEmpty(PolicyGroupName) ? PolicyGroupName : "",
                                !string.IsNullOrEmpty(item.City.Name) ? item.City.Name : "",
                                !string.IsNullOrEmpty(item.CityCode) ? item.CityCode : "",
                                !string.IsNullOrEmpty(item.PolicyCityStatus.PolicyCityStatusDescription) ? item.PolicyCityStatus.PolicyCityStatusDescription: "",
                                item.EnabledFlag == true ? "True" : "False",
                                item.EnabledDate.HasValue ? item.EnabledDate.Value.ToString(short_date_format) : "",
                                item.ExpiryDate.HasValue ? item.ExpiryDate.Value.ToString(short_date_format) : "",
                                item.TravelDateValidFrom.HasValue ? item.TravelDateValidFrom.Value.ToString(short_date_format) : "",
                                item.TravelDateValidTo.HasValue ? item.TravelDateValidTo.Value.ToString(short_date_format) : "",
                                item.InheritFromParentFlag == true ? "True" : "False",
                                item.CreationTimestamp.HasValue ? item.CreationTimestamp.Value.ToString(date_format) : "",
                                item.LastUpdateTimestamp.HasValue ? item.LastUpdateTimestamp.Value.ToString(date_format) : "",
                                adviceCount > 0 ? "True" : "False"
                                );

                sb.Append(Environment.NewLine);
            }
            return(Encoding.ASCII.GetBytes(sb.ToString()));
        }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyHotelPropertyGroupItem policyHotelPropertyGroupItem)
        {
            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyHotelPropertyGroupItem.PolicyGroupId);
            policyHotelPropertyGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //PolicyHotelStatus
            if (policyHotelPropertyGroupItem.PolicyHotelStatusId != null)
            {
                int policyHotelStatusId = (int)policyHotelPropertyGroupItem.PolicyHotelStatusId;
                PolicyHotelStatusRepository policyHotelStatusRepository = new PolicyHotelStatusRepository();
                PolicyHotelStatus           policyHotelStatus           = new PolicyHotelStatus();
                policyHotelStatus = policyHotelStatusRepository.GetPolicyHotelStatus(policyHotelStatusId);
                policyHotelPropertyGroupItem.PolicyHotelStatus = policyHotelStatus.PolicyHotelStatusDescription;
            }

            //HarpHotel
            HarpHotelRepository harpHotelRepository = new HarpHotelRepository();
            HarpHotel           harpHotel           = new HarpHotel();

            harpHotel = harpHotelRepository.GetHarpHotel(policyHotelPropertyGroupItem.HarpHotelId);
            if (harpHotel != null)
            {
                policyHotelPropertyGroupItem.HarpHotelName = harpHotel.HarpHotelName;
            }
        }
Example #6
0
 //Add Data From Linked Tables for Display
 public void EditItemForDisplay(PolicyAirParameterGroupItem policyAirParameterGroupItem)
 {
     //populate new PolicyAirParameterGroupItem with PolicyGroupName
     if (policyAirParameterGroupItem.PolicyGroupId != 0)
     {
         PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
         PolicyGroup           policyGroup           = new PolicyGroup();
         policyGroup = policyGroupRepository.GetGroup(policyAirParameterGroupItem.PolicyGroupId);
         policyAirParameterGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;
     }
 }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyHotelVendorGroupItem policyHotelVendorGroupItem)
        {
            //PolicyHotelStatusDescription
            if (policyHotelVendorGroupItem.PolicyHotelStatusId != null)
            {
                int policyHotelStatusId = (int)policyHotelVendorGroupItem.PolicyHotelStatusId;
                PolicyHotelStatusRepository policyHotelStatusRepository = new PolicyHotelStatusRepository();
                PolicyHotelStatus           policyHotelStatus           = new PolicyHotelStatus();
                policyHotelStatus = policyHotelStatusRepository.GetPolicyHotelStatus(policyHotelStatusId);
                policyHotelVendorGroupItem.PolicyHotelStatus = policyHotelStatus.PolicyHotelStatusDescription;
            }

            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyHotelVendorGroupItem.PolicyGroupId);
            policyHotelVendorGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;
            policyHotelVendorGroupItem.PolicyGroupId   = policyGroup.PolicyGroupId;

            //SupplierName
            SupplierRepository supplierRepository = new SupplierRepository();
            Supplier           supplier           = new Supplier();

            supplier = supplierRepository.GetSupplier(policyHotelVendorGroupItem.SupplierCode, policyHotelVendorGroupItem.ProductId);
            if (supplier != null)
            {
                policyHotelVendorGroupItem.SupplierName = supplier.SupplierName;
            }

            //PolicyLocationName
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation           policyLocation           = new PolicyLocation();

            policyLocation = policyLocationRepository.GetPolicyLocation(policyHotelVendorGroupItem.PolicyLocationId);
            if (policyLocation != null)
            {
                policyHotelVendorGroupItem.PolicyLocationName = policyLocation.PolicyLocationName;
            }

            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(policyHotelVendorGroupItem.ProductId);
            if (product != null)
            {
                policyHotelVendorGroupItem.ProductName = product.ProductName;
            }
        }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicySupplierServiceInformation policySupplierServiceInformation)
        {
            //PolicySupplierServiceInformationType
            PolicySupplierServiceInformationTypeRepository policySupplierServiceInformationTypeRepository = new PolicySupplierServiceInformationTypeRepository();
            PolicySupplierServiceInformationType           policySupplierServiceInformationType           = new PolicySupplierServiceInformationType();

            policySupplierServiceInformationType = policySupplierServiceInformationTypeRepository.GetPolicySupplierServiceInformationType(policySupplierServiceInformation.PolicySupplierServiceInformationTypeId);
            if (policySupplierServiceInformationType != null)
            {
                policySupplierServiceInformation.PolicySupplierServiceInformationTypeDescription = policySupplierServiceInformationType.PolicySupplierServiceInformationTypeDescription;
            }

            //Supplier
            SupplierRepository supplierRepository = new SupplierRepository();
            Supplier           supplier           = new Supplier();

            supplier = supplierRepository.GetSupplier(policySupplierServiceInformation.SupplierCode, policySupplierServiceInformation.ProductId);
            if (supplier != null)
            {
                policySupplierServiceInformation.SupplierName = supplier.SupplierName;
            }

            //Product
            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(policySupplierServiceInformation.ProductId);
            if (product != null)
            {
                policySupplierServiceInformation.ProductName = product.ProductName;
            }

            //EnabledFlag is nullable
            if (policySupplierServiceInformation.EnabledFlag != true)
            {
                policySupplierServiceInformation.EnabledFlag = false;
            }
            policySupplierServiceInformation.EnabledFlagNonNullable = (bool)policySupplierServiceInformation.EnabledFlag;

            //PolicyGroup
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = policyGroupRepository.GetGroup(policySupplierServiceInformation.PolicyGroupId);

            policySupplierServiceInformation.PolicyGroupName = policyGroup.PolicyGroupName;
        }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyAirCabinGroupItem policyAirCabinGroupItem)
        {
            //populate new PolicyAirCabinGroupItem with PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyAirCabinGroupItem.PolicyGroupId);
            if (policyGroup != null)
            {
                policyAirCabinGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;
            }

            //AirlineCabin
            AirlineCabinRepository airlineCabinRepository = new AirlineCabinRepository();
            AirlineCabin           airlineCabin           = new AirlineCabin();

            airlineCabin = airlineCabinRepository.GetAirlineCabin(policyAirCabinGroupItem.AirlineCabinCode);
            if (airlineCabin != null)
            {
                policyAirCabinGroupItem.AirlineCabinDefaultDescription = airlineCabin.AirlineCabinDefaultDescription;
            }
        }
Example #10
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicyCarTypeGroupItem policyCarTypeGroupItem)
        {
            //PolicyGroupName
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = new PolicyGroup();

            policyGroup = policyGroupRepository.GetGroup(policyCarTypeGroupItem.PolicyGroupId);
            policyCarTypeGroupItem.PolicyGroupName = policyGroup.PolicyGroupName;

            //CarStatus
            PolicyCarStatusRepository policyCarStatusRepository = new PolicyCarStatusRepository();
            PolicyCarStatus           policyCarStatus           = new PolicyCarStatus();

            policyCarStatus = policyCarStatusRepository.GetPolicyCarStatus(policyCarTypeGroupItem.PolicyCarStatusId);
            policyCarTypeGroupItem.PolicyCarStatusDescription = policyCarStatus.PolicyCarStatusDescription;

            //CarType Category
            CarTypeCategoryRepository carTypeCategoryRepository = new CarTypeCategoryRepository();
            CarTypeCategory           carTypeCategory           = new CarTypeCategory();

            carTypeCategory = carTypeCategoryRepository.GetCarTypeCategory(policyCarTypeGroupItem.CarTypeCategoryId);
            if (carTypeCategory != null)
            {
                policyCarTypeGroupItem.CarTypeCategoryName = carTypeCategory.CarTypeCategoryName;
            }

            //PolicyLocation
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation           policyLocation           = new PolicyLocation();

            policyLocation = policyLocationRepository.GetPolicyLocation(policyCarTypeGroupItem.PolicyLocationId);
            if (policyLocation != null)
            {
                policyCarTypeGroupItem.PolicyLocation = policyLocation.PolicyLocationName;
            }
        }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(PolicySupplierDealCode policySupplierDealCode)
        {
            //PolicySupplierDealCodeType
            PolicySupplierDealCodeTypeRepository policySupplierDealCodeTypeRepository = new PolicySupplierDealCodeTypeRepository();
            PolicySupplierDealCodeType           policySupplierDealCodeType           = new PolicySupplierDealCodeType();

            policySupplierDealCodeType = policySupplierDealCodeTypeRepository.GetPolicySupplierDealCodeType(policySupplierDealCode.PolicySupplierDealCodeTypeId);
            if (policySupplierDealCodeType != null)
            {
                policySupplierDealCode.PolicySupplierDealCodeTypeDescription = policySupplierDealCodeType.PolicySupplierDealCodeTypeDescription;
            }

            //GDS
            GDSRepository gdsRepository = new GDSRepository();
            GDS           gds           = new GDS();

            gds = gdsRepository.GetGDS(policySupplierDealCode.GDSCode);
            if (gds != null)
            {
                policySupplierDealCode.GDSName = gds.GDSName;
            }

            //PolicyLocation
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
            PolicyLocation           policyLocation           = new PolicyLocation();

            policyLocation = policyLocationRepository.GetPolicyLocation((int)policySupplierDealCode.PolicyLocationId);
            if (policyLocation != null)
            {
                policySupplierDealCode.PolicyLocationName = policyLocation.PolicyLocationName;
            }

            //Supplier
            SupplierRepository supplierRepository = new SupplierRepository();
            Supplier           supplier           = new Supplier();

            supplier = supplierRepository.GetSupplier(policySupplierDealCode.SupplierCode, policySupplierDealCode.ProductId);
            if (supplier != null)
            {
                policySupplierDealCode.SupplierName = supplier.SupplierName;
            }

            //EnabledFlag is nullable
            if (policySupplierDealCode.EnabledFlag != true)
            {
                policySupplierDealCode.EnabledFlag = false;
            }
            policySupplierDealCode.EnabledFlagNonNullable = (bool)policySupplierDealCode.EnabledFlag;

            //OSIFlag is nullable
            if (policySupplierDealCode.OSIFlag != true)
            {
                policySupplierDealCode.OSIFlag = false;
            }
            policySupplierDealCode.OSIFlagNonNullable = (bool)policySupplierDealCode.OSIFlag;

            //Product
            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(policySupplierDealCode.ProductId);
            if (product != null)
            {
                policySupplierDealCode.ProductName = product.ProductName;
            }

            //PolicyGroup
            PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository();
            PolicyGroup           policyGroup           = policyGroupRepository.GetGroup(policySupplierDealCode.PolicyGroupId);

            policySupplierDealCode.PolicyGroupName = policyGroup.PolicyGroupName;

            //Tour Code Type
            TourCodeTypeRepository tourCodeTypeRepository = new TourCodeTypeRepository();
            TourCodeType           tourCodeType           = tourCodeTypeRepository.GetTourCodeType(policySupplierDealCode.TourCodeTypeId ?? 0);

            if (tourCodeType != null)
            {
                policySupplierDealCode.TourCodeType = tourCodeType;
            }
        }