Esempio n. 1
0
    protected void UserRegisterSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale  wu    = new wxuser.UserSale();
        wxuser.userinfo  xw    = new wxuser.userinfo();
        wu = wxuser.getUserRegister(model.openid, model.username, model.sex, model.useraddress, string.Format("{0:yyyy-MM-dd}", model.birthday), string.Format("{0:yyyy-MM-dd}", model.marryday), model.telphone, "");
        if (wu.result == "更新成功")
        {
            xw = wxuser.getuserinfo(model.openid);
            if (xw.result == "获取成功")
            {
                model              = bll.GetModel(model.id);
                model.usercard     = xw.usercard;
                model.userallscore = Convert.ToInt32(Math.Round(Convert.ToDecimal(xw.userallscore)).ToString());
                model.userscore    = Convert.ToInt32(Math.Round(Convert.ToDecimal(xw.userscore)).ToString());
                model.userYesScore = Convert.ToInt32(Math.Round(Convert.ToDecimal(xw.userallscore)).ToString()) - Convert.ToInt32(Math.Round(Convert.ToDecimal(xw.userscore)).ToString());
                model.userlevel    = xw.userlevel;
                model.shopname     = xw.shopname;
                bll.Update(model);
                Literal1.Text = wu.content + "-" + wu.result;
                ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"注册会员\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"注册失败\", \"" + Literal1.Text + "\", \"back\",\"Error\",\"\")", true);
            }
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"注册失败\", \"" + Literal1.Text + "\", \"back\",\"Error\",\"\")", true);
        }
    }
Esempio n. 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);

        string action = this.Request.QueryString["action"] ?? "";//编辑:edit 添加:add

        model.sex = this.sex.SelectedValue;
        //model.userMoney = Convert.ToDecimal(this.userMoney.Text);
        model.telphone = telphone.Text;
        model.usercard = usercard.Text;
        DataSet ds = new Cms.BLL.C_user().GetList("usercard='" + model.usercard + "' and id<>" + userId);

        if (ds != null && ds.Tables[0].Rows.Count > 0 && usercard.Text.ToString() != "")
        {
            JscriptMsg("会员编号已存在!", "useredit.aspx?action=edit&id=" + userId, "Error");
        }
        else
        {
            if (bll.Update(model))
            {
                adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.username); //记录日志
                JscriptMsg("提交信息成功!", "userlist.aspx", "Success");
            }
            else
            {
                JscriptMsg("提交信息失败!", "useredit.aspx?action=edit&id=" + userId, "Error");
            }
        }
    }
Esempio n. 3
0
    public void bind_date(int _id)
    {
        Cms.BLL.C_order   bll   = new Cms.BLL.C_order();
        Cms.Model.C_order model = bll.GetModel(_id);
        ordernum.InnerHtml         = model.order_num;
        updateTime.InnerHtml       = model.updateTime.ToString();
        OrderStatus.InnerHtml      = model.order_status.ToString() == "0" ? "未完单" : "已完单";
        isPayment.InnerHtml        = model.is_payment.ToString() == "0" ? "未支付" : "已支付";
        countprice.InnerHtml       = Convert.ToDecimal(model.price_sum).ToString("0.00");
        Quantity.InnerHtml         = model.quantity_sum.ToString();
        isDelivery.InnerHtml       = model.is_delivery.ToString() == "0" ? "未发货" : "已发货";
        is_receiving.InnerHtml     = model.is_receiving.ToString() == "0" ? "未收货" : "已收货";
        integral_sum.InnerHtml     = model.integral_sum.ToString();
        pay_method.InnerHtml       = model.pay_method.ToString() == "" ? "微信支付" : model.pay_method.ToString();
        shipping_method.InnerHtml  = model.shipping_method.ToString();
        note.InnerHtml             = model.note.ToString();
        recommended_code.InnerHtml = model.recommended_code.ToString();
        courierNumber.Text         = model.courier_number.ToString();
        fahuoCode.Text             = model.fahuoCode.ToString();
        fahuoMsg.Text = model.fahuoMsg.ToString();
        if (model.is_delivery == 1)
        {
            btnSubmit.Visible = false;
        }
        #region 会员信息=====================
        int            struserid = Convert.ToInt32(model.user_id);
        Cms.BLL.C_user blluser   = new Cms.BLL.C_user();
        DataSet        ds2       = blluser.GetList("id=" + struserid);
        if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
        {
            UserName.InnerHtml = ds2.Tables[0].Rows[0]["username"].ToString();
            //userMoney.InnerHtml =Convert.ToDecimal(ds2.Tables[0].Rows[0]["userMoney"]).ToString("0.00");
            //userJifen.InnerHtml = ds2.Tables[0].Rows[0]["userscore"].ToString();
        }
        else
        {
            userinfo.InnerHtml = "匿名用户";
        }
        #endregion

        #region 产品信息===========================
        Cms.BLL.C_ordersub bllordersub = new Cms.BLL.C_ordersub();
        DataSet            ds1         = bllordersub.GetList("order_id=" + _id);
        if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
        {
            Repeaterordersub.DataSource = ds1.Tables[0].DefaultView;
            Repeaterordersub.DataBind();
        }
        #endregion

        #region 收货信息===========================

        DataSet ds3 = new Cms.BLL.c_user_address().GetList("id=" + model.adress_id);
        if (ds3 != null && ds3.Tables[0].Rows.Count > 0)
        {
            RepAddress.DataSource = ds3.Tables[0].DefaultView;
            RepAddress.DataBind();
        }
        #endregion
    }
