public async Task <IActionResult> DettaglioDistinta(NewStoricoCartelle filtroRicerca) { // GET /StoricoCartelle/DettaglioDistinta/DIP05420180726H00001 Task <NewStoricoCartelle.Dettaglio_Distinta> result = null; try { _logger.LogInformation("execute stored procedure: new_dettaglio_distinte_storico_cartelle_3"); var spReturnValue = new DAL.StoredProcedure.SP_new_dettaglio_distinte_storico_cartelle_3(RepositoryContext); result = spReturnValue.Get(filtroRicerca.Distinta); filtroRicerca.dettaglioDistinta = result.Result; if (result is null) { return(Content("Distinta non presente")); } return(Ok(filtroRicerca)); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(Content(ex.Message)); } }
public async Task <IActionResult> RicercaPerCodiceRaccomandata(NewStoricoCartelle filtroRicerca) { // POST /StoricoCartelle/RicercaPerCodiceRaccomandata Task <IEnumerable <NewStoricoCartelle.Raccomandata> > result = null; try { string seperator = ","; //string data = string.Join(seperator, filtroRicerca.codiciRaccomandata); string data = filtroRicerca.CodiciRaccomandata.Replace("\r\n", seperator); // esegue la query con i parametri passati da URL _logger.LogInformation("Query insert execution"); var connectionString = RepositoryContext.ConnectionString; string commandText; using (SqlConnection connection = new SqlConnection(connectionString)) { commandText = $"INSERT new_code_racc_storico_cartelle(code_racc) SELECT * FROM DA_STRINGA_A_TABELLA('" + data + "',','" + ")"; EseguiQuery(commandText, connection); } _logger.LogInformation("execute stored procedure: SP_new_dettaglio_elenco_racc_storico_cartelle"); var spNewDettaglioElencoRaccStoricoCartelle = new DAL.StoredProcedure.SP_new_dettaglio_elenco_racc_storico_cartelle(RepositoryContext); result = spNewDettaglioElencoRaccStoricoCartelle.GetAll(); filtroRicerca.Raccomandate = result.Result; using (SqlConnection connection = new SqlConnection(connectionString)) { _logger.LogInformation("Query: \"delete from new_code_racc_storico_cartelle\" execution"); commandText = $"delete from new_code_racc_storico_cartelle"; EseguiQuery(commandText, connection); } } catch (Exception ex) { _logger.LogError(ex, ex.Message); } return(Ok(filtroRicerca)); }
public async Task <IActionResult> RaccomandateInDistinta(NewStoricoCartelle filtroRicerca) { // GET /StoricoCartelle/RaccomandateInDistinta/DIP05420180726H00001 Task <IEnumerable <NewStoricoCartelle.Elenco_Raccomandate_In_Distinta> > result = null; try { _logger.LogInformation("Stored procedure execution: new_dettaglio_distinte_storico_cartelle_2"); var nddsc2Query = new DAL.StoredProcedure.SP_new_dettaglio_distinte_storico_cartelle2(RepositoryContext); result = nddsc2Query.Get(filtroRicerca.Distinta); filtroRicerca.RaccomandateInDistinta = result.Result; return(Ok(filtroRicerca)); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(Content(ex.Message)); } }
public async Task <IActionResult> RicercaPerDataPostalizzazioneRaccomadata(NewStoricoCartelle filtroRicerca) { // GET /StoricoCartelle/RicercaPerDataPostalizzazioneRaccomadata/2019-05-01/2019-05-21 Task <IEnumerable <NewStoricoCartelle.Elenco_Distinte> > result = null; try { _logger.LogInformation("Stored procedure execution: new_dettaglio_distinte_storico_cartelle"); var nddscQuery = new DAL.StoredProcedure.SP_new_dettaglio_distinte_storico_cartelle(RepositoryContext); result = nddscQuery.Get(Convert.ToDateTime(filtroRicerca.DalGiorno), Convert.ToDateTime(filtroRicerca.AlGiorno)); filtroRicerca.ElencoDistinte = result.Result; } catch (Exception ex) { _logger.LogError(ex, ex.Message); //return Content(ex.Message); } return(Ok(filtroRicerca)); }