Esempio n. 1
0
    public int PlaceOrder(string customerOpenId)
    {
        int productId = 147;
        int orderId = 0;
        double amount = double.Parse(_fields["guarantee_cash"].ToString().Trim());
        OnlineOrderDetail detail = new OnlineOrderDetail();
        Product p = new Product(productId);
        detail.productId = int.Parse(p._fields["id"].ToString());
        detail.productName = p._fields["name"].ToString();
        detail.price = double.Parse(p._fields["sale_price"].ToString());
        detail.count = (int)(amount / detail.price);

        OnlineOrder newOrder = new OnlineOrder();
        newOrder.Type = "押金";
        newOrder.shop = _fields["shop"].ToString().Trim();
        newOrder.AddADetail(detail);
        try
        {
            orderId = newOrder.Place(customerOpenId);
        }
        catch
        {

        }
        DBHelper.UpdateData("expierence_list", new string[,] { { "guarantee_order_id", "int", orderId.ToString() } },
            new string[,] { { "id", "int", _fields["id"].ToString() } }, Util.conStr);
        return orderId;
    }
Esempio n. 2
0
    public static int PlaceOrder(int id)
    {
        EquipMaintainRequestInshop request = new EquipMaintainRequestInshop(id);

        if (request.ProductId == 0 && request.AddtionalFee == 0)
        {
            return(0);
        }
        OnlineOrder newOrder = new OnlineOrder();


        if (request.ProductId != 0)
        {
            OnlineOrderDetail detail = new OnlineOrderDetail();
            Product           p      = new Product(request.ProductId);
            detail.productId   = int.Parse(p._fields["id"].ToString());
            detail.productName = p._fields["name"].ToString();
            detail.price       = double.Parse(p._fields["sale_price"].ToString());
            detail.count       = 1;
            newOrder.Type      = p.Type.Trim();
            newOrder.shop      = request._fields["shop"].ToString().Trim();
            newOrder.AddADetail(detail);
        }
        if (request.AddtionalFee != 0)
        {
            OnlineOrderDetail detail = new OnlineOrderDetail();
            Product           p      = new Product(request.AddtionalFeeProductId);
            detail.productId   = int.Parse(p._fields["id"].ToString());
            detail.productName = p._fields["name"].ToString();
            detail.price       = double.Parse(p._fields["sale_price"].ToString());
            detail.count       = (int)(request.AddtionalFee / p.SalePrice);
            newOrder.Type      = p.Type.Trim();
            newOrder.shop      = request._fields["shop"].ToString().Trim();
            newOrder.AddADetail(detail);
        }
        int orderId = newOrder.Place(request.OwnerOpenId.Trim());

        DBHelper.UpdateData("maintain_in_shop_request", new string[, ] {
            { "order_id", "int", orderId.ToString() }
        },
                            new string[, ] {
            { "id", "int", id.ToString() }
        }, Util.conStr);
        return(orderId);
    }