Esempio n. 4
0
    protected void UserScoreSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale  wu    = new wxuser.UserSale();
        wxuser.userinfo  xw    = new wxuser.userinfo();
        // wu = wxuser.getUserScore(model.usercard, model.openid, "1", "产品购买", "100");
        // Literal1.Text = wu.content + "-" + wu.result;
    }
Esempio n. 5
0
    public string getUserName(int user_id)
    {
        string result = "匿名预定人";

        if (new Cms.BLL.C_user().Exists(user_id))
        {
            result = new Cms.BLL.C_user().GetModel(Convert.ToInt32(user_id)).username.ToString();
        }

        return(result);
    }
Esempio n. 6
0
    protected void UserBindSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale  wu    = new wxuser.UserSale();
        wxuser.userinfo  xw    = new wxuser.userinfo();
        xw            = wxuser.getUserBind(model.openid, model.telphone, model.usercard);
        Literal1.Text = xw.content + "-" + xw.result;
        ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"会员绑定验证\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
    }
Esempio n. 7
0
    public void DataAdd()
    {
        Cms.BLL.sc_Coupon   bll = new Cms.BLL.sc_Coupon();
        Cms.Model.sc_Coupon bml = new Cms.Model.sc_Coupon();
        string urlhot           = Request.Url.Host.ToString();

        bml.type_id    = int.Parse(ddpid.SelectedValue.ToString());
        bml.cname      = tbtilte.Text.Trim();
        bml.cmoney     = Convert.ToInt32(tbPrice.Text.Trim());
        bml.number     = Convert.ToInt32(tbnumber.Text.Trim());
        bml.stime      = DateTime.Parse(tbstime.Text);
        bml.etime      = DateTime.Parse(tbetime.Text);
        bml.picurl     = photoUrl.Text.Trim();
        bml.updatetime = DateTime.Now;
        bml.peson      = Convert.ToInt32(cbluserDegree.SelectedValue);
        bml.content    = txtusedContent.InnerText;
        int result = bll.Add(bml);

        if (result > 0)
        {
            if (bml.peson == 0)
            {
                DataTable               dt           = new Cms.BLL.C_user().GetList("").Tables[0];
                Cms.BLL.C_user_coupon   bll_coupon   = new Cms.BLL.C_user_coupon();
                Cms.Model.C_user_coupon model_coupon = new Cms.Model.C_user_coupon();
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        for (int j = 0; j < bml.number; j++)
                        {
                            model_coupon.user_id    = Convert.ToInt32(dt.Rows[i]["id"]);
                            model_coupon.article_id = bml.article_id;
                            model_coupon.coupon_id  = Convert.ToInt32(result);
                            model_coupon.title      = bml.cname;
                            model_coupon.picUrl     = bml.picurl;
                            model_coupon.price      = Convert.ToDecimal(bml.cmoney);
                            model_coupon.stime      = bml.stime;
                            model_coupon.etime      = bml.etime;
                            model_coupon.number     = 1;
                            model_coupon.content    = bml.content;
                            model_coupon.status     = 0;
                            model_coupon.type_id    = bml.type_id;
                            model_coupon.updatetime = DateTime.Now;
                            bll_coupon.Add(model_coupon);
                        }
                    }
                }
            }
            adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加优惠卷" + tbtilte.Text); //记录日志
            ShowConfirm("是否继续添加?", "couponedit.aspx?action=add", "couponlist.aspx");
        }
    }
