|
|
|
@ -21,6 +21,7 @@ using IO.Swagger.DTO; |
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
@ -189,6 +190,32 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")] |
|
|
|
|
public virtual async Task<IActionResult> GetEPEnCours([FromQuery]List<long?> idBUs, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPAge, [FromQuery]string texte, [FromQuery]string tri, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<EpInformationDTO> epEnCours; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
epEnCours = await epInformationService.GetEPEnCours(idBUs, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
} |
|
|
|
|
catch (DbUpdateException e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur inconnue est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
return Ok(epEnCours); |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<EpInformationDTO>)); |
|
|
|
|
|
|
|
|
@ -200,13 +227,6 @@ namespace IO.Swagger.Controllers |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(500, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 9,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 9,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<EpInformationDTO>>(exampleJson) |
|
|
|
|
: default(List<EpInformationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -326,6 +346,32 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")] |
|
|
|
|
public virtual async Task<IActionResult> GetEPEnCoursCount([FromQuery]List<long?> idBUs, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPAge, [FromQuery]string texte, [FromQuery]string tri, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin) |
|
|
|
|
{ |
|
|
|
|
int nbEpEnCours = 0; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
nbEpEnCours = await epInformationService.GetEPEnCoursCount(idBUs, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
} |
|
|
|
|
catch (DbUpdateException e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur inconnue est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
return Ok(nbEpEnCours); |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(long?)); |
|
|
|
|
|
|
|
|
@ -337,13 +383,6 @@ namespace IO.Swagger.Controllers |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(500, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "0"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<long?>(exampleJson) |
|
|
|
|
: default(long?); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -569,6 +608,32 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")] |
|
|
|
|
public virtual async Task<IActionResult> GetEPSignes([FromQuery]List<long?> idBUs, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPAge, [FromQuery]string texte, [FromQuery]string tri, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<EpInformationDTO> epSignes; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
epSignes = await epInformationService.GetEPSignes(idBUs, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
} |
|
|
|
|
catch (DbUpdateException e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur inconnue est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
return Ok(epSignes); |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<EpInformationDTO>)); |
|
|
|
|
|
|
|
|
@ -580,13 +645,6 @@ namespace IO.Swagger.Controllers |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(500, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 9,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 9,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<EpInformationDTO>>(exampleJson) |
|
|
|
|
: default(List<EpInformationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -661,6 +719,32 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")] |
|
|
|
|
public virtual async Task<IActionResult> GetEPSignesCount([FromQuery]List<long?> idBUs, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPAge, [FromQuery]string texte, [FromQuery]string tri, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin) |
|
|
|
|
{ |
|
|
|
|
int nbEpSignes; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
nbEpSignes = await epInformationService.GetEPSignesCount(idBUs, asc, numPage, parPAge, texte, tri, dateDebut, dateFin); |
|
|
|
|
} |
|
|
|
|
catch (DbUpdateException e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
logger.LogError(e.Message); |
|
|
|
|
ErreurDTO erreur = new ErreurDTO |
|
|
|
|
{ |
|
|
|
|
Code = 500, |
|
|
|
|
Message = "Une erreur inconnue est survenue sur le serveur", |
|
|
|
|
}; |
|
|
|
|
return StatusCode(erreur.Code.Value, erreur); |
|
|
|
|
} |
|
|
|
|
return Ok(nbEpSignes); |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(long?)); |
|
|
|
|
|
|
|
|
@ -671,14 +755,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(500, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "0"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<long?>(exampleJson) |
|
|
|
|
: default(long?); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
// return StatusCode(500, default(ErreurDTO)); //TODO: Change the data returned |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|