//------------------------------------------------------------------- public override bool IsInFilter(string strChamp, IDataRoomEntry record) { foreach (ITestDataHotel test in SousTests) { if (test != null && test.IsInFilter(strChamp, record)) { return(false); } } return(true); }
//------------------------------------------------------------------- public bool IsInFilter(string strChamp, IDataRoomEntry record) { switch (m_operateur) { case EOperateurComparaisonMassStorage.Superieur: return(record.Date >= m_dateTest); case EOperateurComparaisonMassStorage.Inferieur: return(record.Date <= m_dateTest); } return(true); }
//------------------------------------------------------------------- public bool IsInFilter(string strChamp, IDataRoomEntry record) { if (strChamp == m_strIdChamp) { switch (m_operateurComparaison) { case EOperateurComparaisonMassStorage.Superieur: return(record.Value > m_fValueTest); case EOperateurComparaisonMassStorage.Inferieur: return(record.Value < m_fValueTest); } } return(true); }
//------------------------------------------------------------------------------------------------------------------- /// <summary> /// Dit depuis combien de temps le champ demandé correspond /// au filtre à la date donnée /// </summary> /// <param name="strTableId"></param> /// <param name="strEntityId"></param> /// <param name="strFieldId"></param> /// <param name="dt"></param> /// <param name="filtre"></param> /// <returns></returns> public double GetDepuisCombienDeTempsEnS( string strTableId, string strEntityId, string strFieldId, DateTime dt, ITestDataHotel filtre) { IDataRoomEntry entry = GetKnownDataAt(strTableId, strEntityId, strFieldId, dt); if (entry == null) { return(0); } if (!filtre.IsInFilter(strFieldId, entry)) { return(0); } entry = GetFirstNotInSerie(strTableId, strEntityId, strFieldId, dt, filtre); if (entry != null) { return((dt - entry.Date).TotalSeconds); } return(0); }
//------------------------------------------------------------------------------------- public IDataRoomEntry GetFirstNotInSerie( string strTableId, string strEntityId, string strFieldId, DateTime dateRecherche, ITestDataHotel filtre) { CListeEntitesDeMemoryDb <CDataRoom> lstRooms = new CListeEntitesDeMemoryDb <CDataRoom>(m_database); IDataRoomEntry minEntry = null; foreach (CDataRoom room in lstRooms) { try { IDataRoomServer srv = GetRoomServer(room); if (srv != null) { IDataRoomEntry entry = srv.GetFirstNotInSerieDirect( strTableId, strEntityId, strFieldId, dateRecherche, filtre); if (entry != null) { if (minEntry == null || minEntry.Date > entry.Date) { minEntry = entry; } } } } catch { } } return(minEntry); }
//------------------------------------------------- public void FinaliseCalcul( string strIdTable, DataTable tableRemplieEtTriee, IDataRoomServer server, DateTime?dateDebut, DateTime?dateFin) { if (dateDebut == null) { return; } if (!tableRemplieEtTriee.Columns.Contains(NomChampFinal)) { DataColumn col = new DataColumn(NomChampFinal, typeof(double)); col.AllowDBNull = true; tableRemplieEtTriee.Columns.Add(col); } Dictionary <string, double?> dicDureesParEntite = new Dictionary <string, double?>(); Dictionary <string, DateTime> dicLastDates = new Dictionary <string, DateTime>(); //Identifie toutes les entités foreach (DataRow row in tableRemplieEtTriee.Rows) { string strEttId = (string)row[CDataHotelTable.c_nomChampTableEntiteId]; double?fVal = null; if (!dicDureesParEntite.TryGetValue(strEttId, out fVal)) { IDataRoomEntry entry = server.GetFirstNotInSerie( strIdTable, strEttId, IdChampSource, dateDebut.Value, m_filtre); if (entry == null) { fVal = 0; } else { fVal = ((DateTime)row[CDataHotelTable.c_nomChampTableDate] - entry.Date).TotalSeconds; } dicDureesParEntite[strEttId] = fVal; dicLastDates[strEttId] = (DateTime)row[CDataHotelTable.c_nomChampTableDate]; row[NomChampFinal] = fVal.Value; } else { if (row[IdChampSource] != DBNull.Value) { CDataRoomEntry entry = new CDataRoomEntry( (DateTime)row[CDataHotelTable.c_nomChampTableDate], (double)row[IdChampSource]); if (Filtre.IsInFilter(IdChampSource, entry)) { DateTime dt = dicLastDates[strEttId]; fVal = dicDureesParEntite[strEttId]; fVal += ((DateTime)row[CDataHotelTable.c_nomChampTableDate] - dt).TotalSeconds; } else { fVal = 0; } dicDureesParEntite[strEttId] = fVal; dicLastDates[strEttId] = (DateTime)row[CDataHotelTable.c_nomChampTableDate]; row[NomChampFinal] = fVal.Value; } } } }
public abstract bool IsInFilter(string strChamp, IDataRoomEntry record);