Esempio n. 8
0
    public void bind_date(int _id)
    {
        Cms.BLL.C_order_integral   bll   = new Cms.BLL.C_order_integral();
        Cms.Model.C_order_integral model = bll.GetModel(_id);
        ordernum.InnerHtml    = model.order_num;
        updateTime.InnerHtml  = model.updateTime.ToString();
        OrderStatus.InnerHtml = getState(Convert.ToInt32(model.order_status));

        countprice.InnerHtml = model.price_sum.ToString();
        Quantity.InnerHtml   = model.quantity_sum.ToString();


        integral_sum.InnerHtml = model.integral_sum.ToString();

        note.InnerHtml             = model.note.ToString();
        recommended_code.InnerHtml = model.recommended_code.ToString();
        #region 会员信息=====================
        int            struserid = Convert.ToInt32(model.user_id);
        Cms.BLL.C_user blluser   = new Cms.BLL.C_user();
        DataSet        ds2       = blluser.GetList("id=" + struserid);
        if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
        {
            UserName.InnerHtml  = ds2.Tables[0].Rows[0]["username"].ToString();
            userMoney.InnerHtml = Convert.ToDecimal(ds2.Tables[0].Rows[0]["userMoney"]).ToString("0.00");
            userJifen.InnerHtml = ds2.Tables[0].Rows[0]["userscore"].ToString();
        }
        else
        {
            userinfo.InnerHtml = "匿名用户";
        }
        #endregion

        #region 产品信息===========================
        Cms.BLL.C_order_integralsub bllordersub = new Cms.BLL.C_order_integralsub();
        DataSet ds1 = bllordersub.GetList("order_id=" + _id);
        if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
        {
            Repeaterordersub.DataSource = ds1.Tables[0].DefaultView;
            Repeaterordersub.DataBind();
        }
        #endregion

        #region 收货信息===========================

        DataSet ds3 = new Cms.BLL.sc_stores().GetList("id=" + model.storesId);
        if (ds3 != null && ds3.Tables[0].Rows.Count > 0)
        {
            RepAddress.DataSource = ds3.Tables[0].DefaultView;
            RepAddress.DataBind();
        }
        #endregion
    }
Esempio n. 9
0
    /// <summary>
    /// 会员卡是否已存在
    /// </summary>
    /// <param name="usercard"></param>
    /// <returns></returns>
    public static bool isExistsUsercard(string usercard)
    {
        bool bl = false;

        Cms.BLL.C_user cuser = new Cms.BLL.C_user();
        DataTable      dt    = cuser.GetList("usercard='" + usercard + "'").Tables[0];

        if (dt.Rows.Count > 0)
        {
            bl = true;
        }
        return(bl);
    }
Esempio n. 10
0
 public void DataUpdate(int id)
 {
     Cms.BLL.sc_Coupon   bll = new Cms.BLL.sc_Coupon();
     Cms.Model.sc_Coupon bml = bll.GetModel(id);
     bml.type_id = int.Parse(ddpid.SelectedValue.ToString());
     bml.cname   = tbtilte.Text.Trim();
     bml.cmoney  = Convert.ToInt32(tbPrice.Text.Trim());
     bml.number  = Convert.ToInt32(tbnumber.Text.Trim());
     bml.stime   = DateTime.Parse(tbstime.Text);
     bml.etime   = DateTime.Parse(tbetime.Text);
     bml.picurl  = photoUrl.Text.Trim();
     bml.peson   = Convert.ToInt32(cbluserDegree.SelectedValue);
     bml.content = txtusedContent.InnerText;
     //bml.updatetime = DateTime.Now;
     if (bll.Update(bml))
     {
         adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改优惠卷" + tbtilte.Text); //记录日志
         if (bml.peson == 0)
         {
             DataTable               dt           = new Cms.BLL.C_user().GetList("").Tables[0];
             Cms.BLL.C_user_coupon   bll_coupon   = new Cms.BLL.C_user_coupon();
             Cms.Model.C_user_coupon model_coupon = new Cms.Model.C_user_coupon();
             if (dt != null && dt.Rows.Count > 0)
             {
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     for (int j = 0; j < bml.number; j++)
                     {
                         model_coupon.user_id    = Convert.ToInt32(dt.Rows[i]["id"]);
                         model_coupon.article_id = bml.article_id;
                         model_coupon.coupon_id  = id;
                         model_coupon.title      = bml.cname;
                         model_coupon.picUrl     = bml.picurl;
                         model_coupon.price      = Convert.ToDecimal(bml.cmoney);
                         model_coupon.stime      = bml.stime;
                         model_coupon.etime      = bml.etime;
                         model_coupon.number     = 1;
                         model_coupon.content    = bml.content;
                         model_coupon.status     = 0;
                         model_coupon.updatetime = DateTime.Now;
                         bll_coupon.Add(model_coupon);
                     }
                 }
             }
         }
         JscriptMsg("提交成功!", "couponlist.aspx", "Success");
     }
 }
