コード例 #1
0
        public JObject GetDefaultData()
        {
            JObject data = new JObject();

            //additional_charge
            JArray additionalCharges = new JArray();
            var    allCharges        = _acs.GetAllAdditionalCharge();

            foreach (var charge in allCharges)
            {
                JObject additionalCharge = new JObject();
                additionalCharge.Add("ID", charge.ID);
                additionalCharge.Add("Percentage", charge.Percentage);
                additionalCharge.Add("Version", charge.Version);
                var chargeDataEN = _acs.GetAdditionalChargeENData(charge.ID);
                if (chargeDataEN != null)
                {
                    additionalCharge.Add("NameEN", chargeDataEN.name);
                }

                var chargeDataMK = _acs.GetAdditionalChargeMKData(charge.ID);
                if (chargeDataMK != null)
                {
                    additionalCharge.Add("NameMK", chargeDataMK.name);
                }
                additionalCharges.Add(additionalCharge);
            }
            data.Add("additional_charges", additionalCharges);

            //banks
            JArray banks    = new JArray();
            var    allBanks = _bas.GetAllBanks();

            foreach (var bank in allBanks)
            {
                JObject bankObject = new JObject();
                bankObject.Add("ID", bank.ID);
                bankObject.Add("Name", bank.Name);
                banks.Add(bankObject);
            }
            data.Add("banks", banks);

            //banks prefix
            JArray banksPrefix = new JArray();
            var    allPrefixs  = _bas.GetAllPrefix();

            foreach (var prefix in allPrefixs)
            {
                JObject prefixObject = new JObject();
                prefixObject.Add("Bank_ID", prefix.Bank_ID);
                prefixObject.Add("Prefix_Number", prefix.Prefix_Number);
                banksPrefix.Add(prefixObject);
            }
            data.Add("banksPrefix", banksPrefix);

            //travel number
            JArray travelNumber    = new JArray();
            var    allTravelNumber = _tn.GetAllTravelNumbers();

            foreach (var number in allTravelNumber)
            {
                JObject numberObject = new JObject();
                numberObject.Add("ID", number.ID);
                numberObject.Add("Name", number.Name);
                travelNumber.Add(numberObject);
            }
            data.Add("travelNumber", travelNumber);

            //countries
            JArray countries    = new JArray();
            var    allCountries = _coun.GetAllCountries();

            foreach (var country in allCountries)
            {
                JObject countryObject = new JObject();
                countryObject.Add("ID", country.ID);
                var countryDataEN = _coun.GetCountriesENData(country.ID);
                if (countryDataEN != null)
                {
                    countryObject.Add("NameEN", countryDataEN.name);
                }

                var countryDataMK = _coun.GetACountriesMKData(country.ID);
                if (countryDataMK != null)
                {
                    countryObject.Add("NameMK", countryDataMK.name);
                }
                countries.Add(countryObject);
            }
            data.Add("countries", countries);

            //exchange rate
            JArray exchangeRates = new JArray();
            var    allRates      = _exch.GetAllExchangeRates();

            foreach (var rate in allRates)
            {
                JObject rateObject = new JObject();
                rateObject.Add("ID", rate.ID);
                rateObject.Add("Currency", rate.Currency);
                rateObject.Add("Value", rate.Value);
                rateObject.Add("Version", rate.Version);
                exchangeRates.Add(rateObject);
            }
            data.Add("exchangeRates", exchangeRates);

            //policy Types
            JArray policyTypes    = new JArray();
            var    allPolicyTypes = _pts.GetAllPolicyType();

            foreach (var policyType in allPolicyTypes)
            {
                JObject policyObject = new JObject();
                policyObject.Add("ID", policyType.ID);
                policyObject.Add("Name", policyType.type);
                policyTypes.Add(policyObject);
            }
            data.Add("policyTypes", policyTypes);

            //Retaining Risks
            JArray retainingRisks    = new JArray();
            var    allRetainingRisks = _fran.GetAllRetainingRisks();

            foreach (var risk in allRetainingRisks)
            {
                JObject riskObject = new JObject();
                riskObject.Add("ID", risk.ID);
                var riskDataEN = _fran.GetRetainingRiskENData(risk.ID);
                if (riskDataEN != null)
                {
                    riskObject.Add("NameEN", riskDataEN.name);
                }

                var riskDataMK = _fran.GetRetainingRiskMKData(risk.ID);
                if (riskDataMK != null)
                {
                    riskObject.Add("NameMK", riskDataMK.name);
                }
                if (!(riskDataMK == null || riskDataEN == null))
                {
                    retainingRisks.Add(riskObject);
                }
            }
            data.Add("retainingRisk", retainingRisks);
            return(data);
        }