예제 #1
0
        public VM_OrderPro(M_UserInfo mu, HttpRequestBase Request)
        {
            this.SType   = DataConvert.CLng(Request.QueryString["SType"]);
            this.mu      = mu;
            this.OrderNo = Request.QueryString["OrderNo"];
            switch (SType)
            {
            case 0:    //订单
                orderMod = orderBll.SelModelByOrderNo(OrderNo);
                if (orderMod == null || orderMod.id == 0)
                {
                    function.WriteErrMsg("订单不存在");
                }
                if (orderMod.Userid != mu.UserID)
                {
                    function.WriteErrMsg("该订单不属于你,无法查看");
                }
                proDT = cartProBll.SelByOrderID(orderMod.id);
                break;

            case 1:    //购物车
                proDT = cartBll.GetCarProList(OrderNo, mu.UserID);
                break;
            }
            if (proDT.Rows.Count > 0 && !string.IsNullOrEmpty(proDT.Rows[0]["Additional"].ToString()))
            {
                M_Cart_Travel model = JsonConvert.DeserializeObject <M_Cart_Travel>(proDT.Rows[0]["Additional"].ToString());
                clientList = new List <M_Cart_Contract>();
                clientList.AddRange(model.Guest);
                clientList.AddRange(model.Contract);
            }
        }
예제 #2
0
    public void MyBind()
    {
        DataTable  dt = new DataTable();
        M_UserInfo mu = buser.GetLogin();

        switch (SType)
        {
        case 0:    //订单
            orderMod = orderBll.SelModelByOrderNo(OrderNo);

            //Total_L.Text = orderMod.Balance_price.ToString("f2") + "+" + orderMod.Freight.ToString("f2") + "=" + orderMod.Ordersamount.ToString("f2") + "元 (金额+运费)";

            labelmoney01.Text      = orderMod.Receivablesamount.ToString("f2");
            ExpressNum_T.Text      = orderMod.ExpressNum;
            ExpressDelivery_T.Text = orderMod.ExpressDelivery;
            if (orderMod == null || orderMod.id == 0)
            {
                function.WriteErrMsg("订单不存在");
            }
            if (orderMod.Userid != mu.UserID)
            {
                function.WriteErrMsg("该订单不属于你,无法查看");
            }
            dt        = SelByOrderID(orderMod.id);
            price     = orderMod.Balance_price;
            fare      = orderMod.Freight;
            allamount = orderMod.Ordersamount;
            DataTable dt1 = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC");
            if (dt1.Rows.Count > 0)
            {
                payMod    = payBll.SelModelByPayNo(dt1.Rows[0]["PayNo"].ToString());
                allamount = (double)payMod.MoneyPay;
                arrive    = payMod.ArriveMoney;
                point     = payMod.UsePoint;
            }
            Total_L.Text = price.ToString("f2") + " + " + fare.ToString("f2") + " - " + arrive.ToString("f2") + "-" + (point * 0.01).ToString("f2") + "(" + point + ")" + " = " + allamount.ToString("f2");
            Total_L.Text = Total_L.Text + " (商品总价+运费-优惠券-积分兑换=总额)";
            break;

        case 1:    //购物车
            dt = cartBll.GetCarProList(OrderNo);
            break;
        }
        if (orderMod.Paymentstatus != (int)M_OrderList.PayEnum.HasPayed)
        {
            PayUrl_A.Visible = true;
            DataTable dt1    = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC");
            string    payurl = "&OrderCode=" + orderMod.OrderNo;
            if (dt1.Rows.Count > 0)
            {
                payurl = "&PayNo=" + dt1.Rows[0]["PayNo"];
            }
            uappMod = uappBll.SelModelByUid(buser.GetLogin().UserID, "wechat");
            if (uappMod != null)
            {
                M_WX_User wxuserMod1 = wxuserBll.SelForOpenid(1, uappMod.OpenID);
                M_WX_User wxuserMod2 = wxuserBll.SelForOpenid(2, uappMod.OpenID);
                if (wxuserMod1 != null && wxuserMod2 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=1" + payurl;
                }
                else if (wxuserMod2 != null && wxuserMod1 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=2" + payurl;
                }
                else if (wxuserMod1 == null && wxuserMod2 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl;
                }
            }
            else
            {
                PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl;
            }
        }
        if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["Additional"].ToString()))
        {
            User_Div.Visible = true;
            M_Cart_Travel          model     = JsonConvert.DeserializeObject <M_Cart_Travel>(dt.Rows[0]["Additional"].ToString());
            List <M_Cart_Contract> modelList = new List <M_Cart_Contract>();
            modelList.AddRange(model.Guest);
            modelList.AddRange(model.Contract);
            UserRPT.DataSource = modelList;
            UserRPT.DataBind();
        }
        pronum         = dt.Rows.Count;
        RPT.DataSource = dt;
        RPT.DataBind();
    }