Exemplo n.º 1
0
        public async Task <IActionResult> ByIdAndDate(int id, string date)
        {
            var dto = new QueriesToPassDto()
            {
                SqlFunctionById               = SqlFunctionDictionary.ByIdFund,
                SqlFunctionActiveSE           = SqlFunctionDictionary.FundActiveSubFunds,
                SqlFunctionDistinctDocuments  = SqlFunctionDictionary.DistinctDocumentsFund,
                SqlFunctionDistinctAgreements = SqlFunctionDictionary.DistinctAgreementsFund,
            };

            var viewModel = await SpecificVMSetup.SetGet <SpecificEntityViewModel>(id, date, this.service, this.fundService, dto);

            return(this.View(viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ByIdAndDate(int id, string date)
        {
            var dto = new QueriesToPassDto()
            {
                SqlFunctionById = SqlFunctionDictionary.ByIdShareClass,
                SqlFunctionDistinctDocuments  = SqlFunctionDictionary.DistinctDocumentsShareClass,
                SqlFunctionDistinctAgreements = SqlFunctionDictionary.DistinctAgreementsShareClass,
                SqlFunctionContainer          = SqlFunctionDictionary.ContainerSubFund,
            };

            var viewModel = await SpecificVMSetup.SetGet <SpecificEntityViewModel>(id, date, this.service, this.shareClassService, dto);

            await this.recentService.Save(this.User, this.Request.Path);

            return(this.View(viewModel));
        }
Exemplo n.º 3
0
        public static async Task <T> SetGet <T>(int id, string date, IEntityDetailsService service, IEntityException exceptionService, QueriesToPassDto queryDto)
        {
            exceptionService.DoesExist(id);

            var dateParsed = DateTimeExtensions.FromWebFormat(date);
            var entity     = await service.ByIdAndDate(queryDto.SqlFunctionById, id, dateParsed).ToListAsync();

            string   startConnectionString = entity.ToList()[1][IndexStartConnectionInSQLTable];
            string   endConnectionString   = entity.ToList()[1][IndexEndConnectionInSQLTable];
            DateTime?endConnection         = null;

            if (!string.IsNullOrWhiteSpace(endConnectionString) && endConnectionString != GlobalConstants.EmptyEndConnectionDisplay)
            {
                endConnection = DateTimeExtensions.FromSqlFormat(endConnectionString);
            }

            var dto = new DetailsDto()
            {
                Id              = id,
                Date            = date,
                Entity          = entity,
                StartConnection = DateTimeExtensions.FromSqlFormat(startConnectionString),
                EndConnection   = endConnection,
            };

            if (queryDto.SqlFunctionContainer != null)
            {
                dto.Container = service.GetContainer(queryDto.SqlFunctionContainer, id, dateParsed);
            }

            if (queryDto.SqlFunctionActiveSE != null)
            {
                var subEntities = await service.GetSubEntities(queryDto.SqlFunctionActiveSE, id, dateParsed, 1).ToListAsync();

                dto.SubEntityCount = subEntities.Count;
            }

            return(AutoMapperConfig.MapperInstance.Map <T>(dto));
        }