Esempio n. 11
0
    protected void UserInfoSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale  wu    = new wxuser.UserSale();
        wxuser.userinfo  xw    = new wxuser.userinfo();
        xw                 = wxuser.getuserinfo(model.openid);
        Literal1.Text      = "内容:" + xw.content + ";结果:" + xw.result + ";微信openid:" + xw.openid + ";性别:" + xw.sex + ";门店:" + xw.shopname + ";手机:" + xw.telephone + ";地址:" + xw.useraddress + ";所有积分:" + xw.userallscore + ";<br>会员卡:" + xw.usercard + ";会员等级:" + xw.userlevel + ";姓名:" + xw.username + ";未使用积分:" + xw.userscore + ";消费金额:" + xw.allbuy + ";生日:" + xw.birthday + ";结婚日期" + xw.marryday + ";消费次数:" + xw.buytimes;
        model.userallscore = Convert.ToInt32(xw.userallscore);
        model.userscore    = Convert.ToInt32(xw.userscore);
        model.userYesScore = Convert.ToInt32(xw.userallscore) - Convert.ToInt32(xw.userscore);
        model.userlevel    = xw.userlevel;
        // bll.Update(model);

        ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"获取会员信息\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
    }
Esempio n. 12
0
    protected void UserSignSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll           = new Cms.BLL.C_user();
        Cms.Model.C_user model         = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale  wu            = new wxuser.UserSale();
        wxuser.userinfo  xw            = new wxuser.userinfo();
        DateTime         todaybegin    = DateTime.Parse(DateTime.Now.ToShortDateString());
        DateTime         mingtianBegin = todaybegin.AddDays(1);

        if (!Cms.DBUtility.DbHelperSQL.Exists("select count(1) from C_integral_rec where scorename='签到领取积分' and user_id=" + model.id + "and updateTime>='" + todaybegin + "' and updateTime<'" + mingtianBegin + "'"))
        {
            wxuser.userinfo userinfo = new wxuser.userinfo();
            xw                 = wxuser.getUserSign(model.openid, model.usercard);
            Literal1.Text      = xw.content + "-" + xw.result;
            xw                 = wxuser.getuserinfo(model.openid);
            model.userallscore = Convert.ToInt32(xw.userallscore);
            model.userscore    = Convert.ToInt32(xw.userscore);
            model.userYesScore = Convert.ToInt32(xw.userallscore) - Convert.ToInt32(xw.userscore);
            bll.Update(model);

            Cms.BLL.C_integral_rec   integral_BLL   = new Cms.BLL.C_integral_rec();
            Cms.Model.C_integral_rec integral_model = new Cms.Model.C_integral_rec();
            integral_model.article_id = 1;
            integral_model.user_id    = model.id;
            integral_model.usercard   = model.usercard;
            integral_model.openid     = model.openid;
            integral_model.numberid   = "2";
            integral_model.scorename  = "签到领取积分";
            integral_model.title      = "签到领取积分";
            integral_model.wescore    = 2000;
            integral_model.quantity   = 1;
            integral_model.type       = 0;
            integral_model.updateTime = DateTime.Now;
            integral_BLL.Add(integral_model);
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"会员签到\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"您今日已经签到过了\", \"您今日已经签到过了\", \"back\",\"Error\",\"\")", true);
        }
    }
Esempio n. 13
0
    protected void UserUpdateSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user   bll   = new Cms.BLL.C_user();
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.userinfo  xw    = new wxuser.userinfo();
        xw = wxuser.getUserUpdate(model.openid, model.usercard, model.username, model.sex, model.useraddress, string.Format("{0:yyyy-MM-dd}", model.birthday), string.Format("{0:yyyy-MM-dd}", model.marryday), model.telphone, model.shopcode);
        if (xw.result == "更新成功")
        {
            Literal1.Text = xw.content + "-" + xw.result;
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"更新会员信息\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
        }
        else
        {
            Literal1.Text = xw.content + "-" + xw.result;
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"更新会员信息\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
        }
    }
Esempio n. 14
0
    protected void UserSaleSubmit_Click(object sender, EventArgs e)
    {
        int userId = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//ID

        Cms.BLL.C_user         bll   = new Cms.BLL.C_user();
        Cms.Model.C_user       model = new Cms.BLL.C_user().GetModel(userId);
        wxuser.UserSale        wu    = new wxuser.UserSale();
        wxuser.userinfo        xw    = new wxuser.userinfo();
        List <wxuser.UserSale> list  = new List <wxuser.UserSale>();

        list = wxuser.getUserSale(model.openid, model.usercard);
        for (int i = 0; i < list.Count; i++)
        {
            wxuser.UserSale ux = new wxuser.UserSale();
            ux            = list[i];
            Literal1.Text = ux.content + "-" + ux.result + "||";
        }
        ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", "parent.jsdialog(\"消费列表\", \"" + Literal1.Text + "\", \"back\",\"Success\",\"\")", true);
    }
