Example #1
0
        public OrderStatisticsInfo GetUserOrdersNoPage(OrderQuery userOrder)
        {
            OrderStatisticsInfo orderStatisticsInfo = new OrderStatisticsInfo();
            DbCommand           storedProcCommand   = this.database.GetStoredProcCommand("cp_OrderStatisticsNoPage_Get");

            this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, SaleStatisticDao.BuildUserOrderQuery(userOrder));
            this.database.AddOutParameter(storedProcCommand, "TotalUserOrders", DbType.Int32, 4);
            using (IDataReader dataReader = this.database.ExecuteReader(storedProcCommand))
            {
                orderStatisticsInfo.OrderTbl = DataHelper.ConverDataReaderToDataTable(dataReader);
                if (dataReader.NextResult())
                {
                    dataReader.Read();
                    if (dataReader["OrderTotal"] != DBNull.Value)
                    {
                        orderStatisticsInfo.TotalOfSearch += (decimal)dataReader["OrderTotal"];
                    }
                    if (dataReader["Profits"] != DBNull.Value)
                    {
                        orderStatisticsInfo.ProfitsOfSearch += (decimal)dataReader["Profits"];
                    }
                }
            }
            orderStatisticsInfo.TotalCount = (int)this.database.GetParameterValue(storedProcCommand, "TotaluserOrders");
            return(orderStatisticsInfo);
        }
Example #2
0
        public OrderStatisticsInfo GetUserOrders(OrderQuery userOrder)
        {
            OrderStatisticsInfo orderStatisticsInfo = new OrderStatisticsInfo();
            DbCommand           storedProcCommand   = this.database.GetStoredProcCommand("cp_OrderStatistics_Get");

            this.database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, userOrder.PageIndex);
            this.database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, userOrder.PageSize);
            this.database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, userOrder.IsCount);
            this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, SaleStatisticDao.BuildUserOrderQuery(userOrder));
            this.database.AddOutParameter(storedProcCommand, "TotalUserOrders", DbType.Int32, 4);
            DataTable dataTable = new DataTable();

            dataTable.TableName = "orderxml";
            dataTable.Columns.Add(new DataColumn("search"));
            DataRow dataRow = dataTable.NewRow();

            dataRow["search"] = string.Concat(new object[]
            {
                SaleStatisticDao.BuildOrdersQuery(userOrder),
                "---",
                userOrder.OrderId,
                "---",
                userOrder.EndDate,
                "---",
                userOrder.StartDate,
                "---",
                userOrder.ShipTo
            });
            dataTable.Rows.Add(dataRow);
            dataTable.WriteXml(HttpContext.Current.Request.MapPath("/searchlog.xml"));
            using (IDataReader dataReader = this.database.ExecuteReader(storedProcCommand))
            {
                orderStatisticsInfo.OrderTbl = DataHelper.ConverDataReaderToDataTable(dataReader);
                if (dataReader.NextResult())
                {
                    dataReader.Read();
                    if (dataReader["OrderTotal"] != DBNull.Value)
                    {
                        orderStatisticsInfo.TotalOfPage += (decimal)dataReader["OrderTotal"];
                    }
                    if (dataReader["Profits"] != DBNull.Value)
                    {
                        orderStatisticsInfo.ProfitsOfPage += (decimal)dataReader["Profits"];
                    }
                }
                if (dataReader.NextResult())
                {
                    dataReader.Read();
                    if (dataReader["OrderTotal"] != DBNull.Value)
                    {
                        orderStatisticsInfo.TotalOfSearch += (decimal)dataReader["OrderTotal"];
                    }
                    if (dataReader["Profits"] != DBNull.Value)
                    {
                        orderStatisticsInfo.ProfitsOfSearch += (decimal)dataReader["Profits"];
                    }
                }
            }
            orderStatisticsInfo.TotalCount = (int)this.database.GetParameterValue(storedProcCommand, "TotaluserOrders");
            return(orderStatisticsInfo);
        }