Ejemplo n.º 1
0
        public void OnPost()
        {
            DataFetched = true;

            businessLicenses             = BusinessLicenses.FromJson(getJSONData(createURL("https://data.cityofchicago.org/resource/r5kz-chrr.json?$where=account_number%20<%2051", Request.Form["Activity"])));
            ViewData["BusinessLicenses"] = businessLicenses;

            businessOwners             = BusinessOwners.FromJson(getJSONData("https://data.cityofchicago.org/resource/ezma-pppn.json?$where=account_number%20<%2051"));
            ViewData["BusinessOwners"] = businessOwners;
            searchJSON();
        }
Ejemplo n.º 2
0
        public void OnGet()
        {
            businessLicenses             = BusinessLicenses.FromJson(getJSONData("https://data.cityofchicago.org/resource/r5kz-chrr.json?$where=account_number%20<%2051"));
            ViewData["BusinessLicenses"] = businessLicenses;

            businessOwners             = BusinessOwners.FromJson(getJSONData("https://data.cityofchicago.org/resource/ezma-pppn.json?$where=account_number%20<%2051"));
            ViewData["BusinessOwners"] = businessOwners;
            BusinessActivitySet        = new HashSet <string>();

            licenseDictionary = new Dictionary <string, BusinessLicenses>();

            foreach (BusinessLicenses businessLicense in businessLicenses)
            {
                if (!licenseDictionary.ContainsKey((businessLicense.AccountNumber + "_" + businessLicense.SiteNumber) + ""))
                {
                    licenseDictionary.Add((businessLicense.AccountNumber + "_" + businessLicense.SiteNumber) + "", businessLicense);
                }
            }
            foreach (BusinessOwners owners in businessOwners)
            {
                foreach (var license in licenseDictionary)
                {
                    if (license.Value.AccountNumber == owners.AccountNumber)
                    {
                        if (license.Value.BusinessActivity != null && license.Value.BusinessActivity.Trim() != "")
                        {
                            BusinessActivitySet.Add(license.Value.BusinessActivity);
                        }

                        businessLicenseOwner = new BusinessLicenseOwners();
                        businessLicenseOwner.AccountNumber       = license.Value.AccountNumber;
                        businessLicenseOwner.BusinessActivity    = license.Value.BusinessActivity;
                        businessLicenseOwner.State               = license.Value.State;
                        businessLicenseOwner.City                = license.Value.City;
                        businessLicenseOwner.LicenseNumber       = license.Value.LicenseNumber;
                        businessLicenseOwner.OwnerFirstName      = owners.OwnerFirstName;
                        businessLicenseOwner.OwnerLastName       = owners.OwnerLastName;
                        businessLicenseOwner.OwnerTitle          = owners.OwnerTitle;
                        businessLicenseOwner.DoingBusinessAsName = license.Value.DoingBusinessAsName;
                        businessLicenseOwnersList.Add(businessLicenseOwner);
                    }
                }
                ViewData["BusinessLicenseOwners"] = businessLicenseOwnersList;
            }
        }
Ejemplo n.º 3
0
        public JsonResult OnGet()
        {
            IndexModel index = new IndexModel();

            businessLicenses             = BusinessLicenses.FromJson(index.getJSONData("https://data.cityofchicago.org/resource/r5kz-chrr.json?$where=account_number%20<%2051"));
            ViewData["BusinessLicenses"] = businessLicenses;

            businessOwners             = BusinessOwners.FromJson(index.getJSONData("https://data.cityofchicago.org/resource/ezma-pppn.json?$where=account_number%20<%2051"));
            ViewData["BusinessOwners"] = businessOwners;

            IDictionary <string, BusinessLicenses> licenseDictionary = new Dictionary <string, BusinessLicenses>();

            foreach (BusinessLicenses businessLicense in businessLicenses)
            {
                if (!licenseDictionary.ContainsKey((businessLicense.AccountNumber + "_" + businessLicense.SiteNumber) + ""))
                {
                    licenseDictionary.Add((businessLicense.AccountNumber + "_" + businessLicense.SiteNumber) + "", businessLicense);
                }
            }

            foreach (BusinessOwners owners in businessOwners)
            {
                foreach (var license in licenseDictionary)
                {
                    if (license.Value.AccountNumber == owners.AccountNumber)
                    {
                        businessLicenseOwner = new BusinessLicenseOwners();
                        businessLicenseOwner.AccountNumber       = license.Value.AccountNumber;
                        businessLicenseOwner.BusinessActivity    = license.Value.BusinessActivity;
                        businessLicenseOwner.State               = license.Value.State;
                        businessLicenseOwner.City                = license.Value.City;
                        businessLicenseOwner.LicenseNumber       = license.Value.LicenseNumber;
                        businessLicenseOwner.OwnerFirstName      = owners.OwnerFirstName;
                        businessLicenseOwner.OwnerLastName       = owners.OwnerLastName;
                        businessLicenseOwner.OwnerTitle          = owners.OwnerTitle;
                        businessLicenseOwner.DoingBusinessAsName = license.Value.DoingBusinessAsName;
                        businessLicenseOwnersList.Add(businessLicenseOwner);
                    }
                }
            }
            return(new JsonResult(businessLicenseOwnersList));
        }