Пример #1
0
        //-------------------------------------------------------
        public CParametreSourceChart GetCloneAvecMemeId()
        {
            CParametreSourceChart p = CCloner2iSerializable.Clone(this, null, new object[] { m_chartSetup }) as CParametreSourceChart;

            p.m_strId = m_strId;
            return(p);
        }
 //-------------------------------------------------------------------
 public bool IsApplicableToSource(CParametreSourceChart parametre)
 {
     if (parametre.TypeSource.TypeDotNetNatif == typeof(CEasyQuery))
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
        //-------------------------------------------------
        public void AddSourceFV(CParametreSourceChart parametre)
        {
            CParametreSourceChart pOld = m_listeSourcesFV.FirstOrDefault(p => p.SourceId == parametre.SourceId);

            if (pOld != null)
            {
                m_listeSourcesFV.Remove(pOld);
            }
            m_listeSourcesFV.Add(parametre);
        }
        //-------------------------------------------------------------------
        public object[] GetValues(CChartSetup chart)
        {
            List <object>         lstValeurs = new List <object>();
            CParametreSourceChart p          = chart.ParametresDonnees.GetSourceFV(SourceId);

            if (p != null)
            {
                CEasyQuery query = p.GetSource(chart) as CEasyQuery;
                if (query != null)
                {
                    //trouve la table
                    DataTable table = query.GetTable(TableName);
                    if (table != null)
                    {
                        DataColumn col = table.Columns[ColumnName];
                        if (col != null)
                        {
                            foreach (DataRow row in table.Rows)
                            {
                                object val = row[col];
                                if (val == DBNull.Value)
                                {
                                    lstValeurs.Add(null);
                                }
                                else
                                {
                                    lstValeurs.Add(val);
                                }
                            }
                        }
                        else if (Formule != null)
                        {
                            foreach (DataRow row in table.Rows)
                            {
                                CDynamicDataTableRow          dr  = new CDynamicDataTableRow(row);
                                CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(dr);
                                CResultAErreur result             = Formule.Eval(ctx);
                                if (result)
                                {
                                    lstValeurs.Add(result.Data);
                                }
                                else
                                {
                                    lstValeurs.Add(null);
                                }
                            }
                        }
                    }
                }
            }
            return(lstValeurs.ToArray());
        }
        //-------------------------------------------------------------------
        public string GetLabel(CDonneesDeChart donnees)
        {
            if (donnees == null)
            {
                return(LabelType);
            }
            CParametreSourceChart p = donnees.GetSourceFV(SourceId);

            StringBuilder bl = new StringBuilder();

            if (p != null)
            {
                bl.Append(p.SourceName);
            }
            else
            {
                bl.Append("?");
            }
            bl.Append(".");
            if (TableName.Length > 0)
            {
                bl.Append(TableName);
            }
            else
            {
                bl.Append("?");
            }
            bl.Append(".");
            if (ColumnName.Length > 0)
            {
                bl.Append(ColumnName);
            }
            else
            {
                bl.Append("?");
            }
            return(bl.ToString());
        }
        //-------------------------------------------------------------------
        public object[] GetValues(CChartSetup chart)
        {
            List <object>         lstRetour = new List <object>();
            CParametreSourceChart p         = chart.ParametresDonnees.GetSourceFV(m_strIdSource);

            if (p != null && m_formule != null)
            {
                object      valeur  = p.GetSource(chart);
                IEnumerable valEnum = valeur as IEnumerable;
                if (valEnum is IEnumerable && EvaluateOnEachSourceElement)
                {
                    foreach (object o in valEnum)
                    {
                        CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(o);
                        CResultAErreur result             = m_formule.Eval(ctx);
                        if (result)
                        {
                            lstRetour.Add(result.Data);
                        }
                    }
                }
                else
                {
                    CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(valeur);
                    CResultAErreur result             = m_formule.Eval(ctx);

                    IEnumerable retour = result.Data as IEnumerable;
                    if (retour != null)
                    {
                        foreach (object obj in retour)
                        {
                            lstRetour.Add(obj);
                        }
                    }
                }
            }
            return(lstRetour.ToArray());
        }
Пример #7
0
 //-------------------------------------------------
 public void RemoveSourceFV(CParametreSourceChart parametre)
 {
     m_listeSourcesFV.Remove(parametre);
 }
 //-------------------------------------------------------------------
 public bool IsApplicableToSource(CParametreSourceChart parametre)
 {
     return(true);
 }