예제 #1
0
 public static DbQueryResult GetOrders(OrderQuery query)
 {
     return SalesProvider.Instance().GetOrders(query);
 }
예제 #2
0
 private OrderQuery GetOrderQuery()
 {
     OrderQuery query = new OrderQuery();
     if (!string.IsNullOrEmpty(Page.Request.QueryString["OrderId"]))
     {
         query.OrderId = Globals.UrlDecode(Page.Request.QueryString["OrderId"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ProductName"]))
     {
         query.ProductName = Globals.UrlDecode(Page.Request.QueryString["ProductName"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ShipTo"]))
     {
         query.ShipTo = Globals.UrlDecode(Page.Request.QueryString["ShipTo"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["UserName"]))
     {
         query.UserName = Globals.UrlDecode(Page.Request.QueryString["UserName"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["StartDate"]))
     {
         query.StartDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["StartDate"]));
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["EndDate"]))
     {
         query.EndDate = new DateTime?(DateTime.Parse(Page.Request.QueryString["EndDate"]));
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["OrderStatus"]))
     {
         int result = 0;
         if (int.TryParse(Page.Request.QueryString["OrderStatus"], out result))
         {
             query.Status = (OrderStatus)result;
         }
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["GroupBuyId"]))
     {
         query.GroupBuyId = new int?(int.Parse(Page.Request.QueryString["GroupBuyId"]));
     }
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     query.SortBy = "OrderDate";
     query.SortOrder = SortAction.Desc;
     return query;
 }
예제 #3
0
파일: SalesData.cs 프로젝트: davinx/himedi
 public override DbQueryResult GetOrders(OrderQuery query)
 {
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_Orders_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, BuildOrdersQuery(query));
     database.AddOutParameter(storedProcCommand, "TotalOrders", DbType.Int32, 4);
     DbQueryResult result = new DbQueryResult();
     using (IDataReader reader = database.ExecuteReader(storedProcCommand))
     {
         result.Data = DataHelper.ConverDataReaderToDataTable(reader);
     }
     result.TotalRecords = (int)database.GetParameterValue(storedProcCommand, "TotalOrders");
     return result;
 }
예제 #4
0
파일: SalesData.cs 프로젝트: davinx/himedi
 static string BuildOrdersQuery(OrderQuery query)
 {
     if (null == query)
     {
         throw new ArgumentNullException("query");
     }
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("SELECT OrderId FROM Hishop_Orders WHERE 1 = 1 ", new object[0]);
     if ((query.OrderId != string.Empty) && (query.OrderId != null))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", DataHelper.CleanSearchString(query.OrderId));
     }
     else
     {
         if (query.PaymentType.HasValue)
         {
             builder.AppendFormat(" AND PaymentTypeId = '{0}'", query.PaymentType.Value);
         }
         if (query.GroupBuyId.HasValue)
         {
             builder.AppendFormat(" AND GroupBuyId = {0}", query.GroupBuyId.Value);
         }
         if (!string.IsNullOrEmpty(query.ProductName))
         {
             builder.AppendFormat(" AND OrderId IN (SELECT OrderId FROM Hishop_OrderItems WHERE ItemDescription LIKE '%{0}%')", DataHelper.CleanSearchString(query.ProductName));
         }
         if (!string.IsNullOrEmpty(query.ShipTo))
         {
             builder.AppendFormat(" AND ShipTo LIKE '%{0}%'", DataHelper.CleanSearchString(query.ShipTo));
         }
         if (query.RegionId.HasValue)
         {
             builder.AppendFormat(" AND ShippingRegion like '%{0}%'", DataHelper.CleanSearchString(RegionHelper.GetFullRegion(query.RegionId.Value, ",")));
         }
         if (!string.IsNullOrEmpty(query.UserName))
         {
             builder.AppendFormat(" AND  UserName  = '******' ", DataHelper.CleanSearchString(query.UserName));
         }
         if (query.Status == OrderStatus.History)
         {
             builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderDate < '{2}'", 1, 4, DateTime.Now.AddMonths(-3));
         }
         else if (query.Status != OrderStatus.All)
         {
             builder.AppendFormat(" AND OrderStatus = {0}", (int)query.Status);
         }
         if (query.StartDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate >= '{0}'", DataHelper.GetSafeDateTimeFormat(query.StartDate.Value));
         }
         if (query.EndDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate <= '{0}'", DataHelper.GetSafeDateTimeFormat(query.EndDate.Value));
         }
         if (query.ShippingModeId.HasValue)
         {
             builder.AppendFormat(" AND ShippingModeId = {0}", query.ShippingModeId.Value);
         }
         if (query.IsPrinted.HasValue)
         {
             builder.AppendFormat(" AND ISNULL(IsPrinted, 0)={0}", query.IsPrinted.Value);
         }
     }
     if (!string.IsNullOrEmpty(query.SortBy))
     {
         builder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(query.SortBy), query.SortOrder.ToString());
     }
     return builder.ToString();
 }