Esempio n. 15
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);
 }
Esempio n. 16
0
 public void UpdateUser(int user_id)
 {
     Cms.Model.C_user muser = new Cms.BLL.C_user().GetModel(user_id);
     //设置更新会员
     wxuser.UserSale wu = new wxuser.UserSale();
     wxuser.userinfo xw = new wxuser.userinfo();
     xw = wxuser.getuserinfo(muser.openid);
     if (xw.result == "获取失败")
     {
         wu = wxuser.getUserRegister(muser.openid, muser.username, muser.sex, muser.useraddress, string.Format("{0:yyyy-MM-dd}", muser.birthday), string.Format("{0:yyyy-MM-dd}", muser.marryday), muser.telphone, muser.shopcode);
         //Literal1.Text = wu.content + "-" + wu.result + "-" + wu.usercard;
         xw = wxuser.getuserinfo(muser.openid);
         string UpdateSql = "update C_user set usercard='" + xw.usercard + "' where id=" + user_id;
         int    counts    = Cms.DBUtility.DbHelperSQL.ExecuteSql(UpdateSql);//修改
         if (counts > 0)
         {
             adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), muser.username); //记录日志
             JscriptMsg("绑定成功!", "userlist.aspx", "Success");
         }
         else
         {
             JscriptMsg("绑定失败!", "userlist.aspx", "Success");
         }
     }
     else
     {
         string UpdateSql = "update C_user set usercard='" + xw.usercard + "' where id=" + user_id;
         int    counts    = Cms.DBUtility.DbHelperSQL.ExecuteSql(UpdateSql);//修改
         if (counts > 0)
         {
             adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), muser.username); //记录日志
             JscriptMsg("绑定成功!", "userlist.aspx", "Success");
         }
         else
         {
             JscriptMsg("绑定失败!", "userlist.aspx", "Success");
         }
     }
 }
