예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["openid"] == null)
        {
            if (string.IsNullOrEmpty(Request.QueryString["code"]))
            {
                Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/bindPhone.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
            }

            else
            {
                string code = Request.QueryString["code"];
                openid = new WEIxinUserApi().GetUserOpenid(code);

                if (openid.Length < 10)
                {
                    Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/bindPhone.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
                }
            }
            Session["openid"] = openid;
        }
        else
        {
            openid = Session["openid"].ToString();
        }

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "bindPhone.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "bindPhone.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel = mobile.Trim();
                            bll.Update(member);

                            //发放礼券
                            //0020160508000001D5KI
                            List <LVWEIBA.Model.MemberCoupon> list      = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.BLL.MemberCoupon          bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            LVWEIBA.BLL.Coupon_Info           bllCou    = new LVWEIBA.BLL.Coupon_Info();
                            LVWEIBA.Model.Coupon_Info         cou       = bllCou.GetModel("0020160604000001KBW1");
                            LVWEIBA.Model.MemberCoupon        mdl       = new LVWEIBA.Model.MemberCoupon();
                            mdl.CouponID = "0020160604000001KBW1";
                            mdl.Userid   = openid;
                            mdl.ZT       = "0";
                            mdl.Count    = 1;
                            mdl.Sj       = DateTime.Now;
                            mdl.Order_Id = "";
                            list.Add(mdl);
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            if (bllCoupon.SendCouton(list, "0020160604000001KBW1", 1))
                            {
                                Jscript.NorefLocation(this.Page, "手机验证成功!", "Coupon.aspx");
                            }
                            else
                            {
                                Jscript.NorefLocation(this.Page, "手机验证失败!", "Coupon.aspx");
                            }
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "该手机已经验证过!", "bindPhone.aspx");
                        }
                    }
                }
            }
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);

        if (userInfo.openId == null || userInfo.openId == "")
        {
            openid = userInfo.mobile;
        }
        else
        {
            openid = userInfo.openId;
        }
        Session["openid"] = openid;

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "CouponForOneThousand.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "CouponForOneThousand.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel = mobile.Trim();
                            bll.Update(member);
                            //发放礼券(500一张,300元一张,50元2张,20元5张)
                            LVWEIBA.BLL.MemberCoupon bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            //20元
                            for (int i = 0; i < 5; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> list = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdl  = new LVWEIBA.Model.MemberCoupon();
                                mdl.CouponID = "0020160604000001KBW1";
                                mdl.Userid   = openid;
                                mdl.ZT       = "0";
                                mdl.Count    = 5;
                                mdl.Sj       = DateTime.Now;
                                mdl.Order_Id = "";
                                list.Add(mdl);
                                bllCoupon.SendCouton(list, "0020160604000001KBW1", 1);
                            }
                            //50元
                            for (int i = 0; i < 2; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> listForFifty = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdlForFifty  = new LVWEIBA.Model.MemberCoupon();
                                mdlForFifty.CouponID = "0020160604000001L511";
                                mdlForFifty.Userid   = openid;
                                mdlForFifty.ZT       = "0";
                                mdlForFifty.Count    = 2;
                                mdlForFifty.Sj       = DateTime.Now;
                                mdlForFifty.Order_Id = "";
                                listForFifty.Add(mdlForFifty);
                                bllCoupon.SendCouton(listForFifty, "0020160604000001L511", 1);
                            }
                            //300元
                            List <LVWEIBA.Model.MemberCoupon> listForThreeHundred = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForThreeHundred  = new LVWEIBA.Model.MemberCoupon();
                            mdlForThreeHundred.CouponID = "002016060400000164Q5";
                            mdlForThreeHundred.Userid   = openid;
                            mdlForThreeHundred.ZT       = "0";
                            mdlForThreeHundred.Count    = 1;
                            mdlForThreeHundred.Sj       = DateTime.Now;
                            mdlForThreeHundred.Order_Id = "";
                            listForThreeHundred.Add(mdlForThreeHundred);
                            bllCoupon.SendCouton(listForThreeHundred, "002016060400000164Q5", 1);
                            //500元
                            List <LVWEIBA.Model.MemberCoupon> listForFiveHundred = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForFiveHundred  = new LVWEIBA.Model.MemberCoupon();
                            mdlForFiveHundred.CouponID = "00201606200000011KA9";
                            mdlForFiveHundred.Userid   = openid;
                            mdlForFiveHundred.ZT       = "0";
                            mdlForFiveHundred.Count    = 1;
                            mdlForFiveHundred.Sj       = DateTime.Now;
                            mdlForFiveHundred.Order_Id = "";
                            listForFiveHundred.Add(mdlForFiveHundred);
                            bllCoupon.SendCouton(listForFiveHundred, "00201606200000011KA9", 1);

                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "领取成功!", "Coupon.aspx");
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "请先验证手机!", "bindPhone.aspx");
                        }
                    }
                }
            }
        }
    }
