Esempio n. 1
0
        public async void RecognizeContentFromFile()
        {
            var decision = await _decisionsService.GetFirstUnparsedDecisionNotCachedRepository();

            var         file = DownloadFile(decision.SourceLink);
            DecisionDto decisionWithParsedParameters = GOTODbInitializer(file);
            string      content = RunOCRInMemoryToGenerateContent(file);
        }
        public async Task <IDecisionDto> SaveAsync(IDecisionDto update)
        {
            UpdateResultDto result;

            try
            {
                // Check Update.
                if (update == null)
                {
                    throw new NullReferenceException("Update can NOT be NULL.");
                }

                // Create Vehicle Makes.
                var vehicleMakes = update.VehicleMakes.Where(m => m.SelectedInd)
                                   .Select(m => new { TypeId = m.VehicleMakeId, TypePreSelectedInd = m.PreSelectedInd }).GetSettingsTable();

                // Create Request Types.
                var requestTypes = update.RequestTypes.Where(t => t.SelectedInd)
                                   .Select(t => new { TypeId = t.RequestTypeId, TypePreSelectedInd = t.PreSelectedInd }).GetSettingsTable();

                // Create Request Categories.
                var requestCategories = update.RequestCategories.Where(c => c.SelectedInd)
                                        .Select(c => new { TypeId = c.RequestCategoryId, TypePreSelectedInd = c.PreSelectedInd }).GetSettingsTable();

                // Create Parameter.
                var param = new
                {
                    User.UserGuid,
                    update.DecisionId,
                    update.DecisionText,
                    DefaultTextSeverity = (int)update.DefaultTextSeverity,
                    update.ActiveInd,
                    VehicleMakes      = vehicleMakes,
                    RequestTypes      = requestTypes,
                    RequestCategories = requestCategories
                };

                // Execute Update.
                var decisionId = (await Conn.QueryAsync <int>("Scan.usp_SaveDecision", param, null, null, CommandType.StoredProcedure)).First();

                // Set Result.
                result = new UpdateResultDto(true, "Decision Updated.");

                // Load Request.
                update = await GetByIdAsync(decisionId.ToString());
            }
            catch (Exception e)
            {
                // Log Error.
                Logger.LogException(e);

                // Set Error Result.
                result = new UpdateResultDto(false, e.Message);
            }

            // Set Result.
            if (update == null)
            {
                update = new DecisionDto();
            }
            update.UpdateResult = result;

            // Return.
            return(update);
        }
Esempio n. 3
0
        Task <bool> IDecisionsService.AddNewDecision(DecisionDto dto)
        {
            //TODO nie jestem pewien jak dziala cache documentow na razie zrobilem na _context

            throw new NotImplementedException();
        }