public UserAuthorizationModel Login(LoginModel loginModel) { if (string.IsNullOrEmpty(loginModel.Username)) { throw new ValidationException(Messages.UsernameRequired); } if (string.IsNullOrEmpty(loginModel.Password)) { throw new ValidationException(Messages.PasswordRequired); } var hashedPass = HashUtils.EncodeString(loginModel.Password); var user = _userRepository.GetByCredentials(loginModel.Username, hashedPass); if (user == null) { throw new UnauthorizedException(Messages.InvalidLogin); } var authorization = new UserAuthorizationModel { Id = user.Id, Username = user.Username, IsAdmin = user.IsAdmin, Token = SecurityUtils.GenerateToken() }; AuthorizationCache.Instance.AddOrUpdateAuthorization(authorization); return(authorization); }
protected void Page_Load(object sender, EventArgs e) { UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); if (userInfo.openId == null || userInfo.openId == "") { member = userInfo.mobile; } else { member = userInfo.openId; } Session["openid"] = member; //加载常用旅客信息 LVWEIBA.BLL.MemberHotel bllhotel = new LVWEIBA.BLL.MemberHotel(); List <LVWEIBA.Model.MemberHotel> lsthotel = bllhotel.GetModelList(" member='" + member + "'"); Literal1.Text = ""; string strhotel = ""; foreach (MemberHotel item in lsthotel) { strhotel += string.Format("<li id='{0}'>{1}<span>{2}</span><i class='iconfont' id='{3}'></i></li>", item.Id, item.Name, item.Card, item.Id); } Literal1.Text = strhotel; }
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; } DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser().GetModel(openid); this.Title = SingleUserInf.nickname + " 现金账户"; LVWEIBA.Model.MemberList mmm = new LVWEIBA.Model.MemberList(); mmm = new LVWEIBA.DAL.MemberList().GetModel(openid); if (mmm == null) { yue = "0.00"; } else { yue = mmm.Money.ToString(); } HUserHostAddress = Page.Request.UserHostAddress; }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { try { string tel = Request.Form["tel"]; string code = Request.Form["code"]; object codeCache = HttpContext.Current.Cache.Get("code" + tel); if (codeCache == null) { Response.Write("<script>alert('验证码失效');window.location='Login.aspx';</script>"); } else { if (code != codeCache.ToString()) { Response.Write("<script>alert('验证码不正确');window.location='Login.aspx';</script>"); } else { string weixinCode = Session["weixincode"].ToString(); string openid = new WEIxinUserApi().GetUserOpenid(code); DBCLASSFORWEIXIN.DAL.LocalWeixinUser ld = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser(); DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new WeixinApiClass.WEIxinUserApi().GetSingleUserInf(openid); SingleUserInf.Tel = tel; ld.Add(SingleUserInf); LVWEIBA.BLL.MemberList bllMember = new LVWEIBA.BLL.MemberList(); LVWEIBA.Model.MemberList model = new LVWEIBA.Model.MemberList(); LVWEIBA.Model.MemberList existModel = bllMember.GetModel(openid, tel); if (existModel == null) { model.Tel = tel; model.MemberId = openid; bllMember.Add(model); } else { existModel.MemberId = openid; bllMember.Update(model); } UserAuthorizationModel userInfoNow = new UserAuthorizationModel(); userInfoNow.mobile = tel; userInfoNow.openId = openid; userInfoNow.name = SingleUserInf.nickname; BaseClass.Common.Common.UserLoginSetCookie(userInfoNow.name, this.Page, DateTime.Now.AddMinutes(30), userInfoNow); log4netHelper.WriteDebugLog(typeof(Login), "bindCode", "用户绑定微信并且登陆成功:" + userInfoNow.mobile + " " + openid); Response.Redirect("Default.aspx"); } } } catch (Exception) { throw; } } }
protected void Page_Load(object sender, EventArgs e) { UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new CheckUserAndUpdate().CheckUserAndInsert(userInfo.openId, ""); Image1.ImageUrl = SingleUserInf.headimgurl; Label1.Text = SingleUserInf.nickname; }
protected void Page_Load(object sender, EventArgs e) { UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); if (userInfo.openId == null || userInfo.openId == "") { member = userInfo.mobile; } else { member = userInfo.openId; } ticketId = (string.IsNullOrEmpty(Request.QueryString["ticketId"]) ? 0 : int.Parse(Request.QueryString["ticketId"])); //预定数量 reserverCount = (string.IsNullOrEmpty(Request.QueryString["reserverCount"]) ? 0 : int.Parse(Request.QueryString["reserverCount"])); if (!IsPostBack) { var bll = new LVWEIBA.DAL.ProviderSpot(); ViewState["ticketId"] = ticketId; if (ticketId == 0 || reserverCount == 0) { Jscript.AlertAndRedirect("请选择合适的票数", "ticket.aspx"); } else { LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(ticketId); ticketTitle = providerSpot.SpotName; ticketId = providerSpot.ID; startDate = Convert.ToDateTime(providerSpot.BeginTime).ToString("yyyy年MM月dd号"); endDate = Convert.ToDateTime(providerSpot.EndTime).ToString("yyyy年MM月dd号"); orderPriceLbl.Text = "¥" + providerSpot.ZkPrice; string priceDetailStr = reserverCount + "张"; int maketPrice = (int)providerSpot.TicketPrice * reserverCount; int zkPrice = (int)providerSpot.ZkPrice * reserverCount; string str = string.Format(@"<p>市场价:¥{0}({1})</p> <p>优惠价:¥{2}({3})</p>", maketPrice, priceDetailStr, zkPrice, priceDetailStr); this.priceDetailLbl.Text = str; this.hid_count.Value = reserverCount.ToString(); this.hid_price_sc.Value = maketPrice.ToString(); this.hid_price_yh.Value = zkPrice.ToString(); this.hid_ticket_id.Value = ticketId.ToString(); this.hid_price_jj.Value = providerSpot.SellPrice.ToString(); HiddenFieldBZ.Value = str.Replace("<p>", "").Replace("</p>", ""); LVWEIBA.BLL.MemberHotel bllhotel = new LVWEIBA.BLL.MemberHotel(); List <LVWEIBA.Model.MemberHotel> lsthotel = bllhotel.GetModelList(" member='" + userInfo.mobile + "' or member='" + userInfo.openId + "'"); string strhotel = ""; foreach (MemberHotel item in lsthotel) { strhotel += string.Format(" <input id='Checkbox1' name='hotel' class='hotel' type='checkbox' value='{0}' />{1}", item.Id, item.Name); } contactPersonsLiteral.Text = strhotel; } } }
public ActionResult Authorization(UserAuthorizationModel user) { if (FindUser(user) != null) { TempData["message"] = $"Привіт {user.Login.Remove(1).ToUpper()+user.Login.Substring(1)}"; return(RedirectToAction("Index", "Home")); } else { TempData["message"] = "Ви не правильно вказали логін та/або пароль"; return(RedirectToAction("Index", "Home")); } }
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; } OnQuery(); }
public ActionResult Authorization(UserAuthorizationModel model) { if (ModelState.IsValid) { var user = db.Users .Where(m => m.Login.Equals(model.Login)) .FirstOrDefault(); if (user == null) { return(View("FailAuthorization")); } UserAccountModel userAccaunt = new UserAccountModel { Id = user.Id, Login = user.Login, Name = user.Name, LastName = user.LastName, Email = user.Email, AvatarUrl = user.AvatarUrl }; if (model.Password.Equals(user.Password)) { var cookie = new HttpCookie("id", user.Id.ToString()); Response.SetCookie(cookie); cookie = new HttpCookie("role", user.Role); Response.SetCookie(cookie); if (user.Role.Equals("admin")) { return(View("PersonalAdminAccaunt", userAccaunt)); } if (user.Role.Equals("user")) { return(View("PersonalUserAccaunt", userAccaunt)); } } else { HttpContext.Response.Cookies["id"].Value = ""; HttpContext.Response.Cookies["role"].Value = ""; return(View("FailAuthorization")); } } return(View()); }
public void AddOrUpdateAuthorization(UserAuthorizationModel authorization) { if (authorization != null && !string.IsNullOrWhiteSpace(authorization.Token)) { lock (_instanceLock) { if (!_authorizationModels.ContainsKey(authorization.Token)) { _authorizationModels.Add(authorization.Token, authorization); } else { _authorizationModels[authorization.Token] = authorization; } } } }
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; } uid.Value = openid; if (!IsPostBack) { ShowInfo(openid); } }
public static UserAuthorizationModel userLogin(Page page) { UserAuthorizationModel userInfo = BaseClass.Common.Common.GetCookieUserData <UserAuthorizationModel>(page); if (userInfo == null) { if (!UserAuthorization.userAuthorize(page.Request, page)) { page.Response.Redirect("~/index/Login.aspx"); } } else { log4netHelper.WriteDebugLog(typeof(UserAuthorization), "userLogin", "取出用户登录信息,OpenId: " + userInfo.openId + " naeme: " + userInfo.name); return(userInfo); } return(null); }
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; } if (!IsPostBack) { orderId = Request.QueryString["order_id"]; //赋值 showDetailInfo(orderId); GetNumbers(orderId); } }
private async void OnAdd(object sender, EventArgs e) { BindingContext = await UserAuthorizationModel.GetInstance(); if (!ValidateUserCode()) { return; } var userShortID = entryUserCode.Text; buttonAddUser.IsEnabled = false; bool success = ((UserAuthorizationModel)BindingContext).AddAuthUser(userShortID); if (!success) { labelUserCodeError.Text = "Code Error: wrong user code"; } buttonAddUser.IsEnabled = true; await PopupNavigation.Instance.PopAllAsync(); }
//protected string openid = ""; protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["code"] != null) { //微信渠道登陆 UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); } string s = "select top 10 * ,(1000*adultzkPrice/adultTicketPrice) as zk from View_LvLines where enddate >getdate() order by zk "; DataSet ds = DBCLASSFORWEIXIN.DAL.DbHelperSQL.Query(s, null); Repeater1.DataSource = ds.Tables[0]; Repeater1.DataBind(); //最新通知 BaseClass.Model.App_Notices am = new BaseClass.Dal.App_Notices().GetLastModel(); LabelNotice.Text = am.Title; //绑定广告幻灯片 //DataSet dss = new BaseClass.Dal.App_Ad().GetList(""); //Repeater2.DataSource = dss.Tables[0]; //Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); if (userInfo.openId == null || userInfo.openId == "") { openid = userInfo.mobile; } else { openid = userInfo.openId; } Session["openid"] = openid; DBCLASSFORWEIXIN.Model.LocalWeixinUser wxmdl = new CheckUserAndUpdate().CheckUserAndInsert(openid, ""); LVWEIBA.Model.MemberList mmm = new LVWEIBA.Model.MemberList(); mmm = new LVWEIBA.DAL.MemberList().GetModel(openid); if (mmm == null) { nickname = wxmdl.nickname; Tel = wxmdl.Tel; ddl_sex.SelectedValue = wxmdl.sex.ToString(); } else { nickname = wxmdl.nickname; Tel = wxmdl.Tel; MemberName = mmm.MemberName; ddl_sex.SelectedValue = wxmdl.sex.ToString(); Card = mmm.Card; Mail = mmm.Mail; Pwd = mmm.UserPwd; } } }
/// <summary> /// 对微信登陆操作进行验证 /// </summary> /// <param name="request"></param> /// <param name="page"></param> /// <returns></returns> public static bool userAuthorize(HttpRequest request, Page page) { try { string code = request.QueryString["code"]; if (code == null || code == "") { return(false); } string openid = new WEIxinUserApi().GetUserOpenid(code); DBCLASSFORWEIXIN.DAL.LocalWeixinUser ld = new DBCLASSFORWEIXIN.DAL.LocalWeixinUser(); if (ld.Exists(openid)) { //DBCLASSFORWEIXIN.Model.LocalWeixinUser localUser = new WeixinApiClass.WEIxinUserApi().GetSingleUserInf(openid); DBCLASSFORWEIXIN.Model.LocalWeixinUser user = ld.GetModel(openid); UserAuthorizationModel userInfo = new UserAuthorizationModel(); userInfo.mobile = user.Tel; userInfo.name = user.nickname; userInfo.openId = user.openid; BaseClass.Common.Common.UserLoginSetCookie(userInfo.name, page, DateTime.Now.AddDays(30), userInfo); return(true); } else { HttpContext.Current.Session["weixincode"] = code; page.Response.Redirect("~/index/bindCode.aspx"); return(false); } } catch (Exception ex) { // BaseClass.Common.LoggerUtil.printLog("userAuthorize error:"+ex.Message); log4netHelper.WriteExceptionLog(typeof(UserAuthorization), "userAuthorize", ex); return(false); } }
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; } this.Title = userInfo.name + " 现金账户"; LVWEIBA.Model.MemberList mmm = new LVWEIBA.Model.MemberList(); mmm = new LVWEIBA.DAL.MemberList().GetModel(openid); if (mmm == null) { yue = "0.00"; } else { yue = mmm.Money.ToString(); } }
private UserModel FindUser(UserAuthorizationModel user) { var users = GetAllUsersFromDataBase(); return(users.Where(dbuser => dbuser.Login == user.Login && dbuser.Password == user.Password).FirstOrDefault()); }
protected void Page_Load(object sender, EventArgs e) { int lineid = (string.IsNullOrEmpty(Request.QueryString["lineid"]) ? 0 : int.Parse(Request.QueryString["lineid"])); UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); if (userInfo.openId == null || userInfo.openId == "") { openid = userInfo.mobile; } else { openid = userInfo.openId; } string oid = Request.QueryString["ddbm"]; log4netHelper.WriteDebugLog(typeof(index_indent_pay), "indent_pay", "进入支付 orderid is:" + oid + "用户Id:" + openid); LVWEIBA.Model.order_list oom = new LVWEIBA.Model.order_list(); oom = new LVWEIBA.DAL.order_list().GetModel(oid); LVWEIBA.Model.order_Mx omm = new LVWEIBA.DAL.order_Mx().GetModel(oid); string typeObject = omm.ProType; if (!String.IsNullOrEmpty(typeObject)) { if (typeObject.Equals("DZP")) { type = "mp"; } else { type = "wd"; } } //BaseClass.Common.LoggerUtil.printLog("type is:" + type); shichangjia = omm.market_price.ToString(); youhuijia = omm.Transaction_price.ToString(); LVWEIBA.Model.MemberList mmm = new LVWEIBA.Model.MemberList(); mmm = new LVWEIBA.DAL.MemberList().GetModel(openid); if (mmm == null) { moneyLeft = "0.00"; } else { moneyLeft = mmm.Money.ToString(); } LVWEIBA.DAL.LvULines dallines = new LVWEIBA.DAL.LvULines(); LVWEIBA.Model.LvULines mlines = dallines.GetModel(omm.productNum); //根据订单明细的线路编号获取线路的类别 if ((mlines != null && mlines.Kindof.Equals("jianhang")) || type.Equals("mp")) //建行分期或门票 { HiddenFieldchctt.Value = omm.Transaction_price.ToString().Replace(".", ""); Label1.Text = omm.Transaction_price.ToString();//优惠价 lbl_scsm.Text = ""; lbl_yhsm.Text = "(支付时直接按优惠价价支付)"; type = "jh"; } else { lbl_scsm.Text = "(支付时按市场价支付)"; lbl_yhsm.Text = "(返还差价之后的实际成交价)"; lbl_zyts.Text = @" 重要提示:该产品按市场价支付,旅行结束后48小时内 驴尾巴网将差价返还至会员现金账户,会员可自由选择提现 或二次消费。"; HiddenFieldchctt.Value = omm.market_price.ToString().Replace(".", ""); Label1.Text = omm.market_price.ToString();//市场价 } if (type == null) { type = "default"; } HUserHostAddress = Page.Request.UserHostAddress; //HiddenFieldchctt.Value = omm.Transaction_price.ToString().Replace(".", ""); //Label1.Text = omm.Transaction_price.ToString(); this.hid_order_id.Value = oid; this.hid_order_type.Value = type; }
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; } //商户订单号,商户网站订单系统中唯一订单号,必填 string out_trade_no = Request.QueryString["orderid"].Trim(); //付款金额,必填 string total_fee = Request.QueryString["feee"].Trim(); //收银台页面上,商品展示的超链接,必填 string show_url = "http://lvwei8.com/index/showline.aspx?code=160928113527452356B&lineid=656"; //商品描述,可空 string jinbi = Request.QueryString["jinbi"].Trim(); string couponId = Request.QueryString["couponid"].Trim(); string useMoneyLeft = Request.QueryString["usemoneyleft"].Trim(); Response.ContentType = "text/html;charset=utf-8"; moneyFreeze(useMoneyLeft, out_trade_no, openId); //使用优惠券(加入订单号) if (couponId != "0") { LVWEIBA.BLL.MemberCoupon coupon = new LVWEIBA.BLL.MemberCoupon(); int id = int.Parse(couponId); LVWEIBA.Model.MemberCoupon couponModel = coupon.GetModel(id); couponModel.Order_Id = out_trade_no; couponModel.ZT = "1";//变为已使用 coupon.Update(couponModel); } try { //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", Config.partner); sParaTemp.Add("seller_id", Config.seller_id); sParaTemp.Add("_input_charset", Config.input_charset.ToLower()); sParaTemp.Add("service", Config.service); sParaTemp.Add("payment_type", Config.payment_type); sParaTemp.Add("notify_url", Config.notify_url); sParaTemp.Add("return_url", Config.return_url); sParaTemp.Add("out_trade_no", out_trade_no); sParaTemp.Add("subject", "驴尾巴商品"); sParaTemp.Add("total_fee", total_fee); sParaTemp.Add("show_url", show_url); //sParaTemp.Add("app_pay","Y");//启用此参数可唤起钱包APP支付。 sParaTemp.Add("body", openId); //其他业务参数根据在线开发文档,添加参数.文档地址:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.2Z6TSk&treeId=60&articleId=103693&docType=1 //如sParaTemp.Add("参数名","参数值"); //建立请求 log4netHelper.WriteDebugLog(typeof(index_control_AliPayHandler), "index_control_AliPayHandler", "orderid is:" + out_trade_no + "total_fee:" + total_fee + "paramters: " + sParaTemp.ToString()); submitLit.Text = Submit.BuildRequest(sParaTemp, "get", "确认"); } catch (Exception ex) { log4netHelper.WriteExceptionLog(typeof(index_control_AliPayHandler), "index_control_AliPayHandler Error", ex); } }
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"); } } } } } }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ // try // { // UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); // if (userInfo != null) // { // Response.Redirect("Default.aspx"); // } // } // catch (Exception) // { // ////不做处理 // } //} if (IsPostBack) { string tel = Request.Form["tel"]; string pass = Request.Form["pass"]; string code = Request.Form["code"]; object codeCache = HttpContext.Current.Cache.Get("code" + tel); if (codeCache == null) { Response.Write("<script>alert('验证码失效');window.location='Login.aspx';</script>"); return; } if (code != codeCache.ToString()) { Response.Write("<script>alert('验证码不正确');window.location='Login.aspx';</script>"); return; } var bll = new LVWEIBA.BLL.MemberInfo(); var blllist = new LVWEIBA.BLL.MemberList(); DataSet ds = bll.GetList(" tel='" + tel + "'"); if (ds.Tables[0].Rows.Count > 0) { string openid = ds.Tables[0].Rows[0]["openid"].ToString(); UserAuthorizationModel userInfoNow = new UserAuthorizationModel(); userInfoNow.mobile = tel; userInfoNow.openId = openid; userInfoNow.name = tel; BaseClass.Common.Common.UserLoginSetCookie(userInfoNow.name, this.Page, DateTime.Now.AddDays(30), userInfoNow); log4netHelper.WriteDebugLog(typeof(Login), "login", "用户登录成功:" + userInfoNow.mobile + " " + openid); Response.Redirect("~/Default.aspx"); } else { string 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) { UserAuthorizationModel userInfoNow = new UserAuthorizationModel(); userInfoNow.mobile = tel; userInfoNow.openId = openid; userInfoNow.name = tel; BaseClass.Common.Common.UserLoginSetCookie(userInfoNow.name, this.Page, DateTime.Now.AddDays(30), userInfoNow); log4netHelper.WriteDebugLog(typeof(Login), "login", "用户注册成功:" + userInfoNow.mobile + " " + openid); Response.Redirect("~/Default.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { TXT_Help th = new TXT_Help(); string postStr = ""; if (Request.HttpMethod.ToLower() == "post") { try { Stream s = System.Web.HttpContext.Current.Request.InputStream; byte[] b = new byte[s.Length]; s.Read(b, 0, (int)s.Length); postStr = Encoding.UTF8.GetString(b); th.ReFreshTXT(postStr, "D:\\msgweixin\\CCPost" + DateTime.Now.ToString("mddhhmmssffff") + ".txt"); XmlHelp xh = new XmlHelp(); SortedDictionary <string, string> sParams = xh.GetInfoFromXml(postStr); string openid = sParams["FromUserName"].ToString(); string ToUserName = sParams["ToUserName"].ToString(); string mesgtype = sParams["MsgType"].ToString().Trim(); string strresponse = ""; MessageCreater mc = new MessageCreater(); if (mesgtype == "text") { strresponse = mc.CreatTxtMsg(openid, ToUserName, sParams["Content"].ToString().Trim()); } else if (sParams["MsgType"].ToString().Trim() == "event") { if (sParams["Event"].ToString().Trim() == "subscribe")//会员关注 { string parentopenid = ""; if (sParams["EventKey"].ToString() != "") { parentopenid = sParams["EventKey"].ToString().Replace("qrscene_", ""); } DBCLASSFORWEIXIN.Model.LocalWeixinUser SingleUserInf = new CheckUserAndUpdate().CheckUserAndInsert(openid, parentopenid); UserAuthorizationModel userInfo = new UserAuthorizationModel(); userInfo.mobile = SingleUserInf.Tel; userInfo.name = SingleUserInf.nickname; userInfo.openId = SingleUserInf.openid; BaseClass.Common.Common.UserLoginSetCookie(userInfo.name, this, DateTime.Now.AddMinutes(30), userInfo); } else if (sParams["Event"].ToString().Trim() == "unsubscribe")//会员取消关注 { } else if (sParams["Event"].ToString().Trim() == "VIEW")//访问code跳转链接 { } else if (sParams["Event"].ToString().Trim() == "CLICK")//点击事件 { strresponse = mc.CreatCliskMsg(openid, ToUserName, sParams["EventKey"].ToString().Trim()); } else if (sParams["Event"].ToString().Trim() == "SCAN")//扫描事件 { //strresponse = mc.DefaultTxtMsg(openid, ToUserName);jumptodaijinquan_C3 strresponse = mc.CreatScanMsg(openid, ToUserName, sParams["EventKey"].ToString().Trim()); } else { } } else if (sParams["MsgType"].ToString().Trim().ToLower() == "voice") { } else if (sParams["MsgType"].ToString().Trim().ToLower() == "image") { } else { } WriteContent(strresponse); } catch (Exception mee) { th.ReFreshTXT(mee.ToString(), "D:\\msgweixin\\" + DateTime.Now.ToString("mddhhmmssffff") + ".txt"); } } else if (Request.HttpMethod.ToLower() == "get") { string Token = "m9zUU0V4v10M920s024r4ubu1bJ9bUJ5"; //与微信公众账号后台的Token设置保持一致,区分大小写。 //获取微信服务器验证apiUrl参数 string signature = Request["signature"]; string timestamp = Request["timestamp"]; string nonce = Request["nonce"]; string echostr = Request["echostr"]; string requestUrl = Request.QueryString["url"]; string lineId = Request.QueryString["lineid"]; requestUrl = requestUrl + "&lineid=" + lineId; try { JS_SDK_Class jssdk = new JS_SDK_Class(); timestamp = jssdk.getTimestamp(); nonce = jssdk.getNoncestr().ToLower(); signature = jssdk.Creat_signature(requestUrl).ToLower(); string jsapi_ticket = jssdk.Getjsapi_ticket(); CheckSignature cc = new CheckSignature(); //get method - 仅在微信后台填写URL验证时触发 string result = "{\"signature\":\"" + signature + "\",\"timestamp\":\"" + timestamp + "\",\"nonce\":\"" + nonce + "\",\"jsapi_ticket\":\"" + jsapi_ticket + "\"}"; log4netHelper.WriteDebugLog(typeof(API_WeixinApi), "jssdk授权返回", result + "requestUrl:" + requestUrl); WriteContent(result); } catch (Exception ex) { log4netHelper.WriteExceptionLog(typeof(API_WeixinApi), "WeixinApi", ex); WriteContent(echostr); } } else { } }
protected void Page_Load(object sender, EventArgs e) { UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page); //if (userInfo.openId == null || userInfo.openId == "") //{ // member = userInfo.mobile; //} //else //{ // member = userInfo.openId; //} //int adult = (string.IsNullOrEmpty(Request.QueryString["adult"]) ? 0 : int.Parse(Request.QueryString["adult"])); //int children = (string.IsNullOrEmpty(Request.QueryString["children"]) ? 0 : int.Parse(Request.QueryString["children"])); //lineid = (string.IsNullOrEmpty(Request.QueryString["lineid"]) ? 0 : int.Parse(Request.QueryString["lineid"])); //adultCount = adult; //puppyCount = children; //if (!IsPostBack) //{ // LVWEIBA.BLL.LvULines bll = new LVWEIBA.BLL.LvULines(); // LVWEIBA.Model.LvULines model = bll.GetModel(lineid); // ViewState["lineid"] = lineid; // if (model != null) // { // // DataTable dtlb = LVWEIBA.DAL.Common.GetCplb(); // //DataRow[] drlb= dtlb.Select("bm='" + model.Kindof + "'"); // //hid_lb.Value = drlb[0]["value"].ToString(); // hid_pronum.Value = model.ProNumCode; // this.lbl_ProName.Text = model.TTl; // this.lbl_ProNum.Text = model.ProNumCode; // string ydrs = ""; // string scine = ""; // string yhine = ""; // int scPrice = 0; // int yhPrice = 0; // int jjPrice = 0; // if (adult > 0) // { // scine += "成人¥" + model.adultTicketPrice + "x" + adult + ";"; // yhine += "成人¥" + model.adultzkPrice + "x" + adult + ";"; // ydrs += " 成人*" + adult; // scPrice += Convert.ToInt32(model.adultTicketPrice) * adult; // yhPrice += Convert.ToInt32(model.adultzkPrice) * adult; // jjPrice += Convert.ToInt32(model.adultSellPrice) * adult; // } // if (children > 0) // { // scine += "儿童¥" + model.puppyTicketPrice + "x" + children + ";"; // yhine += "儿童¥" + model.puppyzkCount + "x" + children + ";"; // ydrs += " 儿童*" + children; // scPrice += Convert.ToInt32(model.puppyTicketPrice) * children; // yhPrice += Convert.ToInt32(model.puppyzkCount) * children; // jjPrice += Convert.ToInt32(model.puppySellPrice) * adult; // } // this.lbl_Ydrs.Text = ydrs; // this.lbl_Cfcity.Text = model.Splace; // this.lbl_Cfdate.Text = Convert.ToDateTime(model.Sdate).ToString("yyyy-MM-dd"); // string str = string.Format(@"<p>市场价:¥{0}({1})</p> // <p>优惠价:¥{2}({3})</p>", scPrice, scine, yhPrice, yhine); // this.hid_price_sc.Value = scPrice.ToString(); // this.hid_price_yh.Value = yhPrice.ToString(); // this.hid_price_jj.Value = jjPrice.ToString(); // this.hid_count.Value = (adult + children).ToString(); // this.li_jine.Text = str; // lbl_DDjE.Text = "¥" + yhPrice; // HiddenFieldBZ.Value = str.Replace("<p>", "").Replace("</p>", ""); // LVWEIBA.BLL.MemberHotel bllhotel = new LVWEIBA.BLL.MemberHotel(); // List<LVWEIBA.Model.MemberHotel> lsthotel = bllhotel.GetModelList(" member='" + member + "'"); // string strhotel = ""; // foreach (MemberHotel item in lsthotel) // { // strhotel += string.Format(" <input id='Checkbox1' name='hotel' class='hotel' type='checkbox' value='{0}' />{1}", item.Id, item.Name); // } // // Literal1.Text = strhotel; // } //} //Label1.Text = ""; //Label1.Text = Request.ServerVariables["HTTP_HOST"] + Request.ServerVariables["SCRIPT_NAME"]; }
private async void InitTherapist() { BindingContext = await UserAuthorizationModel.GetInstance(); }
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"); } } } } } }