예제 #3
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        decimal order_Price = int.Parse(hid_price_yh.Value);
        string  order_id    = DateTime.Now.ToString("yyyyMMdd") + "0000" + "MP" + BaseClass.Common.Common.getSuijiString(2);

        //明细
        LVWEIBA.Model.order_Mx modelMx = null;

        LVWEIBA.BLL.order_Mx bllMx = new LVWEIBA.BLL.order_Mx();
        modelMx                   = new LVWEIBA.Model.order_Mx();
        modelMx.order_id          = order_id;
        modelMx.productNum        = hid_ticket_id.Value;
        modelMx.market_price      = int.Parse(hid_price_sc.Value); //市场价
        modelMx.Transaction_price = int.Parse(hid_price_yh.Value); //优惠价
        modelMx.Transfer_price    = int.Parse(hid_price_jj.Value); //交接价
        modelMx.ProCount          = int.Parse(this.hid_count.Value);
        //商品类型(电子票)
        modelMx.ProType = "DZP";
        //成人和小孩数量(门票默认为0)
        modelMx.adultCount = 0;
        modelMx.puppyCount = 0;

        bllMx.Add(modelMx);

        //订单
        LVWEIBA.Model.order_list model = new LVWEIBA.Model.order_list();
        model.order_id    = order_id;
        model.user_id     = member;
        model.order_sj    = DateTime.Now;
        model.order_zt    = "DZF";//待支付
        model.order_Price = order_Price;
        model.bz          = HiddenFieldBZ.Value;

        LVWEIBA.BLL.order_list bll = new LVWEIBA.BLL.order_list();
        if (bll.Add(model))
        {        //给订单添加旅客信息
            System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
            string[] arrhotel = nc.GetValues("hotel");
            LVWEIBA.BLL.MemberHotelMx bllhotel = new LVWEIBA.BLL.MemberHotelMx();
            if (arrhotel != null && arrhotel.Length > 0)
            {
                for (int i = 0; i < arrhotel.Length; i++)
                {
                    if (arrhotel[i] == "")
                    {
                        break;
                    }
                    MemberHotelMx m = new MemberHotelMx();
                    m.Member  = member;
                    m.OrderID = order_id;
                    m.Hotel   = int.Parse(arrhotel[i]);
                    m.Sj      = DateTime.Now;
                    bllhotel.Add(m);
                }
            }
            else
            {
                Jscript.NorefLocation(this.Page, "请选择联系用户!", "showTicket.aspx");
            }
            //1代表门票0代表尾单
            Response.Redirect("indent_pay.aspx?ddbm=" + order_id + "&lineid=" + ViewState["ticketId"] + "&type='mp'");
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);

        if (userInfo.openId == null || userInfo.openId == "")
        {
            openid_db = userInfo.mobile;
        }
        else
        {
            openid_db = userInfo.openId;
        }
        //Session["openid"] = openid;

        if (string.IsNullOrEmpty(Request.QueryString["code"]))
        {
            Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/CouponForNinety.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
        }

        else
        {
            string code = Request.QueryString["code"];
            openid_wx = new WEIxinUserApi().GetUserOpenid(code);
            //Session["openid"] = openid;

            if (openid_wx.Length < 10)
            {
                Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + GetWeiXinInf.appid + "&redirect_uri=http://wx.lvwei8.com/index/CouponForNinety.aspx&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
            }
            else
            {
            }
        }

        if (IsPostBack)
        {
            string mobile = Request.Form["tel"];
            string code   = Request.Form["code"];

            object codeCache = HttpContext.Current.Cache.Get("code" + mobile);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + mobile + "code is:" + code, "CouponForNinety.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "CouponForNinety.aspx");
                }
                else
                {
                    var member = new LVWEIBA.BLL.MemberInfo().GetModel(openid_db);
                    if (member != null)
                    {
                        if (member.Tel == "" || member.Tel == null || openid_db != openid_wx)
                        {
                            //更新用户信息
                            var bll = new LVWEIBA.BLL.MemberInfo();
                            member.Tel    = mobile.Trim();
                            member.openid = openid_wx;
                            bll.Update(member);
                            //发放礼券(50元一张,20元俩张)
                            LVWEIBA.BLL.MemberCoupon bllCoupon = new LVWEIBA.BLL.MemberCoupon();
                            for (int i = 0; i < 2; i++)
                            {
                                List <LVWEIBA.Model.MemberCoupon> list = new List <LVWEIBA.Model.MemberCoupon>();
                                LVWEIBA.Model.MemberCoupon        mdl  = new LVWEIBA.Model.MemberCoupon();
                                mdl.CouponID = "0020160604000001KBW1";
                                mdl.Userid   = openid_wx;
                                mdl.ZT       = "0";
                                mdl.Count    = 2;
                                mdl.Sj       = DateTime.Now;
                                mdl.Order_Id = "";
                                list.Add(mdl);
                                bllCoupon.SendCouton(list, "0020160604000001KBW1", 1);
                            }
                            //50元
                            List <LVWEIBA.Model.MemberCoupon> listForFifty = new List <LVWEIBA.Model.MemberCoupon>();
                            LVWEIBA.Model.MemberCoupon        mdlForFifty  = new LVWEIBA.Model.MemberCoupon();
                            mdlForFifty.CouponID = "0020160604000001L511";
                            mdlForFifty.Userid   = openid_wx;
                            mdlForFifty.ZT       = "0";
                            mdlForFifty.Count    = 1;
                            mdlForFifty.Sj       = DateTime.Now;
                            mdlForFifty.Order_Id = "";
                            listForFifty.Add(mdlForFifty);
                            bllCoupon.SendCouton(listForFifty, "0020160604000001L511", 1);
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "领取成功!", "Coupon.aspx");
                        }
                        else
                        {
                            //删除缓存
                            HttpContext.Current.Cache.Remove("code" + mobile);
                            Jscript.NorefLocation(this.Page, "该手机号已经验证过!", "CouponForNinety.aspx");
                        }
                    }
                }
            }
        }
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            string tel = Request.Form["tel"];
            string code = Request.Form["code"];
            string pass = Request.Form["pass"];

            object codeCache = HttpContext.Current.Cache.Get("code" + tel);
            if (codeCache == null)
            {
                Jscript.NorefLocation(this.Page, "验证码失效请重新获取!手机号为:" + tel + "验证码为:" + code, "registration.aspx");
            }
            else
            {
                if (code != codeCache.ToString())
                {
                    Jscript.NorefLocation(this.Page, "验证码不正确!", "registration.aspx");
                }
                else
                {
                    try
                    {

                        var bll = new LVWEIBA.BLL.MemberInfo();
                        DataSet ds = bll.GetList(" tel='" + tel + "'");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Jscript.NorefLocation(this.Page, "该手机号已注册!", "registration.aspx");
                        }
                        else
                        {
                            openid = BaseClass.Common.Common.getSuijiString(30);

                            DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new DBCLASSFORWEIXIN.Model.LocalWeixinUser();
                            DBCLASSFORWEIXIN.DAL.LocalWeixinUser ld = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser();

                            SingleUserInf.country = "";
                            SingleUserInf.province = "";
                            SingleUserInf.city = "";
                            SingleUserInf.remark = "";
                            SingleUserInf.openid = openid;
                            SingleUserInf.regtime = DateTime.Now;
                            SingleUserInf.Tel = tel;
                            SingleUserInf.Jifen = 0;
                            SingleUserInf.money = 0;
                            SingleUserInf.vips = 0;
                            SingleUserInf.pid = 0;
                            SingleUserInf.refresh_token = "";
                            SingleUserInf.nickname = "";
                            SingleUserInf.headimgurl = "";
                            SingleUserInf.subscribe = 1;
                            SingleUserInf.subscribe_time = "";
                            SingleUserInf.unionid = "";
                            SingleUserInf.groupid = 0;
                            SingleUserInf.sex = 1;

                            LVWEIBA.BLL.MemberList bllMember = new LVWEIBA.BLL.MemberList();
                            LVWEIBA.Model.MemberList model = new LVWEIBA.Model.MemberList();


                            model.MemberId = openid;
                            model.UserPwd = pass;
                            model.Tel = tel;
                            if (bllMember.Add(model) && ld.Add(SingleUserInf) > 0)
                            {
                                Session["openid"] = openid;
                                Response.Redirect("Default.aspx");
                            }
                        }

                    }
                    catch (Exception EX)
                    {

                        throw;
                    }
                }
            }
        }
    }