Exemplo n.º 1
0
        /// <summary>
        /// 月销售情况报表
        /// </summary>
        /// <param name="filter">条件</param>
        /// <returns></returns>
        public static StatementResult<ArrayList> MonthSalesData(MonthSalesFilter filter)
        {
            StatementResult<ArrayList> result = new StatementResult<ArrayList>();
            result.ServicePageIndex = filter.ServicePageIndex;
            result.PageSize = filter.PageSize;

            PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
            CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("MonthSalesData");
            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "LogDate DESC"))
            {
                DateTime beginDate = DateTime.Parse(string.Format("{0}-{1}-01", filter.Year, filter.Month));
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "LogDate", DbType.DateTime,
                    "@BeginLogDate", QueryConditionOperatorType.MoreThanOrEqual, beginDate);
                DateTime endDate = beginDate.AddMonths(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;
            }
        }
Exemplo n.º 2
0
 public void TestMethodMonthSalesData()
 {
     MonthSalesFilter filter = new MonthSalesFilter()
     {
         PageIndex = 1,
         PageSize = 10,
         Year = 2012,
         Month = 10
     };
     var data = StatementService.Instance.MonthSalesData(filter);
 }