|
|
@@ -1,229 +0,0 @@
|
|
|
-using CD67.FicheCollege.Entity;
|
|
|
-using CD67.FicheCollege.Factory;
|
|
|
-using CD67.FicheCollege.MVC.Internal;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.ComponentModel.DataAnnotations;
|
|
|
-using System.Web.Mvc;
|
|
|
-
|
|
|
-namespace CD67.FicheCollege.MVC.Models
|
|
|
-{
|
|
|
- public enum ModeAcces
|
|
|
- {
|
|
|
- [Display(Prompt = "Ajouter")]
|
|
|
- Creation,
|
|
|
- [Display(Prompt = "Lire")]
|
|
|
- Lecture,
|
|
|
- [Display(Prompt = "Modifier")]
|
|
|
- Modification,
|
|
|
- [Display(Prompt = "Supprimer")]
|
|
|
- Suppression
|
|
|
- }
|
|
|
-
|
|
|
- // Wrapper du modele qui permet d'emmener des informations supplementaires avec celui-ci.
|
|
|
- public abstract class TopModel
|
|
|
- {
|
|
|
- internal object _Obj;
|
|
|
-
|
|
|
- public abstract int Id { get; }
|
|
|
- public abstract string Annee_Lib { get; }
|
|
|
-
|
|
|
- // (Facultatif) Mode d'accès à la page
|
|
|
- // Defaut: Lecture
|
|
|
- public ModeAcces Acces { get; set; }
|
|
|
-
|
|
|
- // (Facultatif) Permet d'emporter d'éventuelles données complémentaires
|
|
|
- // comme les listes qui serviront entre autre à peupler les listes déroulantes.
|
|
|
- public Dictionary<string, object> Bag { get; set; } = new Dictionary<string, object>();
|
|
|
-
|
|
|
- // Utilisateur courant
|
|
|
- public UtilisateurConnecte User = CD67.FicheCollege.MVC.Internal.UtilisateurConnecteFactory.getUtilisateurConnecte();
|
|
|
-
|
|
|
- // ***************************
|
|
|
- // Constructeur de base
|
|
|
- public TopModel(object model,
|
|
|
- ModeAcces acces = ModeAcces.Lecture,
|
|
|
- Dictionary<string, object> bag = null)
|
|
|
- {
|
|
|
- _Obj = model;
|
|
|
- Acces = acces;
|
|
|
- if (bag != null)
|
|
|
- Bag = bag;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public class AnneeViewModel : TopModel
|
|
|
- {
|
|
|
- public AnneeViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- public Annee Obj
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return (_Obj as Annee);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override int Id
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.Id;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override string Annee_Lib
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.Libelle;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public class AnneeIndexViewModel : TopModel
|
|
|
- {
|
|
|
- public AnneeIndexViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- public IEnumerable<Annee> Obj
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return (_Obj as IEnumerable<Annee>);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override int Id
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override string Annee_Lib
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return "";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public class CollegeViewModel : TopModel
|
|
|
- {
|
|
|
- public SelectList Sel_TypesCollege;
|
|
|
- public SelectList Sel_CodesPostaux;
|
|
|
-
|
|
|
- public CollegeViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
- {
|
|
|
- if (acces == ModeAcces.Creation | acces == ModeAcces.Modification)
|
|
|
- {
|
|
|
- Entities db = new Entities();
|
|
|
- TypeCollegeFactory fact = new TypeCollegeFactory(db);
|
|
|
- Sel_TypesCollege = new SelectList(fact.getAll(), "Id", "Libelle", Obj.TypeCollege_Id);
|
|
|
- Sel_CodesPostaux = new SelectList(Referentiel.GetCodesPostaux(Obj.Commune_Insee), Obj.Code_Postal);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public College Obj {
|
|
|
- get {
|
|
|
- return (_Obj as College);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override int Id
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.Id;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override string Annee_Lib
|
|
|
- {
|
|
|
- get {
|
|
|
- return Obj.Annee.Libelle;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public class IdentiteViewModel : TopModel
|
|
|
- {
|
|
|
- public List<ContactViewModel> Contacts;
|
|
|
-
|
|
|
- public IdentiteViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
- {
|
|
|
- Contacts = new List<ContactViewModel>();
|
|
|
- if (Obj.Principal_SID != null)
|
|
|
- Contacts.Add(new ContactViewModel("Principal", Obj.Principal_SID, Obj.Principal_Login, Obj.Principal_Nom, Obj.Principal_Prenom, Obj.Principal_Email, Obj.Principal_Tel, Obj.Principal_Structure));
|
|
|
- if (Obj.Adjoint_SID != null)
|
|
|
- Contacts.Add(new ContactViewModel("Principal adjoint", Obj.Adjoint_SID, Obj.Adjoint_Login, Obj.Adjoint_Nom, Obj.Adjoint_Prenom, Obj.Adjoint_Email, Obj.Adjoint_Tel, Obj.Adjoint_Structure));
|
|
|
- if (Obj.Gestionnaire_SID != null)
|
|
|
- Contacts.Add(new ContactViewModel("Gestionnaire", Obj.Gestionnaire_SID, Obj.Gestionnaire_Login, Obj.Gestionnaire_Nom, Obj.Gestionnaire_Prenom, Obj.Gestionnaire_Email, Obj.Gestionnaire_Tel, Obj.Gestionnaire_Structure));
|
|
|
- if (Obj.Gestionnaire2_SID != null)
|
|
|
- Contacts.Add(new ContactViewModel("Gestionnaire n°2", Obj.Gestionnaire2_SID, Obj.Gestionnaire2_Login, Obj.Gestionnaire2_Nom, Obj.Gestionnaire2_Prenom, Obj.Gestionnaire2_Email, Obj.Gestionnaire2_Tel, Obj.Gestionnaire2_Structure));
|
|
|
- }
|
|
|
-
|
|
|
- public Identite Obj
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return (_Obj as Identite);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override int Id
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.College_Id;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override string Annee_Lib
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.College.Annee.Libelle;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public class ActionClasViewModel : TopModel
|
|
|
- {
|
|
|
-
|
|
|
- public ActionClasViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- public ActionCLAS Obj
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return (_Obj as ActionCLAS);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override int Id
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.College_Id;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public override string Annee_Lib
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return Obj.College.Annee.Libelle;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|