public string AddOrder(int userid, int productid, int pronum)
        {
            string result = "1";
            Order order = new Order();
            OrderBll orderbll = new OrderBll();
            OrderList orderlist = new OrderList();
            OrderListBll orderlistbll = new OrderListBll();

            ProductBll pbll = new ProductBll();
            UsersBll ubll = new UsersBll();
            try
            {
                //检查 当前用户是否有末完成的订单  有不能
                //if (orderbll.GetAll("*", " [status]=1 and userid=" + userid, null, "id").Entity.Count <= 0)
                //{

                var p = pbll.GetByPrimaryKey(productid).Entity;
                var u = ubll.GetByPrimaryKey(userid).Entity;
                order.UserId = userid;
                order.ReciverName = u.UserName;
                order.PayMentTypeId = 1;//货到付款
                order.RevicerAddress = u.Address;
                order.RevicerTel = u.Mobile;
                order.Status = 1;//
                order.RealPrice = pronum * p.OemPrice;
                order.TotalPrice = pronum * p.OemPrice;
                order.Count = 1;
                order.OrderTime = DateTime.Now;
                order.OrderNo = OrderHelper.GetProNo();
                //添加订单
                int orderaddid = orderbll.AddAndReturn(order);

                //添加订单详情
                orderlist.Count = order.Count;
                orderlist.Productid = productid;
                orderlist.Orderid = orderaddid;
                orderlist.OemPrice = p.OemPrice;
                orderlist.MarketPrice = p.MarketPrice;
                orderlistbll.Add(orderlist);
                //}
                //else
                //{
                //    result = "-2";
                //}

            }
            catch
            {

                result = "-1";
            }

            return result;
        }
        public void AddOrderList(Users u, int productid, int num, int orderid)
        {
            OrderList orderlist = new OrderList();
            OrderListBll orderlistbll = new OrderListBll();

            ProductBll pbll = new ProductBll();
            var p = pbll.GetByPrimaryKey(productid).Entity;

            //添加订单详情
            orderlist.Count = num;
            orderlist.Productid = productid;
            orderlist.Orderid = orderid;
            orderlist.OemPrice = p.OemPrice;
            orderlist.MarketPrice = p.MarketPrice;
            orderlistbll.Add(orderlist);
        }