//--------------------------------------------- public CTypeTicketContrat_Site GetRelationSite(int nIdSite) { CContrat_Site cs = Contrat.GetRelationSite(nIdSite); if (cs != null) { CListeObjetsDonnees lst = RelationsSites; lst.Filtre = new CFiltreData(CContrat_Site.c_champId + "=@1", cs.Id); lst.InterditLectureInDB = true; if (lst.Count > 0) { return((CTypeTicketContrat_Site)lst[0]); } } return(null); }
public CContrat_Site GetRelationSite(int nIdSite, bool bAvecCreation) { CContrat_Site ct = GetRelationSite(nIdSite); if (ct == null && bAvecCreation) { CSite site = new CSite(ContexteDonnee); if (site.ReadIfExists(nIdSite)) { ct = new CContrat_Site(ContexteDonnee); ct.CreateNewInCurrentContexte(); ct.Site = site; ct.Contrat = this; } } return(ct); }
//-------------------------------------------------------- public CTypeTicketContrat_Site_Periode SetPeriode(int nIdSite, int?nIdPeriode, DateTime dateDebut, DateTime dateFin) { CTypeTicketContrat_Site ts = GetRelationSite(nIdSite); CContrat_Site cs = Contrat.GetRelationSite(nIdSite, true); if (cs != null) { if (ts == null) { ts = new CTypeTicketContrat_Site(ContexteDonnee); ts.CreateNewInCurrentContexte(); ts.TypeTicket_Contrat = this; ts.ContratSite = cs; } return(ts.SetPeriode(nIdPeriode, dateDebut, dateFin)); } return(null); }