|
@@ -4,29 +4,48 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
using System.Text;
|
|
|
using System.Data.Entity;
|
|
using System.Data.Entity;
|
|
|
|
|
+using System.Reflection;
|
|
|
|
|
|
|
|
namespace CD67.FicheCollege.Factory
|
|
namespace CD67.FicheCollege.Factory
|
|
|
{
|
|
{
|
|
|
public partial class CollegeFactory : Internal.BaseFactory<Entity.College>
|
|
public partial class CollegeFactory : Internal.BaseFactory<Entity.College>
|
|
|
{
|
|
{
|
|
|
- //// Charge les données d'identité des agents depuis le web-service
|
|
|
|
|
- //public void hydrate(ref College college)
|
|
|
|
|
- //{
|
|
|
|
|
- // Entity.WsAgents.Agents wsAgents = new Entity.WsAgents.Agents();
|
|
|
|
|
-
|
|
|
|
|
- // if (!String.IsNullOrEmpty(college.PrincipalSid)) {
|
|
|
|
|
- // college.principal = wsAgents.GetById(college.PrincipalSid);
|
|
|
|
|
- // }
|
|
|
|
|
- // if (!String.IsNullOrEmpty(college.AdjointSid)) {
|
|
|
|
|
- // college.adjoint = wsAgents.GetById(college.AdjointSid);
|
|
|
|
|
- // }
|
|
|
|
|
- // if (!String.IsNullOrEmpty(college.Gestionnaire1Sid)) {
|
|
|
|
|
- // college.gestionnaire1 = wsAgents.GetById(college.Gestionnaire1Sid);
|
|
|
|
|
- // }
|
|
|
|
|
- // if (!String.IsNullOrEmpty(college.Gestionnaire2Sid)) {
|
|
|
|
|
- // college.gestionnaire2 = wsAgents.GetById(college.Gestionnaire2Sid);
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ public College clone_to_year(College college, int annee_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (base.getAll().Where(c => c.Annee_Id == annee_id && c.TokenId == college.TokenId).Count() > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ throw new InvalidOperationException("Ce collège existe déjà pour l'année cible");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ College clone = new College();
|
|
|
|
|
+ // Nouvelle année
|
|
|
|
|
+ clone.Annee_Id = annee_id;
|
|
|
|
|
+ // On reprend les valeurs de tous les autres champs
|
|
|
|
|
+ clone.CodeRne = college.CodeRne;
|
|
|
|
|
+ clone.Libelle = college.Libelle;
|
|
|
|
|
+ clone.Adresse = college.Adresse;
|
|
|
|
|
+ clone.Code_Postal = college.Code_Postal;
|
|
|
|
|
+ clone.TypeCollege_Id = college.TypeCollege_Id;
|
|
|
|
|
+ clone.Commune_Insee = college.Commune_Insee;
|
|
|
|
|
+ clone.Commune = college.Commune;
|
|
|
|
|
+ clone.Canton = college.Canton;
|
|
|
|
|
+ clone.Territoire_Id = college.Territoire_Id;
|
|
|
|
|
+ clone.Canton = college.Canton;
|
|
|
|
|
+ clone.TAD = college.TAD;
|
|
|
|
|
+ clone.CDC = college.CDC;
|
|
|
|
|
+ clone.Tel = college.Tel;
|
|
|
|
|
+ clone.Fax = college.Fax;
|
|
|
|
|
+ clone.Email = college.Email;
|
|
|
|
|
+ clone.PrincipalSid = college.PrincipalSid;
|
|
|
|
|
+ clone.AdjointSid = college.AdjointSid;
|
|
|
|
|
+ clone.Gestionnaire1Sid = college.Gestionnaire1Sid;
|
|
|
|
|
+ clone.Gestionnaire2Sid = college.Gestionnaire2Sid;
|
|
|
|
|
+ clone.TokenId = college.TokenId;
|
|
|
|
|
+
|
|
|
|
|
+ // enregistre le clone en base
|
|
|
|
|
+ base.add(ref clone);
|
|
|
|
|
+
|
|
|
|
|
+ return clone;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|