Example #1
0
 public static DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query)
 {
     return SalesProvider.Instance().GetPurchaseOrders(query);
 }
Example #2
0
 public override DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query)
 {
     StringBuilder builder = new StringBuilder();
     bool flag = false;
     if (!string.IsNullOrEmpty(query.PurchaseOrderId))
     {
         builder.AppendFormat("PurchaseOrderId = '{0}'", query.PurchaseOrderId);
     }
     else
     {
         if (!string.IsNullOrEmpty(query.DistributorName))
         {
             builder.AppendFormat("DistributorName = '{0}'", query.DistributorName);
             flag = true;
         }
         if (!string.IsNullOrEmpty(query.ShipTo))
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" ShipTo LIKE '%{0}%'", query.ShipTo);
             flag = true;
         }
         if (!string.IsNullOrEmpty(query.OrderId))
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" OrderId = '{0}'", query.OrderId);
             flag = true;
         }
         if (!string.IsNullOrEmpty(query.ProductName))
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" PurchaseOrderId IN (SELECT PurchaseOrderId FROM Hishop_PurchaseOrderItems WHERE ItemDescription LIKE '%{0}%')", DataHelper.CleanSearchString(query.ProductName));
             flag = true;
         }
         if (query.StartDate.HasValue)
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" PurchaseDate >= '{0}'", query.StartDate.Value);
             flag = true;
         }
         if (query.EndDate.HasValue)
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" PurchaseDate <= '{0}'", query.EndDate.Value);
             flag = true;
         }
         if (query.PurchaseStatus != OrderStatus.All)
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" PurchaseStatus ={0}", Convert.ToInt32(query.PurchaseStatus));
         }
         if (query.ShippingModeId.HasValue)
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" ShippingModeId = {0}", query.ShippingModeId.Value);
         }
         if (query.IsPrinted.HasValue)
         {
             if (flag)
             {
                 builder.Append(" AND");
             }
             builder.AppendFormat(" ISNULL(IsPrinted, 0)={0}", query.IsPrinted.Value);
         }
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "Hishop_PurchaseOrders", "PurchaseOrderId", builder.ToString(), "OrderId, PurchaseOrderId, PurchaseDate,RefundStatus, ShipTo, OrderTotal, PurchaseTotal, PurchaseStatus,Distributorname,DistributorWangwang,ManagerMark,ManagerRemark,DistributorId,ISNULL(IsPrinted,0) IsPrinted");
 }
Example #3
0
 public override DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("DistributorId = {0}", HiContext.Current.User.UserId);
     if (query.IsManualPurchaseOrder)
     {
         builder.AppendFormat("AND OrderId IS NULL", new object[0]);
     }
     else
     {
         builder.AppendFormat("AND OrderId IS NOT NULL", new object[0]);
     }
     if (!string.IsNullOrEmpty(query.ShipTo))
     {
         builder.AppendFormat(" AND ShipTo LIKE '%{0}%'", DataHelper.CleanSearchString(query.ShipTo));
     }
     if (!string.IsNullOrEmpty(query.PurchaseOrderId))
     {
         builder.AppendFormat(" AND PurchaseOrderId = '{0}'", query.PurchaseOrderId);
     }
     if (!string.IsNullOrEmpty(query.OrderId))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", query.OrderId);
     }
     if (!string.IsNullOrEmpty(query.ProductName))
     {
         builder.AppendFormat(" AND PurchaseOrderId IN (SELECT PurchaseOrderId FROM Hishop_PurchaseOrderItems WHERE ItemDescription LIKE '%{0}%')", DataHelper.CleanSearchString(query.ProductName));
     }
     if (query.StartDate.HasValue)
     {
         builder.AppendFormat(" AND PurchaseDate >= '{0}'", query.StartDate.Value);
     }
     if (query.EndDate.HasValue)
     {
         builder.AppendFormat(" AND PurchaseDate <= '{0}'", query.EndDate.Value);
     }
     if (query.PurchaseStatus != OrderStatus.All)
     {
         builder.AppendFormat(" AND PurchaseStatus ={0}", Convert.ToInt32(query.PurchaseStatus));
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "Hishop_PurchaseOrders", "PurchaseOrderId", builder.ToString(), "OrderId,ShipTo,RefundStatus, PurchaseOrderId, TaobaoOrderId, PurchaseDate, OrderTotal, PurchaseTotal, PurchaseStatus");
 }
Example #4
0
 public abstract DbQueryResult GetPurchaseOrders(PurchaseOrderQuery query);
 private PurchaseOrderQuery GetPurchaseOrderQuery()
 {
     PurchaseOrderQuery query = new PurchaseOrderQuery();
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ShipTo"]))
     {
         query.ShipTo = Globals.UrlDecode(Page.Request.QueryString["ShipTo"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseOrderId"]))
     {
         query.PurchaseOrderId = Globals.UrlDecode(Page.Request.QueryString["PurchaseOrderId"]);
     }
     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["PurchaseStatus"]))
     {
         int result = 0;
         if (int.TryParse(Page.Request.QueryString["PurchaseStatus"], out result))
         {
             query.PurchaseStatus = (OrderStatus)result;
         }
     }
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     query.SortOrder = SortAction.Desc;
     query.SortBy = "PurchaseDate";
     return query;
 }
 private PurchaseOrderQuery GetPurchaseOrderQuery()
 {
     PurchaseOrderQuery query = new PurchaseOrderQuery();
     if (!string.IsNullOrEmpty(Page.Request.QueryString["OrderId"]))
     {
         query.OrderId = Globals.UrlDecode(Page.Request.QueryString["OrderId"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["PurchaseOrderId"]))
     {
         query.PurchaseOrderId = Globals.UrlDecode(Page.Request.QueryString["PurchaseOrderId"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ShopTo"]))
     {
         query.ShipTo = Globals.UrlDecode(Page.Request.QueryString["ShopTo"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ProductName"]))
     {
         query.ProductName = Globals.UrlDecode(Page.Request.QueryString["ProductName"]);
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["DistributorName"]))
     {
         query.DistributorName = Globals.UrlDecode(Page.Request.QueryString["DistributorName"]);
     }
     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["PurchaseStatus"]))
     {
         int result = 0;
         if (int.TryParse(Page.Request.QueryString["PurchaseStatus"], out result))
         {
             query.PurchaseStatus = (OrderStatus)result;
         }
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["IsPrinted"]))
     {
         int num2 = 0;
         if (int.TryParse(Page.Request.QueryString["IsPrinted"], out num2))
         {
             query.IsPrinted = new int?(num2);
         }
     }
     if (!string.IsNullOrEmpty(Page.Request.QueryString["ModeId"]))
     {
         int num3 = 0;
         if (int.TryParse(Page.Request.QueryString["ModeId"], out num3))
         {
             query.ShippingModeId = new int?(num3);
         }
     }
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     query.SortOrder = SortAction.Desc;
     query.SortBy = "PurchaseDate";
     return query;
 }