Beispiel #1
0
 public async Task <ICollection <Fascicle> > GetPeriodicFasciclesAsync()
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Fascicle>();
         ODataModel <Fascicle> result = (await _httpClient.GetAsync <Fascicle>()
                                         .WithOData(string.Concat("$filter=FascicleType eq VecompSoftware.DocSuiteWeb.Entity.Fascicles.FascicleType\'", FascicleType.Period, "\' and Category/isActive eq 1&$expand=Category,FasciclePeriod"))
                                         .ResponseToModelAsync <ODataModel <Fascicle> >());
         return result.Value;
     }, $"WebAPIClient.GetPeriodicFasciclesAsync -> GET entities error"));
 }
Beispiel #2
0
 public async Task <Protocol> GetProtocolAsync(Guid uniqueId)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Protocol>();
         ODataModel <Protocol> protocol = (await _httpClient.GetAsync <Protocol>()
                                           .WithOData(string.Concat("$filter=UniqueId eq ", uniqueId))
                                           .ResponseToModelAsync <ODataModel <Protocol> >());
         return protocol == null || protocol.Value == null || !protocol.Value.Any() ? null : protocol.Value.Single();;
     }, $"WebAPIClient.GetProtocolAsync -> GET entities error"));
 }
Beispiel #3
0
 public async Task <Fascicle> GetAvailablePeriodicFascicleByDocumentUnitAsync(DocumentUnit documentUnit)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Fascicle>();
         ODataModel <Fascicle> result = (await _httpClient.GetAsync <Fascicle>()
                                         .WithRowQuery(string.Format("/FascicleService.PeriodicFascicles(uniqueId = {0})", documentUnit.UniqueId))
                                         .ResponseToModelAsync <ODataModel <Fascicle> >());
         return result.Value.SingleOrDefault();
     }, $"WebAPIClient.GetAvailablePeriodicFascicleByDocumentUnitAsync -> GET entities error"));
 }
Beispiel #4
0
 public async Task <Container> GetContainerAsync(int idContainer)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Container>();
         ODataModel <Container> container = (await _httpClient.GetAsync <Container>()
                                             .WithOData(string.Concat("$filter=EntityShortId eq ", idContainer))
                                             .ResponseToModelAsync <ODataModel <Container> >());
         return container == null || container.Value == null || !container.Value.Any() ? null : container.Value.Single();
     }, $"WebAPIClient.GetContainerAsync -> GET entities error"));
 }
Beispiel #5
0
 public async Task <DocumentUnit> GetDocumentUnitAsync(DocumentUnit documentUnit)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <DocumentUnit>();
         ODataModel <DocumentUnit> result = (await _httpClient.GetAsync <DocumentUnit>()
                                             .WithOData(string.Concat("$filter=UniqueId eq ", documentUnit.UniqueId, "&$expand=DocumentUnitRoles,DocumentUnitChains,DocumentUnitUsers,Fascicle,Category,Container,UDSRepository"))
                                             .ResponseToModelAsync <ODataModel <DocumentUnit> >());
         return result.Value.SingleOrDefault();
     }, $"WebAPIClient.GetDocumentUnitAsync -> GET entities error"));
 }
Beispiel #6
0
 public async Task <DocumentUnitFascicleCategory> GetDocumentUnitFascicleCategoryAsync(Guid idDocumentUnit, short idCategory, Guid idFascicle)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <DocumentUnitFascicleCategory>();
         ODataModel <DocumentUnitFascicleCategory> documentUnitFascicleCategory = await _httpClient.GetAsync <DocumentUnitFascicleCategory>()
                                                                                  .WithOData($"$filter=DocumentUnit/UniqueId eq {idDocumentUnit} and Category/EntityShortId eq {idCategory} and Fascicle/UniqueId eq {idFascicle}")
                                                                                  .ResponseToModelAsync <ODataModel <DocumentUnitFascicleCategory> >();
         return documentUnitFascicleCategory == null || documentUnitFascicleCategory.Value == null || !documentUnitFascicleCategory.Value.Any() ? null : documentUnitFascicleCategory.Value.Single();
     }, $"WebAPIClient.GetDocumentUnitFascicleCategoryAsync -> GET entities error"));
 }
Beispiel #7
0
 public async Task <Location> GetLocationAsync(short idLocation)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Location>();
         ODataModel <Location> location = (await _httpClient.GetAsync <Location>()
                                           .WithOData(string.Concat("$filter=EntityShortId eq ", idLocation))
                                           .ResponseToModelAsync <ODataModel <Location> >());
         return location == null || location.Value == null || !location.Value.Any() ? null : location.Value.Single();
     }, $"WebAPIClient.GetLocationAsync -> GET entities error"));
 }
Beispiel #8
0
 public async Task <Fascicle> GetFascicleByIdAsync(Guid uniqueId)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Fascicle>();
         ODataModel <Fascicle> fascicle = await _httpClient.GetAsync <Fascicle>()
                                          .WithOData($"$filter=UniqueId eq {uniqueId}&$expand=Category,Contacts,FascicleDocuments,MetadataRepository")
                                          .ResponseToModelAsync <ODataModel <Fascicle> >();
         return fascicle == null || fascicle.Value == null || !fascicle.Value.Any() ? null : fascicle.Value.Single();
     }, $"WebAPIClient.GetFascicleByIdAsync -> GET entities error"));
 }
