/// <summary>
 /// Initializes a new instance of the <see cref="SystemResourcesDA"/> class.
 /// </summary>
 public SystemResourcesDA()
 {
     this.SqlServer = new SqlServer();
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 public CpsLinkRecordDA()
 {
     this.sqlServer = new SqlServer();
 }
 public SystemRightsDA()
 {
     this.SqlServer = new SqlServer();
 }
 public OrderProductPromoteDA()
 {
     this.SqlServer = new SqlServer();
 }
 public OrderErpLogDA()
 {
     sqlServer=new SqlServer();
 }
        public JsonResult GetOrderData(int pageIndex, int pageSize, string search)
        {
            var userID = this.GetUserID();
            var condition = "[UserID] = " + userID + " and " +
                            (string.IsNullOrEmpty(search) ? "1=1" : "productName like '%" + search + "%'");
            var paging = new Paging("[view_Orders]", null, "ID", condition, pageIndex, pageSize, "CreateTime", 1);
            int pageCount, rowCount, totalCount;
            var Orders = new OrderService(userID, false).Query(paging, out pageCount, out rowCount);
            if (Orders == null || Orders.Count < 1)
            {
                return this.Json(new { data = Orders, rowsCount = rowCount });
            }

            // 查找订单商品信息
            string orderIDs = "";
            foreach (var order in Orders)
            {
                orderIDs += order.ID + ",";
            }

            orderIDs = orderIDs.Remove(orderIDs.Length - 1, 1);
            paging = new Paging("[view_Order_Products]", null, "ID", "[OrderID] in (" + orderIDs + ")", 1, 1000);
            var orderProducts = new SqlServer().Paging<Order_Product>(paging, out pageCount, out totalCount, null);

            for (var i = 0; i < Orders.Count; i++)
            {
                Orders[i].Products = new List<Order_Product>();
                foreach (var orderProduct in orderProducts)
                {
                    if (orderProduct.OrderID == Orders[i].ID)
                    {
                        orderProduct.Path = Utils.GetProductImage(orderProduct.Path, "1");
                        Orders[i].Products.Add(orderProduct);
                    }
                }
            }

            return this.Json(new { data = Orders, rowsCount = rowCount });
        }
        public ActionResult Evaluate(string condition, int pageIndex = 1, int pageSize = 5)
        {
            ViewBag.searchText = condition;
            if (string.IsNullOrWhiteSpace(condition))
            {
                condition = "UserID=" + this.UserSession.UserID;
            }
            else
            {
                condition = "UserID=" + this.UserSession.UserID + " And (ProductName like '%" + condition + "%' Or Content like '%" + condition + "%')";
            }

            int pageCount, totalCount;
            var paging = new Paging("view_UserProductComment", null, "CommentID", condition, pageIndex, pageSize);
            var list = new SqlServer().Paging<UserCommentProduct>(paging, out pageCount, out totalCount, null);
            ViewBag.pageCount = pageCount;
            ViewBag.pageIndex = pageIndex;
            return this.View(list);
        }