Example #1
0
        private void CalSubTotalData(FilledListEventArgs e)
        {
            if (fStatFields.Count == 0)
            {
                return;
            }
            DataTable mainTableData = DataSet.Tables[FillTableName];

            DataTable subTotalTable = new DataTable("_SubTotal");
            var       columns       = subTotalTable.Columns;

            foreach (var field in fStatFields)
            {
                columns.Add(field.NickName, typeof(double));
            }

            var row = subTotalTable.NewRow();

            foreach (StatFieldConfigItem field in fStatFields)
            {
                row[field.NickName] = CalSubTotalNum(mainTableData, field.NickName, field.Method);
            }
            subTotalTable.Rows.Add(row);
            DataSet.Tables.Add(subTotalTable);
        }
Example #2
0
        private DataTable CalTotalData(FilledListEventArgs e)
        {
            if (fStatFields.All(item => item.Method == StatMethod.Count))
            {
                DataSet.Tables.Add(new DataTable("_Total"));
            }
            else
            {
                SqlSelector.Select(Context, DataSet, "_Total", CreateStatSql(), e.Condition);
            }
            DataTable table = DataSet.Tables["_Total"];

            AppendCountPart(table, e.Count);
            return(table);
        }
Example #3
0
        protected override void OnFilledListTables(FilledListEventArgs e)
        {
            base.OnFilledListTables(e);

            if (e.Count > 0)
            {
                if (IsCalTotalData(e))
                {
                    CalTotalData(e);
                }
                if (UseSubTotal)
                {
                    CalSubTotalData(e);
                }
            }
        }
Example #4
0
        private bool IsCalTotalData(FilledListEventArgs e)
        {
            switch (CalcMode)
            {
            case StatCalcMode.First:
                if (e.PageNumber == 0)
                {
                    return(true);
                }
                break;

            case StatCalcMode.Last:
                if ((e.PageSize * (e.PageNumber + 1)) >= e.Count)
                {
                    return(true);
                }
                break;

            case StatCalcMode.PerPage:
                return(true);
            }
            return(false);
        }
Example #5
0
 protected virtual void OnFilledListTables(FilledListEventArgs e)
 {
     EventUtil.ExecuteEventHandler(EventHandlers, EventConst.ListEvent, this, e);
 }