Esempio n. 17
0
    public override void ProcessNotify()
    {
        WxPayData notifyData = GetNotifyData();

        setlog("transaction_id", notifyData.GetValue("transaction_id").ToString());
        //检查支付结果中transaction_id是否存在
        if (!notifyData.IsSet("transaction_id"))
        {
            setlog("transaction_id", "不存在");
            //若transaction_id不存在,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "支付结果中微信订单号不存在");
            Log.Error(this.GetType().ToString(), "The Pay result is error : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
        }
        else
        {
            #region 支付成功后处理订单信息=============================================================
            setlog("transaction_id", "存在");
            Cms.BLL.C_order otBll = new Cms.BLL.C_order();

            setlog("orderid", notifyData.GetValue("out_trade_no").ToString());
            DataTable DT = otBll.GetList("order_num='" + notifyData.GetValue("out_trade_no").ToString() + "'").Tables[0];
            if (DT != null && DT.Rows.Count > 0)//购物
            {
                int orderId = Convert.ToInt32(DT.Rows[0]["id"].ToString());
                Cms.Model.C_order ordertmp = otBll.GetModel(orderId);
                ordertmp.trade_no = notifyData.GetValue("transaction_id").ToString();
                //ordertmp.notify_id = notifyData.GetValue("notify_id").ToString();
                //ordertmp.pay_info = notifyData.GetValue("pay_info").ToString();
                //orderEntity.price_sum = total_fee;
                ordertmp.payment_time   = DateTime.Now;
                ordertmp.is_transaction = 0;
                ordertmp.order_status   = 0;
                ordertmp.is_payment     = 1;
                #region 修改积分============================
                //setlog("修改积分", notifyData.GetValue("out_trade_no").ToString());
                //Cms.BLL.C_user user_bll = new Cms.BLL.C_user();
                //Cms.Model.C_user user_model = new Cms.BLL.C_user().GetModel(Convert.ToInt32(ordertmp.user_id));
                //user_model.userallscore = user_model.userallscore + ordertmp.integral_sum;
                //user_model.userscore = user_model.userscore + ordertmp.integral_sum;
                //user_bll.Update(user_model);

                //Cms.BLL.C_integral_rec integral_BLL = new Cms.BLL.C_integral_rec();
                //Cms.Model.C_integral_rec integral_model = new Cms.Model.C_integral_rec();
                //DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + ordertmp.id).Tables[0];
                //if (dt != null && dt.Rows.Count > 0)
                //{
                //    for (int i = 0; i < dt.Rows.Count; i++)
                //    {
                //        integral_model.article_id = Convert.ToInt32(dt.Rows[i]["article_id"].ToString());
                //        integral_model.user_id = Convert.ToInt32(dt.Rows[i]["user_id"].ToString());
                //        integral_model.usercard = user_model.usercard;
                //        integral_model.openid = user_model.openid;
                //        integral_model.numberid = dt.Rows[i]["id"].ToString();
                //        integral_model.scorename = "购买产品";
                //        integral_model.title = dt.Rows[i]["title"].ToString();
                //        integral_model.wescore = Convert.ToInt32(dt.Rows[i]["integral"].ToString() == "" ? "0" : dt.Rows[i]["integral"].ToString()) * Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                //        integral_model.quantity = Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                //        integral_model.type = 0;
                //        integral_model.updateTime = DateTime.Now;
                //        integral_BLL.Add(integral_model);
                //        try
                //        {
                //            wxuser.UserSale wu = new wxuser.UserSale();//积分修改同步到ERP
                //            wu = wxuser.getUserScore(user_model.usercard, user_model.openid, dt.Rows[i]["id"].ToString(), "购买产品", "+" + integral_model.wescore);
                //        }
                //        catch (Exception ex)
                //        {
                //            page.Response.Write(ex.Message);
                //            page.Response.End();
                //        }
                //    }
                //}
                #endregion
                #region 减库存加销量============================



                DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + ordertmp.id).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        try
                        {
                            int productId = Convert.ToInt32(dt.Rows[i]["article_id"].ToString());
                            int quantity  = Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                            Cms.Model.C_product product = new Cms.BLL.C_product().GetModel(productId);
                            if (product.stock - quantity > 0)
                            {
                                product.stock = product.stock - quantity;
                                product.sales = product.sales + quantity;
                                new Cms.BLL.C_product().Update(product);
                            }
                        }
                        catch (Exception ex)
                        {
                            page.Response.Write(ex.Message);
                            page.Response.End();
                        }
                    }
                }
                #endregion
                Cms.BLL.wx_log   logBll     = new Cms.BLL.wx_log();
                Cms.Model.wx_log logModel   = new Cms.Model.wx_log();
                string           payTmpType = "【微支付】";
                string           funName    = payTmpType + "【微支付】 订单付款成功,处理订单" + " ProcessPaySuccess_wx ";
                bool             ret        = otBll.Update(ordertmp);//修改主表订单信息
                if (!ret)
                {
                    logModel.modelName   = payTmpType;
                    logModel.funName     = funName;
                    logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后处理数据失败";
                    logModel.logsType    = 0;
                    logBll.Add(logModel);
                }
                logModel.modelName   = payTmpType;
                logModel.funName     = funName;
                logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后,处理数据成功";
                logModel.logsType    = 1;
                logBll.Add(logModel);
            }
            else//充值
            {
                DataTable dtRecharge = new Cms.BLL.C_user_recharge().GetList("orderNumber='" + notifyData.GetValue("out_trade_no").ToString() + "'").Tables[0];
                if (dtRecharge != null && dtRecharge.Rows.Count > 0)
                {
                    int orderId = Convert.ToInt32(dtRecharge.Rows[0]["id"].ToString());
                    Cms.Model.C_user_recharge orderRecharge = new Cms.BLL.C_user_recharge().GetModel(orderId);
                    orderRecharge.isPay = 1;

                    Cms.Model.C_user user = new Cms.BLL.C_user().GetModel(Convert.ToInt32(orderRecharge.userId));
                    user.userMoney = user.userMoney + orderRecharge.price;
                    new Cms.BLL.C_user().Update(user);

                    Cms.BLL.wx_log   logBll     = new Cms.BLL.wx_log();
                    Cms.Model.wx_log logModel   = new Cms.Model.wx_log();
                    string           payTmpType = "【微支付】";
                    string           funName    = payTmpType + "【微支付】 订单付款成功,处理订单" + " ProcessPaySuccess_wx ";
                    bool             ret        = new Cms.BLL.C_user_recharge().Update(orderRecharge);//修改订单信息
                    if (!ret)
                    {
                        logModel.modelName   = payTmpType;
                        logModel.funName     = funName;
                        logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后处理数据失败";
                        logModel.logsType    = 0;
                        logBll.Add(logModel);
                    }
                    else
                    {
                        logModel.modelName   = payTmpType;
                        logModel.funName     = funName;
                        logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后,处理数据成功";
                        logModel.logsType    = 1;
                        logBll.Add(logModel);
                    }
                }
            }

            #endregion
        }

        string transaction_id = notifyData.GetValue("transaction_id").ToString();
        //查询订单,判断订单真实性
        if (!QueryOrder(transaction_id))
        {
            setlog("return_code", "FAIL");
            //若订单查询失败,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "订单查询失败");
            Log.Error(this.GetType().ToString(), "Order query failure : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
        }
        //查询订单成功
        else
        {
            setlog("return_code", "SUCCESS");
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "SUCCESS");
            res.SetValue("return_msg", "OK");
            Log.Info(this.GetType().ToString(), "order query success : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
            setlog("SUCCESS", res.ToXml());
        }
    }
