|
|
@@ -2,10 +2,23 @@
|
|
|
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
|
|
|
{
|
|
|
@@ -64,8 +77,6 @@ namespace CD67.FicheCollege.MVC.Models
|
|
|
|
|
|
public class CollegeViewModel : TopModel
|
|
|
{
|
|
|
- private Entities db = new Entities();
|
|
|
-
|
|
|
public SelectList Sel_TypesCollege;
|
|
|
public SelectList Sel_CodesPostaux;
|
|
|
|
|
|
@@ -73,6 +84,7 @@ namespace CD67.FicheCollege.MVC.Models
|
|
|
{
|
|
|
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);
|
|
|
@@ -91,9 +103,29 @@ namespace CD67.FicheCollege.MVC.Models
|
|
|
return Obj.Annee.Libelle;
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ public class ContactViewModel : TopModel
|
|
|
+ {
|
|
|
+ public ContactViewModel(object model, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
+ public Identite Obj
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (_Obj as Identite);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ public override string Annee_Lib
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return Obj.College.Annee.Libelle;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|