public void TiagSetTypeOccupationKeys(object[] lstCles) { CTypeOccupationHoraire tpOccup = new CTypeOccupationHoraire(ContexteDonnee); if (tpOccup.ReadIfExists(lstCles)) { TypeOccupationPropre = tpOccup; } }
public void Init(CActeur acteur, CModeleTexte modeleUtilise) { m_acteur = acteur; //SuspendLayout(); if (modeleUtilise == null) { m_lnkNomIntervenant.Visible = true; m_lnkActeur.Visible = false; m_modele.Visible = false; m_extLinkField.FillDialogFromObjet(m_acteur); m_largeurOptimale = 500; } else { m_lnkNomIntervenant.Visible = false; m_modele.Visible = true; m_modele.Init(modeleUtilise, acteur); m_lnkActeur.Visible = true; m_largeurOptimale = modeleUtilise.Largeur + m_panOccupation.Width + 6; m_hauteurOptimale = modeleUtilise.Hauteur; } Size = new Size(m_largeurOptimale, m_hauteurOptimale); { //On récupère la tranche de travail actuelle CTrancheHoraire[] tranches = m_acteur.GetHoraires(DateTime.Now, DateTime.Now); if (tranches.Length > 0) { CTrancheHoraire tranche = tranches[0]; CTypeOccupationHoraire typeoccup = tranche.TypeOccupationHoraire; m_lblEtat.Text = typeoccup.Libelle; m_panOccupation.BackColor = Color.FromArgb(typeoccup.Couleur); m_actif = typeoccup.EstDisponible; if (m_frmConteneur != null) { m_lblEtat.Click += new EventHandler(m_lblEtat_Click); } } else { m_lblEtat.Text = I.T("Inactive|1305"); m_panOccupation.BackColor = Color.Red; m_actif = false; } } //else //{ // m_lblEtat.Text = I.T("Missing information|1306"); // m_panOccupation.BackColor = Color.Red; // m_actif = false; //} //Position du label Etat if (m_lblEtat.Width > m_largeurEtat) { m_panOccupation.Width = m_lblEtat.Width + 6; m_largeurEtat = m_panOccupation.Width; } else { //On centre m_panOccupation.Width = m_largeurEtat; int x = (m_largeurEtat - m_lblEtat.Width) / 2; m_lblEtat.Location = new Point(x, m_lblEtat.Location.Y); } }
//------------------------------------------------------------------------- public CFormEditionTypeOccupationHoraire(CTypeOccupationHoraire civilite, CListeObjetsDonnees liste) : base(civilite, liste) { // Cet appel est requis par le Concepteur Windows Form. InitializeComponent(); }
public void SetUptTest() { CResultAErreur result = CResultAErreur.True; CTimosTestMetierApp.AssureInit(); m_contexteDonnee = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false); //Création de l'acteur de test CActeur acteur = new CActeur(m_contexteDonnee); if (!acteur.ReadIfExists(new CFiltreData(CActeur.c_champNom + "=@1", c_strNomActeur))) { acteur.CreateNew(); acteur.Nom = c_strNomActeur; acteur.Prenom = "Youcef"; result = acteur.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdActeur = acteur.Id; // Création des Types d'occupation horraire // Repos CTypeOccupationHoraire toRepos = new CTypeOccupationHoraire(m_contexteDonnee); if (!toRepos.ReadIfExists( new CFiltreData(CTypeOccupationHoraire.c_champLibelle + "=@1", c_strRepos))) { toRepos.CreateNew(); toRepos.Libelle = c_strRepos; toRepos.Priorite = 10; result = toRepos.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdOccupationRepos = toRepos.Id; // Jour CTypeOccupationHoraire toJour = new CTypeOccupationHoraire(m_contexteDonnee); if (!toJour.ReadIfExists( new CFiltreData(CTypeOccupationHoraire.c_champLibelle + "=@1", c_strJour))) { toJour.CreateNew(); toJour.Libelle = c_strJour; toJour.Priorite = 50; result = toJour.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdOccupationJour = toJour.Id; // Astreinte CTypeOccupationHoraire toAstreinte = new CTypeOccupationHoraire(m_contexteDonnee); if (!toAstreinte.ReadIfExists( new CFiltreData(CTypeOccupationHoraire.c_champLibelle + "=@1", c_strAstreinte))) { toAstreinte.CreateNew(); toAstreinte.Libelle = c_strAstreinte; toAstreinte.Priorite = 100; result = toAstreinte.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdOccupationAstreinte = toAstreinte.Id; // Création de l'Horaire journalier CHoraireJournalier horaire = new CHoraireJournalier(m_contexteDonnee); if (!horaire.ReadIfExists( new CFiltreData(CHoraireJournalier.c_champLibelle + "=@1", c_strLabelHoraireJournalier))) { horaire.CreateNew(); horaire.Libelle = c_strLabelHoraireJournalier; result = horaire.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdHoraireJournalier = horaire.Id; // Création du Calendier CCalendrier calendrier = new CCalendrier(m_contexteDonnee); if (!calendrier.ReadIfExists( new CFiltreData(CCalendrier.c_champLibelle + "=@1", c_strLabelCalendrier))) { calendrier.CreateNew(); calendrier.Libelle = c_strLabelCalendrier; calendrier.Acteur = acteur; calendrier.HoraireParDefaut = horaire; result = calendrier.CommitEdit(); Assert.IsTrue(result.Result); } m_nIdCalendrier = calendrier.Id; // CRéation de l'EO de test CTypeEntiteOrganisationnelle tpEO = new CTypeEntiteOrganisationnelle(m_contexteDonnee); if (!tpEO.ReadIfExists( new CFiltreData(CTypeEntiteOrganisationnelle.c_champLibelle + "=@1", c_strLabelTypeEO))) { tpEO.CreateNew(); tpEO.Libelle = c_strLabelTypeEO; Assert.IsTrue(tpEO.CommitEdit()); } m_nIdTypeEO = tpEO.Id; CEntiteOrganisationnelle eo = new CEntiteOrganisationnelle(m_contexteDonnee); if (!eo.ReadIfExists( new CFiltreData(CEntiteOrganisationnelle.c_champLibelle + "=@1", c_strLabelEO))) { eo.CreateNew(); eo.Libelle = c_strLabelEO; eo.TypeEntite = tpEO; Assert.IsTrue(eo.CommitEdit()); } m_nIdEO = eo.Id; // Affecte l'EO à l'acteur de test acteur.AjouterEO(m_nIdEO); }