Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Log.Info(this.GetType().ToString(), "page load");
        if (!IsPostBack)
        {
            Cms.Model.C_user userModel    = adminUser.GetuserLoginState();
            int               otid        = Convert.ToInt32(Request["orderid"].ToString());
            Cms.BLL.C_order   otBll       = new Cms.BLL.C_order();
            Cms.Model.C_order orderEntity = otBll.GetModel(otid);
            order_num.Text = orderEntity.order_num;
            litMoney.Text  = Convert.ToDecimal(orderEntity.price_sum).ToString("0.00");
            litDate.Text   = orderEntity.updateTime.ToString();
            string openid    = userModel.openid.ToString();
            string total_fee = ((int)(Convert.ToDecimal(orderEntity.price_sum) * 100)).ToString();
            //检测是否给当前页面传递了相关参数
            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(total_fee))
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面传参出错,请返回重试" + "</span>");
                Log.Error(this.GetType().ToString(), "This page have not get params, cannot be inited, exit...");
                submit.Visible = false;
                return;
            }

            //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数
            JsApiPay jsApiPay = new JsApiPay(this);
            jsApiPay.openid  = openid;
            jsApiPay.orderid = orderEntity.order_num;
            DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + orderEntity.id).Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                jsApiPay.productName = dt.Rows[0]["title"].ToString();
            }
            else
            {
                jsApiPay.productName = "泓源鼎盛酒业商品";
            }
            try
            {
                jsApiPay.total_fee = int.Parse(total_fee);


                //JSAPI支付预处理

                WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult();

                wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数
                orderNum     = Request["orderid"].ToString();
                Log.Debug(this.GetType().ToString(), "wxJsApiParam : " + wxJsApiParam);
                //在页面上显示订单信息
                //Response.Write("<span style='color:#00CD00;font-size:20px'>订单详情:</span><br/>");
                //Response.Write("<span style='color:#00CD00;font-size:20px'>" + unifiedOrderResult.ToPrintStr() + "</span>");
            }
            catch (Exception ex)
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + "下单失败,请返回重试" + "</span>" + ex.Message.ToString() + Convert.ToDecimal(orderEntity.price_sum).ToString());
                submit.Visible = false;
            }
        }
    }
Example #2
0
    /// <summary>
    /// 判断登录状态
    /// </summary>
    /// <param name="ip"></param>
    /// <returns></returns>
    public static Cms.Model.C_user GetuserLoginState()
    {
        HttpCookie cookie  = (HttpCookie)HttpContext.Current.Request.Cookies["user"];
        string     user_id = "";

        if (cookie != null)
        {
            user_id = Convert.ToString(cookie.Values["user_id"]);
        }
        Cms.Model.C_user model = adminUser.GetuserLoginState(user_id);
        return(model);
    }
Example #3
0
    /// <summary>
    /// 写入管理日志
    /// </summary>
    public static bool AddUserLog(string action_type, string remark)
    {
        Cms.Model.C_user user = adminUser.GetuserLoginState();
        int newId             = new Cms.BLL.C_admin_log().Add(user.id, user.username, action_type, remark);

        if (newId > 0)
        {
            return(true);
        }

        return(false);
    }
Example #4
0
 public static Cms.Model.C_user GetuserLoginState(string user_id)
 {
     Cms.Model.C_user model = null;
     if (user_id == null || user_id.Length <= 0)
     {
         WebHint.ShowError("登录超时,请重新登录", "/m/mine.aspx", true, "Error");
     }
     else
     {
         if (new Cms.BLL.C_user().Exists(Convert.ToInt32(user_id)))
         {
             model = new Cms.BLL.C_user().GetModel(Convert.ToInt32(user_id));
         }
         else
         {
             WebHint.ShowError("登录超时,请重新登录", "/m/mine.aspx", true, "Error");
         }
     }
     return(model);
 }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.C_user model)
 {
     return(dal.Update(model));
 }
Example #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Cms.Model.C_user model)
 {
     return(dal.Add(model));
 }