Пример #1
0
 public override OrderStatisticsInfo GetUserOrdersNoPage(UserOrderQuery userOrder)
 {
     OrderStatisticsInfo info = new OrderStatisticsInfo();
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_OrderStatisticsNoPage_Get");
     database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, BuildUserOrderQuery(userOrder));
     database.AddOutParameter(storedProcCommand, "TotalUserOrders", DbType.Int32, 4);
     using (IDataReader reader = database.ExecuteReader(storedProcCommand))
     {
         info.OrderTbl = DataHelper.ConverDataReaderToDataTable(reader);
         if (reader.NextResult())
         {
             reader.Read();
             if (reader["OrderTotal"] != DBNull.Value)
             {
                 info.TotalOfSearch += (decimal)reader["OrderTotal"];
             }
             if (reader["Profits"] != DBNull.Value)
             {
                 info.ProfitsOfSearch += (decimal)reader["Profits"];
             }
         }
     }
     info.TotalCount = (int)database.GetParameterValue(storedProcCommand, "TotaluserOrders");
     return info;
 }
Пример #2
0
 public override OrderStatisticsInfo GetDistributorStatisticsNoPage(SaleStatisticsQuery query)
 {
     OrderStatisticsInfo info = new OrderStatisticsInfo();
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_DistributorStatisticsNoPage_Get");
     database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, BuildDistributorStatisticsQuery(query));
     using (IDataReader reader = database.ExecuteReader(storedProcCommand))
     {
         info.OrderTbl = DataHelper.ConverDataReaderToDataTable(reader);
         if (!reader.NextResult())
         {
             return info;
         }
         reader.Read();
         if (reader["SaleTotals"] != DBNull.Value)
         {
             info.TotalOfSearch += (decimal)reader["SaleTotals"];
         }
         if (reader["Profits"] != DBNull.Value)
         {
             info.ProfitsOfSearch += (decimal)reader["Profits"];
         }
     }
     return info;
 }
Пример #3
0
 public override OrderStatisticsInfo GetUserOrders(UserOrderQuery userOrder)
 {
     OrderStatisticsInfo info = new OrderStatisticsInfo();
     DbCommand storedProcCommand = database.GetStoredProcCommand("sub_OrderStatistics_Get");
     database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, userOrder.PageIndex);
     database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, userOrder.PageSize);
     database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, userOrder.IsCount);
     database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, BuildUserOrderQuery(userOrder));
     database.AddOutParameter(storedProcCommand, "TotalUserOrders", DbType.Int32, 4);
     database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
     using (IDataReader reader = database.ExecuteReader(storedProcCommand))
     {
         info.OrderTbl = DataHelper.ConverDataReaderToDataTable(reader);
         if (reader.NextResult())
         {
             reader.Read();
             if (reader["OrderTotal"] != DBNull.Value)
             {
                 info.TotalOfPage += (decimal)reader["OrderTotal"];
             }
             if (reader["Profits"] != DBNull.Value)
             {
                 info.ProfitsOfPage += (decimal)reader["Profits"];
             }
         }
         if (reader.NextResult())
         {
             reader.Read();
             if (reader["OrderTotal"] != DBNull.Value)
             {
                 info.TotalOfSearch += (decimal)reader["OrderTotal"];
             }
             if (reader["Profits"] != DBNull.Value)
             {
                 info.ProfitsOfSearch += (decimal)reader["Profits"];
             }
         }
     }
     info.TotalCount = (int)database.GetParameterValue(storedProcCommand, "TotaluserOrders");
     return info;
 }
Пример #4
0
 public override OrderStatisticsInfo GetDistributorStatistics(SaleStatisticsQuery query, out int totalDistributors)
 {
     OrderStatisticsInfo info = new OrderStatisticsInfo();
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_DistributorStatistics_Get");
     database.AddInParameter(storedProcCommand, "PageIndex", DbType.Int32, query.PageIndex);
     database.AddInParameter(storedProcCommand, "PageSize", DbType.Int32, query.PageSize);
     database.AddInParameter(storedProcCommand, "IsCount", DbType.Boolean, query.IsCount);
     database.AddInParameter(storedProcCommand, "sqlPopulate", DbType.String, BuildDistributorStatisticsQuery(query));
     database.AddOutParameter(storedProcCommand, "TotalDistributors", DbType.Int32, 4);
     using (IDataReader reader = database.ExecuteReader(storedProcCommand))
     {
         info.OrderTbl = DataHelper.ConverDataReaderToDataTable(reader);
         if (reader.NextResult())
         {
             reader.Read();
             if (reader["SaleTotals"] != DBNull.Value)
             {
                 info.TotalOfSearch += (decimal)reader["SaleTotals"];
             }
             if (reader["Profits"] != DBNull.Value)
             {
                 info.ProfitsOfSearch += (decimal)reader["Profits"];
             }
         }
     }
     totalDistributors = (int)database.GetParameterValue(storedProcCommand, "TotalDistributors");
     return info;
 }