Esempio n. 18
0
    /// <summary>
    /// 【微支付】 订单付款成功,处理订单:1将订单的状态改成付款完成;
    ///
    /// </summary>
    /// <param name="beforeFunName"></param>
    /// <param name="notify_id">通知id</param>
    /// <param name="out_trade_no">商户订单号</param>
    /// <param name="transaction_id">订单交易号</param>
    /// <param name="pay_info">支付结果</param>
    /// <param name="total_fee">付款金额(单位为分)</param>
    /// <param name="otid">订单临时表id</param>
    /// <returns>有错误则返回错误信息,正确,则返回空字符串</returns>
    public string ProcessPaySuccess_wx(string beforeFunName, string notify_id, string out_trade_no, string transaction_id, string pay_info, int total_fee, int otid, int wid)
    {
        string payTmpType = "【微支付】";

        total_fee = total_fee / 100;
        Cms.BLL.C_order orderBll = new Cms.BLL.C_order();

        string funName = payTmpType + beforeFunName + " ProcessPaySuccess_wx ";

        Cms.BLL.wx_log   logBll   = new Cms.BLL.wx_log();
        Cms.Model.wx_log logModel = new Cms.Model.wx_log();
        logModel.modelName   = "微支付";
        logModel.funName     = funName;
        logModel.logsContent = "开始执行ProcessPaySuccess_wx方法[otid:" + otid + "]";
        logBll.Add(logModel);
        try
        {
            #region 数据同步前
            IList <Cms.Model.C_order> orderlist = orderBll.GetModelList("id=" + otid + " and order_num='" + out_trade_no + "'");
            if (orderlist == null || orderlist.Count <= 0)
            {
                logModel.modelName   = payTmpType;
                logModel.funName     = funName;
                logModel.logsContent = "订单号【" + out_trade_no + "】订单号不存在";
                logModel.logsType    = 0;
                logBll.Add(logModel);
                return("订单号不存在");
            }
            ////这个暂时不处理
            //if (logBll.ExistsFlg((out_trade_no + otid)))
            //{  //如果已经处理过,则不再处理
            //    return "";
            //}
            //logBll.AddFlg(wid, payTmpType, funName, (out_trade_no + otid));//加标志,防止重复提交

            Cms.Model.C_order orderEntity = orderlist[0];
            //if (orderEntity.price_sum > total_fee)
            //{
            //    return "付款的金额(" + total_fee + ")小于订单的预付款金额(" + orderEntity.price_sum + ")信息,直接退款";
            //}
            orderEntity.notify_id = notify_id;
            orderEntity.trade_no  = transaction_id;
            orderEntity.pay_info  = pay_info;
            //orderEntity.price_sum = total_fee;
            orderEntity.payment_time   = DateTime.Now;
            orderEntity.is_transaction = 0;
            orderEntity.order_status   = 0;
            orderEntity.is_payment     = 1;


            #region 修改积分============================
            Cms.BLL.C_user   user_bll   = new Cms.BLL.C_user();
            Cms.Model.C_user user_model = new Cms.BLL.C_user().GetModel(Convert.ToInt32(orderEntity.user_id));
            user_model.userallscore = user_model.userallscore + orderEntity.integral_sum;
            user_model.userscore    = user_model.userscore + orderEntity.integral_sum;
            user_bll.Update(user_model);

            Cms.BLL.C_integral_rec   integral_BLL   = new Cms.BLL.C_integral_rec();
            Cms.Model.C_integral_rec integral_model = new Cms.Model.C_integral_rec();

            DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + otid).Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                integral_model.article_id = Convert.ToInt32(dt.Rows[i]["article_id"].ToString());
                integral_model.user_id    = Convert.ToInt32(dt.Rows[i]["user_id"].ToString());
                integral_model.usercard   = user_model.usercard;
                integral_model.openid     = user_model.openid;
                integral_model.numberid   = dt.Rows[i]["id"].ToString();
                integral_model.scorename  = "购买产品";
                integral_model.title      = dt.Rows[i]["title"].ToString();
                integral_model.wescore    = Convert.ToInt32(dt.Rows[i]["integral"].ToString() == "" ? "0" : dt.Rows[i]["integral"].ToString()) * Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                integral_model.quantity   = Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                integral_model.type       = 0;
                integral_model.updateTime = DateTime.Now;
                integral_BLL.Add(integral_model);
                try
                {
                    wxuser.UserSale wu = new wxuser.UserSale();
                    wu = wxuser.getUserScore(user_model.usercard, user_model.openid, dt.Rows[i]["id"].ToString(), "购买产品", "+" + integral_model.wescore);
                }
                catch (Exception ex)
                {
                }
            }

            #endregion
            ////判断是否需要立即发货
            //if (orderEntity.express_status == 0)
            //{
            //    //立即发货
            //    FaHuoProc fahuo = new FaHuoProc();

            //    BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay();
            //    Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(wid);
            //    Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, orderEntity);
            //    string errcode = fahuoDict["errcode"].ToString();
            //    string errmsg = fahuoDict["errmsg"].ToString();
            //    orderEntity.fahuoCode = errcode;
            //    orderEntity.fahuoMsg = errmsg;
            //    if (errcode == "0")
            //    {
            //        orderEntity.express_status = 2;
            //        orderEntity.express_time = DateTime.Now;
            //    }
            //    else
            //    {
            //        orderEntity.express_status = 1;
            //    }
            //}

            bool ret = orderBll.Update(orderEntity);
            if (!ret)
            {
                logModel.modelName   = payTmpType;
                logModel.funName     = funName;
                logModel.logsContent = "订单号【" + out_trade_no + "】支付成功后处理数据失败";
                logModel.logsType    = 0;
                logBll.Add(logModel);

                return("订单号【" + out_trade_no + "】支付成功后处理数据失败");
            }
            logModel.modelName   = payTmpType;
            logModel.funName     = funName;
            logModel.logsContent = "订单号【" + out_trade_no + "】支付成功后,处理数据成功";
            logModel.logsType    = 1;
            logBll.Add(logModel);

            return("");

            #endregion
        }
        catch (Exception ex)
        {
            logModel.modelName   = payTmpType;
            logModel.funName     = funName;
            logModel.logsContent = "订单号【" + out_trade_no + "】支付成功后处理数据同步出现错误:" + ex.Message;
            logModel.logsType    = 0;
            logBll.Add(logModel);

            return(null);
        }
    }
