public DataTable GetMemberStatisticsNoPage(SaleStatisticsQuery query) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand(SaleStatisticDao.BuildMemberStatisticsQuery(query)); DataTable result = null; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = DataHelper.ConverDataReaderToDataTable(dataReader); } return(result); }
public DataTable GetProductSaleAsImportSource(SaleStatisticsQuery productSale, out int totalProductSales) { DbCommand storedProcCommand = this.database.GetStoredProcCommand("cp_ProductSaleAsImportSource_Get"); this.database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, productSale.PageIndex); this.database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, productSale.PageSize); this.database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, productSale.IsCount); this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, SaleStatisticDao.BuildProductSaleAsImportSource(productSale)); this.database.AddOutParameter(storedProcCommand, "TotalProductSales", DbType.Int32, 4); DataTable result = null; using (IDataReader dataReader = this.database.ExecuteReader(storedProcCommand)) { result = DataHelper.ConverDataReaderToDataTable(dataReader); } totalProductSales = (int)this.database.GetParameterValue(storedProcCommand, "TotalProductSales"); return(result); }
public DataTable GetProductVisitAndBuyStatistics(SaleStatisticsQuery query, out int totalProductSales) { DbCommand storedProcCommand = this.database.GetStoredProcCommand("cp_ProductVisitAndBuyStatistics_Get"); this.database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, query.PageIndex); this.database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, query.PageSize); this.database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, SaleStatisticDao.BuildProductVisitAndBuyStatisticsQuery(query)); this.database.AddOutParameter(storedProcCommand, "TotalProductSales", DbType.Int32, 4); DataTable result = null; using (IDataReader dataReader = this.database.ExecuteReader(storedProcCommand)) { result = DataHelper.ConverDataReaderToDataTable(dataReader); } totalProductSales = (int)this.database.GetParameterValue(storedProcCommand, "TotalProductSales"); return(result); }
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); }
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); }