public ActionControllerResult DeleteMateriel(int id) { ActionControllerResult result; try { ActionControllerResult resultTicket = this.ticketService.DeleteTicketByMaterielId(id); if (resultTicket == ActionControllerResult.SUCCESS) { this.materielRepository.Delete(id); this.unitOfWork.Save(); result = ActionControllerResult.SUCCESS; } else { result = ActionControllerResult.FAILURE; } } catch (Exception ex) { this.logService.LogErreur(LOG_TYPE_OBJECT.Materiel, null, "Erreur Lors de la suppression d'un materiel", ex.Message, null); result = ActionControllerResult.FAILURE; } return(result); }
public ActionResult AjaxCreate(NewFormSortieStockViewModel formSortieStock) { NewFormSortieStockViewModel formModel = this.GetFormAjax(formSortieStock.idMateriel, formSortieStock.quantite); if (ModelState.IsValid) { if (formSortieStock.stockSortieID > 0 && formSortieStock.stockEntreeID > 0 && formSortieStock.quantite > 0) { ActionControllerResult result = this.sortieStockService.InsertSortieStock(formSortieStock.stockSortieID, formSortieStock.stockEntreeID, formSortieStock.quantite, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuSortieStock", formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.SortieStockMateriel, null, "Création d'une Sortie de Materiel", null, User.Identity.GetUserId()); return(Json(string.Empty)); } else { ModelState.AddModelError("quantite", "La quantité doit etre supérieur à zéro"); } } return(PartialView("_FormContenuSortieStock", formModel)); }
public ActionResult GenererTypeAuto() { string messageError = ""; ActionControllerResult result = this.typeMaterielService.GenerationTypeMaterielFromMateriel(); if (result == ActionControllerResult.FAILURE) { messageError = "Une erreur est survenue lors de la génération des Types de Matériel"; } return(RedirectToAction("Index", new { MessageErreur = messageError })); }
public ActionResult RoleAddToUser(string roleId, string userId) { ActionControllerResult result = this.roleService.AffecterRole(userId, roleId); if (result == ActionControllerResult.FAILURE) { return(Json(string.Empty)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.AssociationRoleToUser, null, "Affectation d'un role à un utilisateur", null, User.Identity.GetUserId()); return(this.GetUserRoles(userId)); }
public ActionResult DeleteMultiple(LogSuppressionViewModel model) { if (ModelState.IsValid) { ActionControllerResult result = this.logService.DeleteLogsAnterieurDate(model.DateSuppression); } else { return(View("IndexSuppression", model)); } return(Redirect("Index")); }
public ActionResult DeleteRoleForUser(string roleId, string userId = null) { ActionControllerResult result = this.roleService.EnleverRole(userId, roleId); if (result == ActionControllerResult.FAILURE) { return(Json(string.Empty)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Delete, LOG_TYPE_OBJECT.AssociationRoleToUser, null, "Enlévement d'un role à un utilisateur", null, User.Identity.GetUserId()); return(this.GetUserRoles(userId)); }
public ActionResult AjaxCreate(int inventaireId) { ActionControllerResult result = ActionControllerResult.FAILURE; Inventaire unInventaire = this.inventaireService.GetInventaireById(inventaireId); if (unInventaire != null) { ValidationInventaire uneValidation = new ValidationInventaire(); uneValidation.Inventaire = unInventaire; result = this.validationService.InsertValidation(uneValidation, User.Identity.GetUserId()); } return(Json(result)); }
public ActionResult DeleteConfirmed(string id) { ActionControllerResult resultLog = this.logService.DeleteLogsByUserId(id); if (resultLog == ActionControllerResult.SUCCESS) { this.userService.DeleteUser(id); return(RedirectToAction("Index")); } else { string ErrorMessage = "Erreur lors de la suppression de l'utilisateur"; return(RedirectToAction("Index", "Home", new { MessageErreur = ErrorMessage })); } }
public ActionResult Edit([Bind(Include = "Id,Name,")] IdentityRole unRole) { if (ModelState.IsValid) { ActionControllerResult result = this.roleService.UpdateRole(unRole); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(unRole)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Inventaire, null, "Modification du Role: " + unRole.Name, null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(unRole)); }
public ActionResult ChangeEmail(ChangeEmailViewModel model) { if (ModelState.IsValid) { ActionControllerResult result = this.userService.ChangeEmail(model.newEmail, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(model)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.User, null, "Changement Email", null, User.Identity.GetUserId()); return(RedirectToAction("MonCompte")); } return(View(model)); }
public ActionResult Edit([Bind(Include = "Id,Nom,Prenom,Surnom,Email,UserName")] ApplicationUser unUser) { if (ModelState.IsValid) { ActionControllerResult result = this.userService.UpdateUser(unUser, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(unUser)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.User, null, "Modification d'un Utilisateur", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(unUser)); }
public ActionResult Edit([Bind(Include = "ID,Nom,Rank,Active,IsInventaireStock,DateCreation,DateModification")] Inventaire unInventaire) { if (ModelState.IsValid) { ActionControllerResult result = this.inventaireService.UpdateInventaire(unInventaire, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(unInventaire)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Inventaire, unInventaire.ID, "Modification d'un inventaire", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(unInventaire)); }
public ActionResult Create([Bind(Include = "ID,Quantite,DatePeremption,Supprime,MaterielID")] StockMateriel unStock) { StockMaterielFormViewModel formModel = this.GetFormStock(false, unStock); if (ModelState.IsValid) { ActionControllerResult result = this.stockMaterielService.InsertStockMateriel(unStock, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.StockMateriel, null, "Création d'un Stock Materiel", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Edit([Bind(Include = "ID,Quantite,DatePeremption,Supprime,DateCreation,DateModification,MaterielID,TypeMaterielID")] StockMateriel unStock) { StockMaterielFormViewModel formModel = this.GetFormStock(true, unStock); if (ModelState.IsValid) { ActionControllerResult result = this.stockMaterielService.UpdateStockMateriel(unStock, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult CreatePleinEngin([Bind(Include = "Kilometrage,Litrage,Prix,EnginID")] PleinEssence unPlein) { FormPleinEnginViewModel formModel = this.GetFormPleinEngin(false, unPlein); if (ModelState.IsValid) { ActionControllerResult result = this.enginService.InsertPlein(unPlein, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.PleinEssence, unPlein.ID, "Création d'un Plein Essence", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult AjaxEdit([Bind(Include = "ID,Quantite,DatePeremption,Supprime,DateCreation,DateModification,MaterielID,TypeMaterielID")] StockMateriel unStock) { StockMaterielFormViewModel formModel = this.GetFormStock(true, unStock); if (ModelState.IsValid) { ActionControllerResult result = this.stockMaterielService.UpdateStockMateriel(unStock, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuStock", formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.StockMateriel, unStock.ID, "Création d'un Stock Materiel", null, User.Identity.GetUserId()); return(Json(string.Empty)); } return(PartialView("_FormContenuStock", formModel)); }
public ActionResult Create([Bind(Include = "ID,Type,Description,Duree,DateEvenement")] Evenement unEvenement) { FormEvenementViewModels formModel = this.GetFormEvenement(false, unEvenement); if (ModelState.IsValid) { ActionControllerResult result = this.evenementService.InsertEvenement(unEvenement, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.Evenement, null, "Création d'un événement", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Create(Inventaire unInventaire) { if (ModelState.IsValid) { ActionControllerResult result = this.inventaireService.InsertInventaire(unInventaire, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(unInventaire)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.Inventaire, null, "Création d'un inventaire", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(unInventaire)); }
public ActionResult AjaxCreate([Bind(Include = "MaterielID, Type, statut, Message, NumeroFeb")] TicketIncident unTicket) { FormTicketIncidentViewModels formModel = this.GetFormTicket(false, unTicket); if (ModelState.IsValid) { ActionControllerResult result = this.ticketService.InsertTicket(unTicket, User.Identity.GetUserId(), User.IsInRole(ROLE_ADMIN_TICKET)); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuTicket", formModel)); } return(Json(string.Empty)); } return(PartialView("_FormContenuTicket", formModel)); }
public ActionResult AjaxCreate(StockMateriel unStock) { StockMaterielFormViewModel formModel = this.GetFormStock(false, unStock); if (ModelState.IsValid) { ActionControllerResult result = this.stockMaterielService.InsertStockMateriel(unStock, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuStock", formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.StockMateriel, null, "Création d'un Stock Materiel", null, User.Identity.GetUserId()); return(Json(string.Empty)); } return(PartialView("_FormContenuStock", formModel)); }
public ActionResult Create([Bind(Include = "ID,Nom,Domaine")] TypeMateriel unTypeMateriel) { FormTypeMaterielViewModels formModel = this.GetFormTypeMateriel(false, unTypeMateriel); if (ModelState.IsValid) { ActionControllerResult result = this.typeMaterielService.InsertTypeMateriel(unTypeMateriel, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.TypeMateriel, unTypeMateriel.ID, "Création d'un Type de Matériel", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Create(FormSortieStockViewModel formSortieStock) { ViewBag.isChefGarde = User.IsInRole(Constantes.ROLE_CHEF_GARDE); FormSortieStockViewModel formModel = this.GetForm(false, formSortieStock.sortieStock.uneSortieStock); if (ModelState.IsValid) { ActionControllerResult result = this.sortieStockService.InsertSortieStock(formSortieStock.sortieStock.uneSortieStock, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.SortieStockMateriel, null, "Création d'une Sortie de Materiel", null, User.Identity.GetUserId()); return(RedirectToAction("Create", new { MessageRetour = "Réussi" })); } return(View(formModel)); }
public ActionResult AjaxCreate(Materiel unMateriel) { FormMaterielViewModels formModel = this.GetFormMateriel(false, unMateriel); if (ModelState.IsValid) { ActionControllerResult result = this.materielService.InsertMateriel(unMateriel, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuMateriel", formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.Materiel, unMateriel.ID, "Création d'un Matériel", null, User.Identity.GetUserId()); return(Json(string.Empty)); } return(PartialView("_FormContenuMateriel", formModel)); }
public ActionResult Edit([Bind(Include = "ID,Nom,Numero,Immatriculation,CodeConf,CodeChauff,DateCreation,DateModification")] Engin unEngin) { FormEnginViewModel formModel = this.GetFormEngin(true, unEngin); if (ModelState.IsValid) { ActionControllerResult result = this.enginService.UpdateEngin(unEngin, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Engin, unEngin.ID, "Modification d'un Engin", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult AjaxEdit([Bind(Include = "ID,Nom,Rank,Active,DateCreation,DateModification,InventaireID")] BlocInventaire unBlocInventaire) { FormBlocInventaireViewModels formModel = this.GetFormBlocInventaire(false, unBlocInventaire); if (ModelState.IsValid) { ActionControllerResult result = this.blocInventaireService.UpdateBlocInventaire(unBlocInventaire, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuBlocInventaire", formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.BlocInventaire, unBlocInventaire.ID, "Modification d'un bloc Inventaire", null, User.Identity.GetUserId()); return(Json(string.Empty)); } return(PartialView("_FormContenuBlocInventaire", formModel)); }
public ActionResult AjaxEdit([Bind(Include = "ID,Nom,Description,Quantite,Tester,Rank,Active,DateCreation,DateModification,TypeMaterielID,BlocInventaireID")] Materiel unMateriel) { FormMaterielViewModels formModel = this.GetFormMateriel(false, unMateriel); if (ModelState.IsValid) { ActionControllerResult result = this.materielService.UpdateMateriel(unMateriel, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(PartialView("_FormContenuMateriel", formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Materiel, unMateriel.ID, "Modification d'un Matériel", null, User.Identity.GetUserId()); return(Json(string.Empty)); } return(PartialView("_FormContenuMateriel", formModel)); }
public ActionResult Create(Materiel unMateriel) { FormMaterielViewModels formModel = this.GetFormMateriel(false, unMateriel); if (ModelState.IsValid) { //insertion du blocInventaire ActionControllerResult result = this.materielService.InsertMateriel(unMateriel, User.Identity.GetUserId()); //si erreur on affiche un message if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.Materiel, unMateriel.ID, "Création d'un Matériel", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Create([Bind(Include = "ID,Nom,Numero,Immatriculation,CodeConf,CodeChauff")] Engin unEngin) { FormEnginViewModel formModel = this.GetFormEngin(false, unEngin); if (ModelState.IsValid) { //insertion du blocInventaire ActionControllerResult result = this.enginService.InsertEngin(unEngin, User.Identity.GetUserId()); //si erreur on affiche un message if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Create, LOG_TYPE_OBJECT.Engin, unEngin.ID, "Création d'un Engin", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Edit([Bind(Include = "ID, MaterielID, Type, statut, Message, NumeroFeb, DateCreation, DateModification")] TicketIncident unTicket) { FormTicketIncidentViewModels formModel = this.GetFormTicket(true, unTicket); if (ModelState.IsValid) { ActionControllerResult result = this.ticketService.UpdateTicket(unTicket, User.IsInRole(Constantes.ROLE_ADMIN_TICKET), User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; return(View(formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Ticket, unTicket.ID, "Modification d'un Ticket", null, User.Identity.GetUserId()); return(RedirectToAction("Index")); } return(View(formModel)); }
public ActionResult Edit([Bind(Include = "ID,Nom,Description,Quantite,Tester,Rank,Active,DateCreation,DateModification,TypeMaterielID,BlocInventaireID")] Materiel unMateriel) { FormMaterielViewModels formModel = this.GetFormMateriel(false, unMateriel); if (ModelState.IsValid) { ActionControllerResult result = this.materielService.UpdateMateriel(unMateriel, User.Identity.GetUserId()); if (result == ActionControllerResult.FAILURE) { ViewBag.ErrorMessage = Constantes.MESSAGE_ERR_NOTIFICATIONS; this.IsFromBlocInventaire(); return(View(formModel)); } //Réussi this.logService.LogEvenement(LOG_TYPE_EVENT.Edit, LOG_TYPE_OBJECT.Materiel, unMateriel.ID, "Modification d'un Matériel", null, User.Identity.GetUserId()); if (Session["isFromBlocInventaire"] != null) { if (Convert.ToBoolean(Session["isFromBlocInventaire"])) { return(RedirectToAction("Details", "Materiel", new { id = unMateriel.ID, isFromBlocInventaire = true })); } else { return(RedirectToAction("Index")); } } else { return(RedirectToAction("Index")); } } this.IsFromBlocInventaire(); return(View(formModel)); }