예제 #5
0
파일: SalesData.cs 프로젝트: davinx/himedi
 static string BuildOrdersQuery(OrderQuery query)
 {
     if (null == query)
     {
         throw new ArgumentNullException("query");
     }
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("SELECT OrderId FROM distro_Orders WHERE DistributorUserId ='{0}' ", HiContext.Current.User.UserId);
     if ((query.OrderId != string.Empty) && (query.OrderId != null))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", DataHelper.CleanSearchString(query.OrderId));
     }
     else
     {
         if (query.PaymentType.HasValue)
         {
             builder.AppendFormat(" AND PaymentTypeId = '{0}'", query.PaymentType.Value);
         }
         if (query.GroupBuyId.HasValue)
         {
             builder.AppendFormat(" AND GroupBuyId = {0}", query.GroupBuyId.Value);
         }
         if (!string.IsNullOrEmpty(query.ProductName))
         {
             builder.AppendFormat(" AND OrderId IN (SELECT OrderId FROM distro_OrderItems WHERE DistributorUserId ={0} AND ItemDescription LIKE '%{1}%')", HiContext.Current.User.UserId, DataHelper.CleanSearchString(query.ProductName));
         }
         if (!string.IsNullOrEmpty(query.ShipTo))
         {
             builder.AppendFormat(" AND ShipTo LIKE '%{0}%'", DataHelper.CleanSearchString(query.ShipTo));
         }
         if (!string.IsNullOrEmpty(query.UserName))
         {
             builder.AppendFormat(" AND Username = '******' ", DataHelper.CleanSearchString(query.UserName));
         }
         if (query.Status == OrderStatus.History)
         {
             builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderDate < '{2}'", 1, 4, DateTime.Now.AddMonths(-3));
         }
         else if (query.Status != OrderStatus.All)
         {
             builder.AppendFormat(" AND OrderStatus = {0}", (int)query.Status);
         }
         if (query.StartDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate >= '{0}'", query.StartDate.Value);
         }
         if (query.EndDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate <= '{0}'", query.EndDate.Value);
         }
     }
     if (!string.IsNullOrEmpty(query.SortBy))
     {
         builder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(query.SortBy), query.SortOrder.ToString());
     }
     return builder.ToString();
 }
예제 #6
0
 public abstract DbQueryResult GetUserOrder(int userId, OrderQuery query);
