Beispiel #1
0
        public async Task GeocodeEstablishment(PerformContext hangfireContext, string establishmentId)
        {
            if (hangfireContext != null)
            {
                hangfireContext.WriteLine("Geocoding an establishment");
            }

            var establishment = _dynamics.GetEstablishmentById(establishmentId);

            await GeocodeEstablishment(hangfireContext, establishment);
        }
        public static async Task <MicrosoftDynamicsCRMadoxioApplication> GetApplicationByIdWithChildren(this IDynamicsClient system, Guid id)
        {
            MicrosoftDynamicsCRMadoxioApplication result;

            try
            {
                string[] expand = { "adoxio_localgovindigenousnationid", "adoxio_application_SharePointDocumentLocations", "adoxio_AssignedLicence" };

                // fetch from Dynamics.
                result = await system.Applications.GetByKeyAsync(id.ToString(), expand : expand);

                if (result._adoxioLicencetypeValue != null)
                {
                    result.AdoxioLicenceType = system.GetAdoxioLicencetypeById(Guid.Parse(result._adoxioLicencetypeValue));
                }

                if (result._adoxioApplicantValue != null)
                {
                    result.AdoxioApplicant = await system.GetAccountById(Guid.Parse(result._adoxioApplicantValue));
                }

                if (result.AdoxioAssignedLicence != null && result.AdoxioAssignedLicence._adoxioEstablishmentValue != null)
                {
                    result.AdoxioAssignedLicence.AdoxioEstablishment = system.GetEstablishmentById(Guid.Parse(result.AdoxioAssignedLicence._adoxioEstablishmentValue));
                }
            }
            catch (Gov.Lclb.Cllb.Interfaces.Models.OdataerrorException)
            {
                result = null;
            }
            return(result);
        }
        public IActionResult GetEstablishment(string id)
        {
            Guid adoxio_establishment_id;

            if (string.IsNullOrEmpty(id) || !Guid.TryParse(id, out adoxio_establishment_id))
            {
                return(new NotFoundResult());
            }

            // get the establishment
            var establishment = _dynamicsClient.GetEstablishmentById(adoxio_establishment_id);

            if (establishment == null)
            {
                return(new NotFoundResult());
            }

            return(new JsonResult(establishment.ToViewModel()));
        }