Пример #1
0
        /// <summary>
        /// 日销售情况报表
        /// </summary>
        /// <param name="filter">条件</param>
        /// <returns></returns>
        public static StatementResult<ArrayList> DaySalesData(DaySalesFilter filter)
        {
            StatementResult<ArrayList> result = new StatementResult<ArrayList>();
            result.ServicePageIndex = filter.ServicePageIndex;
            result.PageSize = filter.PageSize;

            PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
            CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("DaySalesData");
            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "LogDate DESC"))
            {
                DateTime beginDate = DateTime.Parse(filter.Date);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "LogDate", DbType.DateTime,
                    "@BeginLogDate", QueryConditionOperatorType.MoreThanOrEqual, beginDate);
                DateTime endDate = beginDate.AddDays(1);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "LogDate", DbType.DateTime,
                    "@EndLogDate", QueryConditionOperatorType.LessThan, endDate);

                cmd.CommandText = sqlBuilder.BuildQuerySql();
                result.Result = DbHelper.DatatableConvertArrayList(cmd.ExecuteDataTable());
                result.TotalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
                result.TotalValue = Convert.ToDecimal(cmd.GetParameterValue("@TotalAmount"));

                return result;
            }
        }
Пример #2
0
 public void TestMethodDaySalesData()
 {
     DaySalesFilter filter = new DaySalesFilter()
     {
         PageIndex = 1,
         PageSize = 10,
         Date = "2014-06-00"
     };
     var data = StatementService.Instance.DaySalesData(filter);
 }