/////////////////////////////////////////////////////////////// public override CResultAErreur VerifieDonnees(CObjetDonnee objet) { CResultAErreur result = CResultAErreur.True; try { //TODO : Insérer la logique de vérification de donnée CSpvEvenementReseau alarm = (CSpvEvenementReseau)objet; if (!alarm.VerifieDateTexte()) { result.EmpileErreur(I.T("Empty date or bad value in text date|50011")); } } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } return(result); }
private void ReadData() { using (CContexteDonnee contexte = new CContexteDonnee(0, true, false)) { CSpvEvenementReseau evt; if (m_spvAlarm == null) // Init. à partir de l'événement réseau { evt = new CSpvEvenementReseau(contexte); if (evt.ReadIfExists(m_nIdSpvEvtAlarme)) { m_spvAlarm = evt.SpvAlarme; } else { return; } } else { evt = m_spvAlarm.EvenementDebut; } CDivers div = new CDivers(); m_lstTrapInfo = new List <string>(); m_lstInfoClients = new List <CInfoClientAlarmeAffichee>(); m_lstInfoServices = new List <CInfoServiceAlarmeAffichee>(); m_nIdAlarmData = m_spvAlarm.Id; m_InfoAlarmGeree = new CInfoAlarmeGereeAffichee(); if (evt.SpvAlarmgeree != null) { m_InfoAlarmGeree.Id = (int)evt.SpvAlarmgeree.Id; m_InfoAlarmGeree.Name = evt.SpvAlarmgeree.Alarmgeree_Name; } if (m_spvAlarm.SpvSite != null) { if (m_InfoSite == null) { m_InfoSite = new CInfoSiteAlarmeAffichee(); } m_InfoSite.Id = (int)m_spvAlarm.SpvSite.Id; m_InfoSite.Name = m_spvAlarm.SpvSite.SiteNom; if (m_spvAlarm.SpvSite.TypeSite != null) { m_InfoSite.TypeName = m_spvAlarm.SpvSite.TypeSite.TypeSiteNom; } } else if (m_spvAlarm.SpvEquip != null) { m_InfoEquip = new CInfoEquipementAlarmeAffichee(); m_InfoEquip.Id = (int)m_spvAlarm.EquipId; m_InfoEquip.TypeName = m_spvAlarm.SpvEquip.TypeEquipement.Libelle; m_InfoEquip.Name = m_spvAlarm.SpvEquip.CommentairePourSituer; } else if (m_spvAlarm.SpvLiai != null) { m_InfoLiai = new CInfoLiaiAlarmeAffichee(); m_InfoLiai.Id = (int)m_spvAlarm.LiaiId; m_InfoLiai.TypeName = m_spvAlarm.SpvLiai.Typeliaison.Libelle; m_InfoLiai.Name = m_spvAlarm.SpvLiai.NomComplet; } //if (m_InfoSite == null) // m_InfoSite = new CInfoSiteAlarmeAffichee(); m_nIddeb = evt.Id; m_stAlarmCl = evt.AlarmCategory; m_nNumObj = evt.AlarmNumObj; m_InfoAlarmGeree.CodeAlarmEvent = (EAlarmEvent)m_spvAlarm.CodeEvenementX733; if (evt.TypeEvenementReseau == ETypeEvenementReseau.DebutAlarme) { m_AlarmDate = m_spvAlarm.DateDebut; m_StartAlarmDate = m_AlarmDate; } else { m_AlarmDate = (System.DateTime)m_spvAlarm.DateFin; m_StopAlarmDate = m_AlarmDate; m_StartAlarmDate = m_spvAlarm.DateDebut; } m_nGrave = m_spvAlarm.CodeGravite; m_stNSeuil = m_spvAlarm.NomSeuilAlarme; m_nVSeuil = m_spvAlarm.ValeurSeuilAlarme; m_stNumal = evt.AlarmNumAl; m_nTexte = evt.CodeAlarmNature; m_stCommentaire = m_spvAlarm.Commententaire; m_stInfo = evt.AlarmInfo; if (m_spvAlarm.SpvLienAccesAlarme != null) { m_bAAcquitter = (bool)m_spvAlarm.SpvLienAccesAlarme.Acquitter; m_bSonne = (bool)m_spvAlarm.SpvLienAccesAlarme.SonActive; } if (evt.SpvAlarmgeree != null) { m_InfoAlarmGeree.CodeRingType = evt.SpvAlarmgeree.CodeAlarmgereeTypeSon; } m_bCommut = evt.AlarmCommut; m_nIdSpvEvtAlarme = evt.Id; if (evt.ElementGereNomSite != null && evt.ElementGereNomSite.Length > 0) { if (m_InfoSite == null) { m_InfoSite = new CInfoSiteAlarmeAffichee(); } m_InfoSite.Name = evt.ElementGereNomSite; } m_InfoAlarmGeree.Name = m_spvAlarm.NomAlarmeGeree; //string stProgConcNom = m_spvAlarm.ProgrammesConcernes; if (m_spvAlarm.ServicesConcernes != null) { foreach (System.Int32 nServiceId in m_spvAlarm.ServicesConcernes) { CInfoServiceAlarmeAffichee serviceAff = new CInfoServiceAlarmeAffichee(); serviceAff.Id = nServiceId; CSpvSchemaReseau service = serviceAff.GetSpvService(contexte); serviceAff.Name = service.Libelle; m_lstInfoServices.Add(serviceAff); } } if (m_spvAlarm.ClientsConcernes != null) { foreach (System.Int32 nClientId in m_spvAlarm.ClientsConcernes) { CInfoClientAlarmeAffichee clientAff = new CInfoClientAlarmeAffichee(); clientAff.Id = nClientId; CSpvClient client = clientAff.GetSpvClient(contexte); clientAff.Name = client.CLIENT_NOM; m_lstInfoClients.Add(clientAff); } } if (m_spvAlarm.ProgsOper != null) { CInfoServiceAlarmeAffichee infoService; for (int i = 0; i < m_lstInfoServices.Count; i++) { infoService = m_lstInfoServices[i]; if (m_spvAlarm.ProgsOper.Length > i) { infoService.EtatOper = m_spvAlarm.ProgsOper[i]; } } } m_stBindingVarInfo = m_spvAlarm.GetBindingVarInfo(); FillTrapInfo(); //m_bAcquittee = (m_spvAlarm.Acquittee == null) ? false : m_spvAlarm.Acquittee; m_bAcquittee = m_spvAlarm.Acquittee; m_bLectureFaite = true; } }