Esempio n. 1
0
        public long GetCount(FilterExpression filter)
        {
            Check.Require(_IsInitialized, "The class is not initialized yet.");

            FilterExpression f = null;

            if (filter != null)
            {
                f = (FilterExpression)filter.Clone();
            }

            foreach (EntitySecurityBase checker in this.SecurityCheckers)
            {
                checker.GetCount(f);
            }

            return(DataAccessObject.GetCount(f));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the avgerage value of a column filter by an specified filter
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public double GetAvg(string columnName, FilterExpression filter)
        {
            Check.Require(_IsInitialized, "The class is not initialized yet.");

            FilterExpression f = null;

            if (filter != null)
            {
                f = (FilterExpression)filter.Clone();
            }

            foreach (EntitySecurityBase checker in this.SecurityCheckers)
            {
                checker.GetAvg(columnName, f);
            }

            return(this.DataAccessObject.GetAvg(columnName, f));
        }
        public void CloneTest()
        {
            FilterExpression target = new FilterExpression();

            target.AddFilter(new Filter(vTestCaseTester.ColumnNames.FieldString, "C1"));
            target.AddFilter(new Filter(vTestCaseTester.ColumnNames.FieldString, "C2"));
            FilterExpression f2 = new FilterExpression();

            f2.AddFilter(new Filter(vTestCaseTester.ColumnNames.FieldString, "C3"));
            target.AddFilterExpression(f2);
            FilterExpression actual;

            actual = (FilterExpression)target.Clone();
            Assert.AreEqual(actual.FiltersList.Count, target.FiltersList.Count);
            var enumeratorTarget = target.FiltersList.GetEnumerator();
            var enumeratorActual = actual.FiltersList.GetEnumerator();

            while (enumeratorTarget.MoveNext())
            {
                enumeratorActual.MoveNext();
                Assert.AreEqual(enumeratorTarget.Current, enumeratorActual.Current);
            }
        }