//------------------------------------------
        public void FillFromTable(CODEQBase objetDeRequete)
        {
            CEasyQuery query = objetDeRequete.Query;

            if (query == null)
            {
                return;
            }
            IdObjetDeQuerySource = objetDeRequete.Id;
            HashSet <string> champsASupprimer = new HashSet <string>();

            foreach (IChampEntiteSNMP champ in Champs.ToArray())
            {
                if (champ is CChampEntiteSnmpStandard)
                {
                    champsASupprimer.Add(champ.Id);
                }
            }
            foreach (IColumnDeEasyQuery col in objetDeRequete.Columns)
            {
                CChampEntiteFromQuery champ = Champs.FirstOrDefault(c =>
                                                                    c is CChampEntiteFromQuery && ((CChampEntiteFromQuery)c).ColonneSource.Id == col.Id) as CChampEntiteFromQuery;
                if (champ == null)
                {
                    champ = new CChampEntiteFromQuery();
                    ChampsListe.Add(champ);
                }
                champ.InitFromColonneSource(col, objetDeRequete);
            }
        }
Esempio n. 2
0
        //-----------------------------------------------------
        internal void FillFromSource(DataRow row)
        {
            if (TypeEntite != null)
            {
                Dictionary <string, DataColumn> dicIdToCol  = new Dictionary <string, DataColumn>();
                Dictionary <string, DataColumn> dicNomToCol = new Dictionary <string, DataColumn>();
                foreach (DataColumn col in row.Table.Columns)
                {
                    dicNomToCol[col.ColumnName] = col;
                    string strId = col.ExtendedProperties[CODEQBase.c_extPropColonneId] as string;
                    if (strId != null)
                    {
                        dicIdToCol[strId] = col;
                    }
                }


                foreach (IChampEntiteSNMP champ in TypeEntite.Champs)
                {
                    CChampEntiteFromQuery cfq = champ as CChampEntiteFromQuery;
                    DataColumn            col = null;
                    if (cfq != null)
                    {
                        dicIdToCol.TryGetValue(cfq.Id, out col);
                        if (col == null)
                        {
                            dicNomToCol.TryGetValue(cfq.NomChamp, out col);
                        }
                        if (col != null)
                        {
                            SetValeurChamp(cfq.Id, row[col] == DBNull.Value ? null : row[col]);
                        }
                    }
                }
            }
        }