Esempio n. 19
0
    public void DataBind(int userId)
    {
        Cms.Model.C_user model = new Cms.BLL.C_user().GetModel(userId);
        this.username.Text    = model.username.ToString();; //姓名
        this.usercard.Text    = model.usercard.ToString();  //会员卡
        this.password.Text    = model.password.ToString();  //密码
        this.openid.Text      = model.openid.ToString();    //微信账号
        this.birthday.Text    = string.Format("{0:yyyy-MM-dd}", model.birthday);
        this.useraddress.Text = model.useraddress.ToString();
        this.telphone.Text    = model.telphone.ToString();
        this.marryday.Text    = string.Format("{0:yyyy-MM-dd}", model.marryday);
        //this.userMoney.Text = Convert.ToDecimal(model.userMoney).ToString("0.00");
        this.userJifen.Text    = model.userscore.ToString();
        this.shopcode.Text     = model.shopcode.ToString();
        this.shopname.Text     = model.shopname.ToString();
        this.sex.SelectedValue = model.sex.ToString();//性别
        this.updatetime.Text   = model.updatetime.ToString();

        DataSet ds = new Cms.BLL.c_user_address().GetList("user_id=" + userId);

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            rptList.DataSource = ds.Tables[0].DefaultView;
            rptList.DataBind();
        }
        else
        {
            rptList.DataSource = ds.Tables[0].DefaultView;
            rptList.DataBind();
        }

        DataSet dsBuy = new Cms.BLL.C_ordersub().GetList("user_id=" + userId);

        if (dsBuy != null && dsBuy.Tables[0].Rows.Count > 0)
        {
            RepBuyRecord.DataSource = dsBuy.Tables[0].DefaultView;
            RepBuyRecord.DataBind();
        }
        else
        {
            RepBuyRecord.DataSource = dsBuy.Tables[0].DefaultView;
            RepBuyRecord.DataBind();
        }

        DataSet dsIntegral = new Cms.BLL.C_order_integralsub().GetList("user_id=" + userId);

        if (dsIntegral != null && dsIntegral.Tables[0].Rows.Count > 0)
        {
            RepIntegralRec.DataSource = dsIntegral.Tables[0].DefaultView;
            RepIntegralRec.DataBind();
        }
        else
        {
            RepIntegralRec.DataSource = dsIntegral.Tables[0].DefaultView;
            RepIntegralRec.DataBind();
        }

        DataSet dsOne = new Cms.BLL.C_integral_rec().GetList("user_id=" + userId);

        if (dsOne != null && dsOne.Tables[0].Rows.Count > 0)
        {
            Repeater1.DataSource = dsOne.Tables[0].DefaultView;
            Repeater1.DataBind();
        }
        else
        {
            Repeater1.DataSource = dsOne.Tables[0].DefaultView;
            Repeater1.DataBind();
        }
    }