Beispiel #1
0
        private void PrepareTemplateList()
        {
            FlowInspectorApplication.CountryTemplateModel = new List <DataSet.CountryTemplateModel>();

            List <Service>       allServices   = Service.CreateManager().Load();
            List <Data.Merchant> addedMerchant = new List <Data.Merchant>();

            foreach (Service s in allServices)
            {
                CountryTemplateModel countryTemplateModel = this.GetByCountry(s.FallbackCountry);

                if (countryTemplateModel == null)
                {
                    countryTemplateModel = new DataSet.CountryTemplateModel(s.FallbackCountry);
                    FlowInspectorApplication.CountryTemplateModel.Add(countryTemplateModel);
                }

                MerchantTemplateModel merchantTemplateModel = countryTemplateModel[s.Merchant.ID];
                if (merchantTemplateModel == null)
                {
                    merchantTemplateModel = new MerchantTemplateModel(s.Merchant);
                    countryTemplateModel.Merchants.Add(merchantTemplateModel);
                }

                ServiceTemplateModel serviceTemplateModel = merchantTemplateModel[s.ID];
                if (serviceTemplateModel == null)
                {
                    serviceTemplateModel = new ServiceTemplateModel(s);
                    merchantTemplateModel.Services.Add(serviceTemplateModel);
                }
            }
        }
Beispiel #2
0
        public static ServiceTemplateModel GetServiceModel(Service service)
        {
            CountryTemplateModel ctm = (from c in FlowInspectorApplication.CountryTemplateModel where c.ID == service.FallbackCountry.ID select c).FirstOrDefault();

            if (ctm == null)
            {
                return(null);
            }

            MerchantTemplateModel mtm = (from m in ctm.Merchants where m.ID == service.Merchant.ID select m).FirstOrDefault();

            if (mtm == null)
            {
                return(null);
            }

            return((from s in mtm.Services where s.ID == service.ID select s).FirstOrDefault());
        }