コード例 #1
0
        internal void CreateFolder(EntityReference application)
        {
            TracingService.Trace($"In CreateFolder with Entity Type {application.LogicalName} and Entity Id {application.Id}");

            var applicationEntity = Query.RetrieveDataForEntityRef(Service, new[] { defra_application.Fields.defra_name, defra_application.Fields.defra_permitnumber, defra_application.Fields.defra_applicationnumber }, application);

            TracingService.Trace($"Permit Number = {applicationEntity[defra_application.Fields.defra_permitnumber]}; Application Number = {applicationEntity[defra_application.Fields.defra_applicationnumber]}");

            var request = new DocumentRelayRequest
            {
                ApplicationContentType = Config[$"{SharePointSecureConfigurationKeys.ApplicationFolderContentType}"],
                ApplicationNo          = SharePointFilters.FilterPath(applicationEntity.GetAttributeValue <string>(defra_application.Fields.defra_applicationnumber)),
                FileBody          = string.Empty,
                FileDescription   = string.Empty,
                FileName          = string.Empty,
                ListName          = Config[$"{SharePointSecureConfigurationKeys.PermitListName}"],
                PermitContentType = Config[$"{SharePointSecureConfigurationKeys.PermitFolderContentType}"],
                PermitNo          = SharePointFilters.FilterPath(applicationEntity.GetAttributeValue <string>(defra_application.Fields.defra_permitnumber)),
                Customer          = string.Empty,
                SiteDetails       = string.Empty,
                PermitDetails     = string.Empty
            };

            var stringContent = JsonConvert.SerializeObject(request);

            TracingService.Trace($"Data Sent to Logic App URL {Config[$"{SharePointSecureConfigurationKeys.DocumentRelayLogicAppUrl}"]}");

            SendRequest(Config[$"{SharePointSecureConfigurationKeys.DocumentRelayLogicAppUrl}"], stringContent);
        }
コード例 #2
0
        internal void UpdateMetaData(EntityReference entity, string customer, string siteDetails, string permitDetails)
        {
            TracingService.Trace("In UpdateMetaData with Entity Type {0} and Entity Id {1}", entity.LogicalName, entity.Id.ToString());

            var request = new MetaDataRequest();

            if (entity.LogicalName == defra_application.EntityLogicalName)
            {
                var applicationEntity = Query.RetrieveDataForEntityRef(Service, new[] { Application.Name, Application.PermitNumber, Application.ApplicationNumber, defra_application.Fields.defra_eawmlnumber }, entity);
                if (applicationEntity != null)
                {
                    TracingService.Trace($"Permit Number = {applicationEntity[Application.PermitNumber]}; Application Number = {applicationEntity[Application.ApplicationNumber]}");

                    request.ApplicationNo = SharePointFilters.FilterPath(applicationEntity.GetAttributeValue <string>(Application.ApplicationNumber));
                    request.ListName      = Config[$"{SharePointSecureConfigurationKeys.PermitListName}"];
                    request.PermitNo      = SharePointFilters.FilterPath(applicationEntity.GetAttributeValue <string>(Application.PermitNumber));
                    request.Customer      = customer;
                    request.SiteDetails   = siteDetails;
                    request.PermitDetails = permitDetails;
                    request.UpdateType    = AzureInterfaceConstants.MetaDataApplicationUpdateType;
                    request.EawmlNo       = applicationEntity.GetAttributeValue <string>(defra_application.Fields.defra_eawmlnumber);
                }
                else
                {
                    throw new InvalidPluginExecutionException(string.Format("No Application exists for entity reference {0}", entity.Id.ToString()));
                }
            }
            else if (entity.LogicalName == defra_permit.EntityLogicalName)
            {
                var permitEntity = Query.RetrieveDataForEntityRef(Service, new[] { Permit.Name, Permit.PermitNumber, defra_permit.Fields.defra_eawmlnumber }, entity);
                if (permitEntity != null)
                {
                    TracingService.Trace(string.Format("Permit Number = {0}", permitEntity[Permit.PermitNumber]));

                    request.ApplicationNo = string.Empty;
                    request.ListName      = Config[$"{SharePointSecureConfigurationKeys.PermitListName}"];
                    request.PermitNo      = permitEntity.GetAttributeValue <string>(Permit.PermitNumber);
                    request.Customer      = customer;
                    request.SiteDetails   = siteDetails;
                    request.PermitDetails = permitDetails;
                    request.UpdateType    = AzureInterfaceConstants.MetaDataPermitUpdateType;
                    request.EawmlNo       = permitEntity.GetAttributeValue <string>(defra_permit.Fields.defra_eawmlnumber);
                }
                else
                {
                    throw new InvalidPluginExecutionException(string.Format("No Permit exists for entity reference {0}", entity.Id.ToString()));
                }
            }

            var stringContent = JsonConvert.SerializeObject(request);

            TracingService.Trace($"Data Sent to Logic App URL {Config[$"{SharePointSecureConfigurationKeys.MetadataLogicAppUrl}"]}");

            SendRequest(Config[$"{SharePointSecureConfigurationKeys.MetadataLogicAppUrl}"], stringContent);
        }
コード例 #3
0
        private string GetPermitNumber(Entity queryRecord)
        {
            var permitNo = string.Empty;

            //if (queryRecord.Contains("parent.defra_permitnumber"))
            //{
            //    permitNo = (string)((AliasedValue)queryRecord.Attributes["parent.defra_permitnumber"]).Value;
            //}
            if (queryRecord.Contains("application.defra_permitnumber"))
            {
                permitNo = (string)((AliasedValue)queryRecord.Attributes["application.defra_permitnumber"]).Value;
            }
            if (queryRecord.Contains("case.application.defra_permitnumber"))
            {
                permitNo = (string)((AliasedValue)queryRecord.Attributes["case.application.defra_permitnumber"]).Value;
            }
            permitNo = SharePointFilters.FilterPath(permitNo);
            TracingService.Trace("Permit No: {0}", permitNo);
            return(permitNo);
        }
コード例 #4
0
        private string GetApplicationNumber(Entity queryRecord)
        {
            var applicationNo = string.Empty;

            //if (queryRecord.Contains("parent.defra_applicationnumber"))
            //{
            //    applicationNo = (string)((AliasedValue)queryRecord.Attributes["parent.defra_applicationnumber"]).Value;
            //    applicationNo = applicationNo.Replace('/', '_');
            //}
            if (queryRecord.Contains("application.defra_applicationnumber"))
            {
                applicationNo = (string)((AliasedValue)queryRecord.Attributes["application.defra_applicationnumber"]).Value;
            }
            if (queryRecord.Contains("case.application.defra_applicationnumber"))
            {
                applicationNo = (string)((AliasedValue)queryRecord.Attributes["case.application.defra_applicationnumber"]).Value;
            }

            applicationNo = SharePointFilters.FilterPath(applicationNo);
            TracingService.Trace("Application No: {0}", applicationNo);
            return(applicationNo);
        }