public ActionResult CreatePersonnel(Personnel pers, FormCollection collection) { int idregion = db.FindRegionByBatiment(pers.idBatiment); int idgou = db.FindGouverneratByBatiment(pers.idBatiment); int idpays = db.FindPaysByBatiment(pers.idBatiment); int iddelegation = db.FindDelegationByBatiment(pers.idBatiment); int idorg = db.FindOrganisationByDelegation(pers.idBatiment); pers.idDelegation = iddelegation; pers.idRegion = idregion; pers.idOrganisation = idorg; pers.idPays = idpays; pers.idGouvernorat = idgou; try { BissInventaireEntities.Instance.Personnel.Add(pers); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetPersonnel")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateUsersTest(Utilisateur user, FormCollection collection) { if (ModelState.IsValid) { try { user.etatUtilisateur = true; db1.CreateUtilisateurs(user); db1.SaveEmploye(); var Emp = (Utilisateur)Session["identifiant"]; Trace tr = new Trace(); tr.Dates = DateTime.Now; tr.Actions = "Ajout utilisateur"; tr.Champs = (user.Personnel.Matricule).ToString(); tr.Tables = "Utilisateur"; tr.Users = (Emp.Personnel.Matricule).ToString(); BissInventaireEntities.Instance.Trace.Add(tr); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetUsers")); } catch (DbEntityValidationException r) { foreach (var eve in r.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); LogThread.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors: " + eve.Entry.Entity.GetType().Name + " " + eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); LogThread.WriteLine("- Property: \"{0}\", Error: \"{1}\" " + ve.PropertyName + " " + ve.ErrorMessage); ViewBag.msg2 = "Exeption: " + ve.ErrorMessage; } } return(RedirectToAction("Index", "Error")); } catch (SqlException sq) { LogThread.WriteLine(sq.Message); return(RedirectToAction("Index", "Error")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["personel"] = new SelectList(BissInventaireEntities.Instance.Personnel.ToList(), "id", "Matricule"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); return(View()); } }
public ActionResult CreateRole(Role Catm, FormCollection collection) { if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Role.Add(Catm); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetRole")); } else { return(RedirectToAction("Index", "Error")); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { return(View()); } }
public ActionResult CreateBienAdmin(Bien Bur, FormCollection collection) { if (Session["identifiant"] == null) { return(RedirectToAction("Index", "Home")); } if (ModelState.IsValid) { try { BissInventaireEntities.Instance.Bien.Add(Bur); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("RapportBien")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["depts"] = new SelectList(db.GetBureaux(), "Id", "Description"); ViewData["Bureau"] = new SelectList(BissInventaireEntities.Instance.Depot.ToList(), "id", "Description"); return(View()); } }
public ActionResult EditBureaux(Bureau etg) { if (ModelState.IsValid) { try { db.UpdateBureauDetached(etg); db.SaveBureau(); return(RedirectToAction("GetBureuax")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["gouvernorat"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["organisation"] = new SelectList(BissInventaireEntities.Instance.Organisation.ToList(), "idOrganisation", "libelle"); ViewData["delegation"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); ViewData["etages"] = new SelectList(BissInventaireEntities.Instance.Etage.ToList(), "Id_etage", "Description"); return(View()); } }
public ActionResult CreateEtage(Etage etag, FormCollection collection) { int iddelegation = db.FindDelegationByBatiment(etag.idBatiment); IEtageService et = new EtageService(); if (ModelState.IsValid) { try { et.CreateEtage(etag); et.SaveEtage(); return(RedirectToAction("GetEtage")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["delegation"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); return(View()); } }
public ActionResult ActDesactiveUsers(int id) { var test = db1.GetUtilisateurById(id); try { if (test.etatUtilisateur == true) { test.etatUtilisateur = false; db1.UpdateUtilisateurDetached(test); db1.SaveEmploye(); } else { test.etatUtilisateur = true; db1.UpdateUtilisateurDetached(test); db1.SaveEmploye(); } return(RedirectToAction("GetUsers")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult createMarque(Marque marque, FormCollection collection) { if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Marque.Add(marque); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("getMarque")); } else { return(RedirectToAction("Index", "Error")); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["categorie"] = new SelectList(BissInventaireEntities.Instance.Categorie.ToList(), "Id_categorie", "libelle"); return(View()); } }
public ActionResult CreateInventaire(Inventaire reg) { if (ModelState.IsValid) { try { reg.Date = DateTime.Now; //db.CreateInventaire(reg); //db.SaveInventaire(); BissInventaireEntities.Instance.Inventaire.Add(reg); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetInventaire")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { return(View()); } }
public ActionResult createSousModele(Sous_modele sousModele, FormCollection collection) { if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Sous_modele.Add(sousModele); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("getSousModele")); } else { return(RedirectToAction("Index", "Error")); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { return(View()); } }
public ActionResult CreateAchat(Achat achat, FormCollection collection) { if (ModelState.IsValid) { try { var four = fourni.FindFourByID(achat.Id_fournisseur); //achat.Date_d_achat = System.DateTime.Now; achat.idDelegation = four.idDelegation; db.Achat.Add(achat); db.SaveChanges(); return(RedirectToAction("GetAchat")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["delegations"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["gouvers"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["fournisseurs"] = new SelectList(BissInventaireEntities.Instance.Fournisseur.ToList(), "Id_fournisseur", "Nom"); ViewData["contratgar"] = new SelectList(BissInventaireEntities.Instance.Contrat.ToList(), "Id_contrat_garanti", "Num"); ViewData["achats"] = new SelectList(BissInventaireEntities.Instance.Achat.ToList(), "Id_achat", "Num_facture"); return(View()); } }
public ActionResult CreatePersonnel(Personnel pers, FormCollection collection) { //int idregion = db.FindRegionByBatiment(pers.idBatiment); //int idgou = db.FindGouverneratByBatiment(pers.idBatiment); //int idpays = db.FindPaysByBatiment(pers.idBatiment); //int iddelegation = db.FindDelegationByBatiment(pers.idBatiment); //int idorg = db.FindOrganisationByDelegation(pers.idBatiment); //pers.idDelegation = iddelegation; //pers.idRegion = idregion; //pers.idOrganisation = idorg; //pers.idPays = idpays; //pers.idGouvernorat = idgou; if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Personnel.Add(pers); BissInventaireEntities.Instance.SaveChanges(); var Emp = (Utilisateur)Session["identifiant"]; Trace tr = new Trace(); tr.Dates = DateTime.Now; tr.Actions = "Ajout Personnel"; tr.Champs = (pers.Matricule).ToString(); tr.Tables = "Personnel"; tr.Users = (Emp.Personnel.Matricule).ToString(); BissInventaireEntities.Instance.Trace.Add(tr); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetPersonnel")); } else { return(RedirectToAction("Index", "Error")); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } } else { ViewData["role"] = new SelectList(BissInventaireEntities.Instance.Role.ToList(), "id", "libelle"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); ViewData["direction"] = new SelectList(BissInventaireEntities.Instance.Direction.ToList(), "Id_direction", "Libelle"); ViewData["service"] = new SelectList(BissInventaireEntities.Instance.ServiceD.ToList(), "Id_service", "Libelle"); ViewData["etage"] = new SelectList(BissInventaireEntities.Instance.Etage.ToList(), "Id_etage", "description"); ViewData["bureau"] = new SelectList(BissInventaireEntities.Instance.Bureau.ToList(), "Id_bureau", "Description"); return(View()); } }
public ActionResult EditCategorie_materiel(Categorie_materiel Catm) { try { db.UpdateCategorie_materielDetached(Catm); db.SaveCategorie_materiel(); return(RedirectToAction("GetCategorie_materiel")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateCategorie_materiel(Categorie_materiel Catm, FormCollection collection) { try { BissInventaireEntities.Instance.Categorie_materiel.Add(Catm); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetCategorie_materiel")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
// GET: Categorie_materiel/Details/5 public ActionResult Details(int Id_categorie) { try { var archive = BissInventaireEntities.Instance.Categorie_materiel.Find(Id_categorie); return(View(archive)); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditRegion(Region reg) { try { db.UpdateRegionDetached(reg); db.SaveRegion(); return(RedirectToAction("GetRegion")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateGouvernorat1(Gouvernorat gouv) { try { BissInventaireEntities.Instance.Gouvernorat.Add(gouv); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetGouvernorat1")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditEtage(Etage etg) { try { etage.UpdateEtageDetached(etg); etage.SaveEtage(); return(RedirectToAction("GetEtage")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditStock(Stock etg) { try { bien.UpdateStockDetached(etg); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetStock")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateEtage(Etage etg) { try { BissInventaireEntities.Instance.Etage.Add(etg); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetEtage")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateDirection(Direction direction) { try { BissInventaireEntities.Instance.Direction.Add(direction); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetDirection")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreatePays(Pays pay) { try { BissInventaireEntities.Instance.Pays.Add(pay); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetPays")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditOrganisation(Organisation org) { try { db3.UpdateOrganisationDetached(org); db3.SaveOrganisation(); return(RedirectToAction("GetOrganisation")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditGouvernorat(Gouvernorat gouv) { try { db1.UpdateGouvernoratDetached(gouv); db1.SaveGouvernorat(); return(RedirectToAction("GetGouvernorat")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditAchat(Achat acht, FormCollection collection) { try { db1.UpdateAchatDetached(acht); db.SaveChanges(); return(RedirectToAction("GetAchat")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateBiens(AtbDataTest reg) { try { BissInventaireEntities.Instance.AtbDataTest.Add(reg); BissInventaireEntities.Instance.SaveChanges(); return(RedirectToAction("GetRegion")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult EditServiceD(ServiceD Catm, FormCollection collection) { try { db.UpdateServiceDDetached(Catm); db.SaveServiceD(); return(RedirectToAction("GetServiceD")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
// GET: Admin/Details/5 public ActionResult DetailsBien(int id) { try { var archive = BissInventaireEntities.Instance.Bien.Find(id); return(View(archive)); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateBureaux(Bureau Bur, FormCollection collection) { try { db.CreateBureau(Bur); db.SaveBureau(); return(RedirectToAction("GetBureuax")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult CreateUsers(Utilisateur user, FormCollection collection) { try { db1.CreateUtilisateurs(user); db1.SaveEmploye(); return(RedirectToAction("GetUsers")); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return(RedirectToAction("Index", "Error")); } }