Beispiel #9
0
 public async Task <Fascicle> GetFascicleAsync(Guid documentUnitId)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <FascicleDocumentUnit>();
         ODataModel <FascicleDocumentUnit> fascicleDocumentUnit = await _httpClient.GetAsync <FascicleDocumentUnit>()
                                                                  .WithOData($"$filter=DocumentUnit/UniqueId eq {documentUnitId} and ReferenceType eq VecompSoftware.DocSuiteWeb.Entity.Fascicles.ReferenceType'{ReferenceType.Fascicle}'&$expand=Fascicle")
                                                                  .ResponseToModelAsync <ODataModel <FascicleDocumentUnit> >();
         return fascicleDocumentUnit == null || fascicleDocumentUnit.Value == null || !fascicleDocumentUnit.Value.Any() ? null : fascicleDocumentUnit.Value.Single().Fascicle;
     }, $"WebAPIClient.GetFascicleAsync -> GET entities error"));
 }
Beispiel #10
0
 public async Task <UDSSchemaRepository> GetCurrentUDSSchemaRepositoryAsync()
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <UDSSchemaRepository>();
         ODataModel <UDSSchemaRepository> currentSchemaRepository = (await _httpClient.GetAsync <UDSSchemaRepository>()
                                                                     .WithOData("$filter=ExpiredDate eq null")
                                                                     .ResponseToModelAsync <ODataModel <UDSSchemaRepository> >());
         return currentSchemaRepository == null || currentSchemaRepository.Value == null || !currentSchemaRepository.Value.Any() ? null : currentSchemaRepository.Value.Single();
     }, $"WebAPIClient.GetCurrentUDSSchemaRepositoryAsync -> GET entities error"));
 }
Beispiel #11
0
 public async Task <Collaboration> GetCollaborationAsync(int idCollaboration)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <Collaboration>();
         ODataModel <Collaboration> collaboration = (await _httpClient.GetAsync <Collaboration>()
                                                     .WithOData(string.Format("$filter=EntityId eq {0}", idCollaboration))
                                                     .ResponseToModelAsync <ODataModel <Collaboration> >());
         return collaboration == null || collaboration.Value == null || !collaboration.Value.Any() ? null : collaboration.Value.Single();
     }, $"WebAPIClient.GetCollaborationAsync -> GET entities error"));
 }
Beispiel #12
0
 public async Task <PECMail> GetPECMailAsync(int idPECMail)
 {
     return(await ExecuteHelper(async() =>
     {
         _httpClient.SetEntityODATA <PECMail>();
         ODataModel <PECMail> pecMail = (await _httpClient.GetAsync <PECMail>()
                                         .WithOData(string.Format("$filter=EntityId eq {0}", idPECMail))
                                         .ResponseToModelAsync <ODataModel <PECMail> >());
         return pecMail == null || pecMail.Value == null || !pecMail.Value.Any() ? null : pecMail.Value.Single();
     }, $"WebAPIClient.GetPECMailAsync -> GET entities error"));
 }
Beispiel #13
0
        public async Task <UDSRepository> GetCurrentUDSRepositoryAsync(string udsRepositoryName)
        {
            return(await ExecuteHelper(async() =>
            {
                _httpClient.SetEntityODATA <UDSRepository>();
                ODataModel <UDSRepository> currentRepository = (await _httpClient.GetAsync <UDSRepository>()
                                                                .WithOData(string.Concat("$filter=Name eq \'", udsRepositoryName, "\' and ExpiredDate eq null and Status eq VecompSoftware.DocSuiteWeb.Entity.UDS.UDSRepositoryStatus\'", DocSuiteWeb.Entity.UDS.UDSRepositoryStatus.Confirmed, "\'&$orderby=version desc"))
                                                                .ResponseToModelAsync <ODataModel <UDSRepository> >());

                return currentRepository == null || currentRepository.Value == null || !currentRepository.Value.Any() ? null : currentRepository.Value.Single();
            }, $"WebAPIClient.GetCurrentUDSRepositoryAsync -> GET entities error"));
        }
Beispiel #14
0
        public async Task <Dossier> GetDossierByIdAsync(Guid uniqueId, string optionalFilter = null)
        {
            return(await ExecuteHelper(async() =>
            {
                _httpClient.SetEntityODATA <Dossier>();

                string baseOdataFilter = $"$filter=UniqueId eq {uniqueId}";
                string odataQuery = string.IsNullOrEmpty(optionalFilter) ? baseOdataFilter : $"{baseOdataFilter}&{optionalFilter}";

                ODataModel <Dossier> dossier = await _httpClient.GetAsync <Dossier>()
                                               .WithOData(odataQuery)
                                               .ResponseToModelAsync <ODataModel <Dossier> >();
                return dossier == null || dossier.Value == null || !dossier.Value.Any() ? null : dossier.Value.Single();
            }, $"WebAPIClient.GetDossierByIdAsync -> GET entities error"));
        }
Beispiel #15
0
        public async Task <Role> GetRoleAsync(RoleModel roleModel)
        {
            return(await ExecuteHelper(async() =>
            {
                _httpClient.SetEntityODATA <Role>();

                if (!roleModel.IdRole.HasValue && !roleModel.UniqueId.HasValue)
                {
                    _logger.WriteWarning(new LogMessage("RoleModel non ha nessun id specificato."), LogCategories);
                    return null;
                }
                string odataFilter = roleModel.IdRole.HasValue ? "$filter=EntityShortId eq " : "$filter=UniqueId eq ";
                string idRole = roleModel.IdRole.HasValue ? roleModel.IdRole.Value.ToString() : roleModel.UniqueId.ToString();

                ODataModel <Role> role = (await _httpClient.GetAsync <Role>()
                                          .WithOData(string.Concat(odataFilter, idRole))
                                          .ResponseToModelAsync <ODataModel <Role> >());
                return role == null || role.Value == null || !role.Value.Any() ? null : role.Value.Single();
            }, $"WebAPIClient.GetRoleAsync -> GET entities error"));
        }