Beispiel #1
0
 //-------------------------------------------------------
 public void AddColonneCalculee(CColonneEQCalculee colCalc)
 {
     if (!m_listeColonnesCalculees.Contains(colCalc))
     {
         m_listeColonnesCalculees.Add(colCalc);
     }
 }
Beispiel #2
0
        //---------------------------------------------------
        protected override CResultAErreur GetDatasHorsCalculees(CListeQuerySource sources)
        {
            CResultAErreur result = CResultAErreur.True;

            if (TableSource != null)
            {
                result = TableSource.GetDatas(sources);
                if (!result)
                {
                    return(result);
                }
                DataTable source = result.Data as DataTable;
                DataTable table  = new DataTable();
                Dictionary <IColumnDeEasyQuery, DataColumn> mapCols = new Dictionary <IColumnDeEasyQuery, DataColumn>();
                foreach (IColumnDeEasyQuery colonne in m_listeColonnesCalculeesFromSource)
                {
                    Type tp = colonne.DataType;
                    if (tp.IsGenericType && tp.GetGenericTypeDefinition() == typeof(Nullable <>))
                    {
                        tp = tp.GetGenericArguments()[0];
                    }
                    DataColumn col = new DataColumn(colonne.ColumnName, tp);
                    table.Columns.Add(col);
                    mapCols[colonne] = col;
                }
                if (source != null)
                {
                    foreach (DataRow row in source.Rows)
                    {
                        CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(row);
                        DataRow rowDest = table.NewRow();
                        foreach (IColumnDeEasyQuery col in m_listeColonnesCalculeesFromSource)
                        {
                            CColonneEQCalculee colCalc = col as CColonneEQCalculee;
                            if (colCalc != null && colCalc.Formule != null)
                            {
                                result = colCalc.Formule.Eval(ctx);
                                if (result)
                                {
                                    try
                                    {
                                        rowDest[mapCols[col]] = result.Data;
                                    }
                                    catch { }
                                }
                            }
                        }
                        table.Rows.Add(rowDest);
                    }
                    result.Data = table;
                }
            }
            if (!(result.Data is DataTable))
            {
                result.EmpileErreur(I.T("Error in table @1|20002", NomFinal));
            }
            return(result);
        }
Beispiel #3
0
 //-------------------------------------------------------
 public void RemoveColonneCalculee(CColonneEQCalculee colCalc)
 {
     m_listeColonnesCalculees.Remove(colCalc);
 }