예제 #7
0
파일: UserOrders.cs 프로젝트: davinx/himedi
 OrderQuery GetOrderQuery()
 {
     OrderQuery query = new OrderQuery();
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["orderId"]))
     {
         query.OrderId = this.Page.Request.QueryString["orderId"];
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"]))
     {
         query.StartDate = new DateTime?(Convert.ToDateTime(this.Page.Server.UrlDecode(this.Page.Request.QueryString["startDate"])));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["endDate"]))
     {
         query.EndDate = new DateTime?(Convert.ToDateTime(this.Page.Server.UrlDecode(this.Page.Request.QueryString["endDate"])));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["orderStatus"]))
     {
         int result = 0;
         if (int.TryParse(this.Page.Request.QueryString["orderStatus"], out result))
         {
             query.Status = (OrderStatus) result;
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortBy"]))
     {
         query.SortBy = this.Page.Request.QueryString["sortBy"];
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sortOrder"]))
     {
         int num2 = 0;
         if (int.TryParse(this.Page.Request.QueryString["sortOrder"], out num2))
         {
             query.SortOrder = (SortAction) num2;
         }
     }
     query.PageIndex = this.pager.PageIndex;
     query.PageSize = this.pager.PageSize;
     return query;
 }
예제 #8
0
파일: SalesData.cs 프로젝트: davinx/himedi
 public override DbQueryResult GetSendGoodsOrders(OrderQuery query)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("DistributorUserId ='{0}' AND OrderStatus = 2", HiContext.Current.User.UserId);
     if ((query.OrderId != string.Empty) && (query.OrderId != null))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", DataHelper.CleanSearchString(query.OrderId));
     }
     else
     {
         if (query.PaymentType.HasValue)
         {
             builder.AppendFormat(" AND PaymentTypeId = '{0}'", query.PaymentType.Value);
         }
         if (query.GroupBuyId.HasValue)
         {
             builder.AppendFormat(" AND GroupBuyId = {0}", query.GroupBuyId.Value);
         }
         if (!string.IsNullOrEmpty(query.ProductName))
         {
             builder.AppendFormat(" AND OrderId IN (SELECT OrderId FROM distro_OrderItems WHERE DistributorUserId ={0} AND ItemDescription LIKE '%{1}%')", HiContext.Current.User.UserId, DataHelper.CleanSearchString(query.ProductName));
         }
         if (!string.IsNullOrEmpty(query.ShipTo))
         {
             builder.AppendFormat(" AND ShipTo LIKE '%{0}%'", DataHelper.CleanSearchString(query.ShipTo));
         }
         if (!string.IsNullOrEmpty(query.UserName))
         {
             builder.AppendFormat(" AND Username = '******' ", DataHelper.CleanSearchString(query.UserName));
         }
         if (query.Status == OrderStatus.History)
         {
             builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderDate < '{2}'", 1, 4, DateTime.Now.AddMonths(-3));
         }
         else if (query.Status != OrderStatus.All)
         {
             builder.AppendFormat(" AND OrderStatus = {0}", (int)query.Status);
         }
         if (query.StartDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate >= '{0}'", query.StartDate.Value);
         }
         if (query.EndDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate <= '{0}'", query.EndDate.Value);
         }
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "distro_Orders do", "OrderId", builder.ToString(), "OrderId, OrderDate,RefundStatus, ShipTo, OrderTotal, OrderStatus,ShippingRegion,Address,ISNULL(RealShippingModeId,ShippingModeId) ShippingModeId,(SELECT ShipOrderNumber FROM Hishop_PurchaseOrders WHERE OrderId=do.OrderId) ShipOrderNumber");
 }
예제 #9
0
 public abstract DbQueryResult GetOrders(OrderQuery query);
예제 #10
0
 static string BuildMemberOrdersQuery(int userId, OrderQuery query)
 {
     if (null == query)
     {
         throw new ArgumentNullException("query");
     }
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat(" UserId = {0}", userId);
     if (!string.IsNullOrEmpty(query.OrderId))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", DataHelper.CleanSearchString(query.OrderId).ToLower());
     }
     else
     {
         if (query.Status == OrderStatus.History)
         {
             builder.AppendFormat(" AND OrderStatus = {0} AND OrderDate < '{1}'", 5, DateTime.Now.AddMonths(-3));
         }
         else if (query.Status != OrderStatus.All)
         {
             builder.AppendFormat(" AND OrderStatus = {0}", (int)query.Status);
         }
         if (query.StartDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate > '{0}'", query.StartDate);
         }
         if (query.EndDate.HasValue)
         {
             builder.AppendFormat(" AND OrderDate < '{0}'", query.EndDate);
         }
     }
     return builder.ToString();
 }
예제 #11
0
 public override DbQueryResult GetUserOrder(int userId, OrderQuery query)
 {
     if (string.IsNullOrEmpty(query.SortBy))
     {
         query.SortBy = "OrderDate";
     }
     return DataHelper.PagingByTopsort(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, true, "Hishop_Orders", null, BuildMemberOrdersQuery(userId, query), "*");
 }
예제 #12
0
 public static DbQueryResult GetSendGoodsOrders(OrderQuery query)
 {
     return SubsiteSalesProvider.Instance().GetSendGoodsOrders(query);
 }
예제 #13
0
 public static DbQueryResult GetUserOrder(int userId, OrderQuery query)
 {
     return TradeProvider.Instance().GetUserOrder(userId, query);
 }