コード例 #1
0
        private ResultStoredViewModel <DateTime> Traslate(OutputStored <DateTime> dataChiusura)
        {
            var result = new ResultStoredViewModel <DateTime>()
            {
                Entita = dataChiusura.Entita
            };

            if (dataChiusura.Errore)
            {
                result.ImpostaErrore(dataChiusura.Error_Number.Value, dataChiusura.Error_msg.Value);
            }
            return(result);
        }
コード例 #2
0
        private ResultStoredViewModel <DispaccioViewModel> Traslate(OutputStored <NewDispaccioIn> nuovoDispaccio)
        {
            var result = new ResultStoredViewModel <DispaccioViewModel>()
            {
                Entita = Traslate(nuovoDispaccio.Entita)
            };

            if (nuovoDispaccio.Errore)
            {
                result.ImpostaErrore(nuovoDispaccio.Error_Number.Value, nuovoDispaccio.Error_msg.Value);
            }

            return(result);
        }
コード例 #3
0
        private async Task EseguiQuery(QueryManagerViewModel queryManagerViewModel, ResultStoredViewModel <string[][]> result, string queryToExecute)
        {
            var connectionString = RepositoryContext.ConnectionString;

            using (var connection = new SqlConnection(connectionString))
                using (var cmd = new SqlCommand(queryToExecute, connection))
                {
                    connection.Open();
                    try
                    {
                        result.Entita = await ExecuteQuery(cmd);
                    }
                    catch (Exception queryException)
                    {
                        result.ImpostaErrore(queryException.HResult,
                                             string.Format("{0} - {1}", queryManagerViewModel.SelectedQuery.Descrizione,
                                                           queryException.Message));
                    }
                }
        }