//------------------------------------------------------------ private void m_btnAjouter_Click(object sender, EventArgs e) { if (m_elementAIntervention == null) { return; } CTypeIntervention typeIntervention = (CTypeIntervention)CFormSelectUnObjetDonnee.SelectionRechercheRapide( I.T("Sélectionnez une intervention|20732"), typeof(CTypeIntervention), null, "", "", ""); if (typeIntervention != null) { CIntervention tache = new CIntervention(m_contexteDonnee); tache.CreateNewInCurrentContexte(); tache.TypeIntervention = typeIntervention; tache.ElementAIntervention = (CObjetDonneeAIdNumerique)m_elementAIntervention; tache.DureePrevisionnelle = typeIntervention.DureeStandardHeures; CFractionIntervention fraction = new CFractionIntervention(m_contexteDonnee); fraction.CreateNewInCurrentContexte(); fraction.DateDebutPlanifie = m_controlPlanning.DateDebut; fraction.DateFinPlanifiee = fraction.DateDebutPlanifie.AddHours(tache.DureePrevisionnelle); fraction.Intervention = tache; m_controlPlanning.Refresh(); //m_controlPlanning.SelectTranche(fraction); } }
public CInterventionPourEditeurPreventive(string label, CSite site, List <CListeOperations> listeOp, DateTime dateDebut, DateTime dateFin, CTypeIntervention typeinter) { m_dateFin = dateFin; m_dateDebut = dateDebut; m_label = label; m_site = site; m_listeOp = listeOp; m_typeInter = typeinter; m_inter = null; m_bRemove = false; }
public void Init(CIntervention intervention) { m_intervention = intervention; this.SuspendDrawing(); List <CControleAffecteIntervenantsDeProfil> listeDispo = new List <CControleAffecteIntervenantsDeProfil>(); foreach (Control ctrl in this.Controls) { if (ctrl is CControleAffecteIntervenantsDeProfil) { ctrl.Visible = false; listeDispo.Add((CControleAffecteIntervenantsDeProfil)ctrl); } } if (Intervention.TypeIntervention != null) { m_lastTypeInterventionInit = Intervention.TypeIntervention; foreach (CTypeIntervention_ProfilIntervenant relProfil in Intervention.TypeIntervention.RelationsProfilsIntervenants) { CControleAffecteIntervenantsDeProfil ctrl = null; if (listeDispo.Count > 0) { ctrl = listeDispo[0]; listeDispo.RemoveAt(0); } else { ctrl = new CControleAffecteIntervenantsDeProfil(); this.Controls.Add(ctrl); } ctrl.Visible = true; ctrl.InitChamps(m_intervention, relProfil); ctrl.LockEdition = !m_gestionnaireModeEdition.ModeEdition; ctrl.Dock = DockStyle.Top; ctrl.BringToFront(); } } this.ResumeDrawing(); }
//----------------------------------------------------------------------------------- void sousItem_Click(object sender, EventArgs e) { if (sender is ToolStripMenuItem) { ToolStripMenuItem item = ((ToolStripMenuItem)sender); object[] tag = (object[])item.Tag; CSite site = (CSite)tag[0]; CTypeIntervention typeInter = (CTypeIntervention)tag[1]; if (site != null && typeInter != null) { StartNewIntervention(site, typeInter); } else { CFormAlerte.Afficher(I.T("Internal Error|30"), EFormAlerteType.Erreur); } } }
//----------------------------------------------------------------------------------- private CResultAErreur StartNewIntervention(CSite site, CTypeIntervention typeInter) { CResultAErreur result = CResultAErreur.True; // Créer ici une nouvelle intervention CIntervention nouvelleInter = new CIntervention(m_phaseEdite.ContexteDonnee); nouvelleInter.CreateNew(); nouvelleInter.PhaseTicket = m_phaseEdite; nouvelleInter.TypeIntervention = typeInter; nouvelleInter.ElementAIntervention = site; CFormNavigateurPopup.Show(new CFormEditionIntervention(nouvelleInter), FormWindowState.Maximized); if (nouvelleInter.IsValide()) { m_phaseEdite.DateDebut = DateTime.Now; // Mettre à jour la liste des Interventions InitListeInterventions(); } return(result); }
//---------------------------------------------------------------------------- private void InitListesPlannifieurs(bool bMajChamps) { CFiltreData filtrePlanifieurs = new CFiltreDataAvance(CActeur.c_nomTable, "HAS(" + CDonneesActeurUtilisateur.c_nomTable + "." + CDonneesActeurUtilisateur.c_champId + ")"); CFiltreData filtrePrePlanifieurs = filtrePlanifieurs.GetClone(); bool bAppliquerProfils = true; if (bAppliquerProfils) { CTypeIntervention typeIntervention = (CTypeIntervention)m_cmbTypeIntervention.ElementSelectionne; if (typeIntervention != null && typeIntervention.ProfilPlanifieur != null) { CListeObjetsDonnees lstTmp = typeIntervention.ProfilPlanifieur.GetElementsForSource(Intervention, null); CFiltreDataAvance filtreTmp = CFiltreDataAvance.ConvertFiltreToFiltreAvance(CDonneesActeurUtilisateur.c_nomTable, lstTmp.FiltrePrincipal); filtreTmp.ChangeTableDeBase(CActeur.c_nomTable, CDonneesActeurUtilisateur.c_nomTable); filtrePlanifieurs = CFiltreData.GetAndFiltre(filtrePlanifieurs, filtreTmp); } if (typeIntervention != null && typeIntervention.ProfilPreplanifieur != null) { CListeObjetsDonnees lstTmp = typeIntervention.ProfilPreplanifieur.GetElementsForSource(Intervention, null); CFiltreDataAvance filtreTmp = CFiltreDataAvance.ConvertFiltreToFiltreAvance(CDonneesActeurUtilisateur.c_nomTable, lstTmp.FiltrePrincipal); filtreTmp.ChangeTableDeBase(CActeur.c_nomTable, CDonneesActeurUtilisateur.c_nomTable); filtrePrePlanifieurs = CFiltreData.GetAndFiltre(filtrePrePlanifieurs, filtreTmp); } } m_txtSelectPreplanificateur.InitAvecFiltreDeBase <CActeur>( "IdentiteComplete", filtrePrePlanifieurs, true); m_txtSelectPlanificateur.InitAvecFiltreDeBase <CActeur>( "IdentiteComplete", filtrePlanifieurs, true); }
//------------------------------------------------------------------- public override CResultAErreur VerifieDonnees(CObjetDonnee objet) { CResultAErreur result = CResultAErreur.True; try { CTypeIntervention typeInter = (CTypeIntervention)objet; // Verifie le champ "Libelle" if (typeInter.Libelle == "") { result.EmpileErreur(I.T("Intervention Type label cannot be empty|138")); } if (!CObjetDonneeAIdNumerique.IsUnique(typeInter, CTypeIntervention.c_champLibelle, typeInter.Libelle)) { result.EmpileErreur(I.T("Intervention Type @1 already exists|10006"), typeInter.Libelle); } if (typeInter.Code != "") { if (!CObjetDonneeAIdNumerique.IsUnique(typeInter, CTypeIntervention.c_champCode, typeInter.Code)) { result.EmpileErreur(I.T("Another Intervention Type width code @1 already exists|144"), typeInter.Code); } } if (typeInter.Mnemomnique != "") { if (!CObjetDonneeAIdNumerique.IsUnique(typeInter, CTypeIntervention.c_champMnemomnique, typeInter.Mnemomnique)) { result.EmpileErreur(I.T("Another Intervention Type whith mnemomnic @1 already exists|145"), typeInter.Mnemomnique); } } if (typeInter.Contraintes.Count > 0 && typeInter.ProfilRessourceDefaut == null) { result.EmpileErreur(I.T("Resource profile must be defined|200")); } if (typeInter.ProfilRessourceDefaut != null) { if (typeInter.ProfilRessourceDefaut.TypeElements != typeof(CRessourceMaterielle) || typeInter.ProfilRessourceDefaut.TypeSource != typeof(CIntervention)) { result.EmpileErreur(I.T("The default resource profile is incompatible|222")); } } if (typeInter.ProfilPlanifieur != null && (typeInter.ProfilPlanifieur.TypeElements != typeof(CDonneesActeurUtilisateur) || typeInter.ProfilPlanifieur.TypeSource != typeof(CIntervention))) { result.EmpileErreur(I.T("The default planner profile is incompatible|223")); } if (typeInter.ProfilPreplanifieur != null && (typeInter.ProfilPreplanifieur.TypeElements != typeof(CDonneesActeurUtilisateur) || typeInter.ProfilPreplanifieur.TypeSource != typeof(CIntervention))) { result.EmpileErreur(I.T("The default preplanner profile is incompatible|224")); } } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } return(result); }