protected uinfoEntity GetUser() { uinfoEntity u = new uinfoEntity(); string uid = this.GetUserid(this.Request.RequestContext.HttpContext.Session, this.Request.RequestContext.HttpContext.Request, this.Request.RequestContext.HttpContext.Response); string o_uid = uid; uid = uid.Split('-').Length > 1 ? uid.Split('-')[0] + uid.Split('-')[1] : uid; if (!string.IsNullOrEmpty(uid)) { if (Common.Cache.User.GetInstance().MapingData.ContainsKey(uid)) { u = Common.Cache.User.GetInstance().MapingData[uid]; } else { string msg = ""; var ul = uinfoDal.GetListByWhere(string.Format("countrycode='{0}' and userid='{1}'", o_uid.Split('-')[0], o_uid.Split('-')[1]), ref msg); if (ul != null && ul.Count > 0) { u = ul[0]; } } } return(u); }
public static bool Update(uinfoEntity item) { DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, item.uid)).Tables[0]; if (dt.Rows.Count == 1) { dt.Rows[0]["changepwd"] = item.changepwd; dt.Rows[0]["countrycode"] = item.countrycode; dt.Rows[0]["nikename"] = item.nikename; dt.Rows[0]["regdatetime"] = item.regdatetime; dt.Rows[0]["userid"] = item.userid; dt.Rows[0]["puid"] = item.puid; dt.Rows[0]["usertype"] = item.usertype; dt.Rows[0]["wkcaddress"] = item.wkcaddress; dt.Rows[0]["userpwd"] = item.userpwd; dt.Rows[0]["wkccheckmoney"] = item.wkccheckmoney; dt.Rows[0]["wkccheckpass"] = item.wkccheckpass; dt.Rows[0]["datachange_lasttime"] = DateTime.Now; dt.Rows[0]["isvip"] = item.isvip; dt.Rows[0]["vipdate"] = item.vipdate; dt.Rows[0]["lastchecktime"] = item.lastchecktime; return(DBAccess.DataAccess.Miou_UpdateDataSet("", tableName, "*", "1<>1", "", dt).StartsWith("000")); } else { return(true); } }
public static bool Insert(uinfoEntity item, ref string fuid) { bool rv = true; try { DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, item.uid)).Tables[0]; DataRow dr = dt.NewRow(); dr["changepwd"] = item.changepwd; dr["countrycode"] = item.countrycode; dr["nikename"] = item.nikename; dr["regdatetime"] = item.regdatetime; dr["userid"] = item.userid; dr["puid"] = item.puid; dr["usertype"] = item.usertype; dr["wkcaddress"] = item.wkcaddress; dr["userpwd"] = item.userpwd; dr["wkccheckmoney"] = item.wkccheckmoney; dr["wkccheckpass"] = item.wkccheckpass; dr["datachange_lasttime"] = DateTime.Now; dr["isvip"] = 0; dr["vipdate"] = DateTime.Now.Date.AddDays(-1); dt.Rows.Add(dr); rv = DBAccess.DataAccess.Miou_UpdateDataSet("", tableName, "*", "1<>1", "", dt).StartsWith("000"); if (rv) { string info = string.Empty; var ulist = uinfoDal.GetListByWhere(string.Format("userid='{0}' and countrycode='{1}'", item.userid, item.countrycode), ref info); if (ulist != null && ulist.Count > 0) { fuid = ulist[0].uid.ToString(); DBAccess.DataAccess.Miou_GetDataScalarBySql("", string.Format(@" INSERT INTO u_account (uid, accountmony, stopmoney ) VALUES ({0}, 0, 0); select 1; ", ulist[0].uid)); rv = true; } } } catch (Exception ex) { string ss = ex.ToString(); rv = false; } return(rv); }
/// <summary> /// /// </summary> /// <param name="where"></param> /// <returns></returns> public static uinfoEntity GetByKeyId(int id, ref string info) { try { uinfoEntity entity = new uinfoEntity(); DataTable dt = DBAccess.DataAccess.Miou_GetDataSetBySql(DBAccess.LogUName, string.Format("select * from {0} where {1} = {2} ;", tableName, keyName, id)).Tables[0]; var list = DBAccess.GetEntityList <uinfoEntity>(dt); if (list != null && list.Count > 0) { entity = list[0]; } return(entity); } catch (Exception ex) { info = ex.Message; return(new uinfoEntity()); } }
public ActionResult Index() { uinfoEntity uinfo = new uinfoEntity(); uinfo.uid = 0; uinfo.userid = ""; string userid = TempData["reguserid"] != null ? TempData["reguserid"].ToString() : ""; if (string.IsNullOrEmpty(userid)) { return(View(uinfo)); } string msg = ""; var ulist = uinfoDal.GetListByWhere(string.Format("userid='{0}'", userid), ref msg); if (ulist != null && ulist.Count > 0) { uinfo = ulist[0]; } return(View(uinfo)); }
public ActionResult UInfoModify(string tel, string area, string scode, string pwd1, string pwd2, string wkcaddress, string nickname) { if (!Common.HeistMon.HMon.GetInstance().AddMon("UInfoModify_" + base.GetRequesterIP(), 10)) { this.HttpContext.Response.Write("FireWall!"); this.HttpContext.Response.End(); return(null); } PostResponse _Respone = new PostResponse() { IsSuccess = false }; tel = tel.Trim(); area = area.Trim(); wkcaddress = wkcaddress.Trim(); if (!Common.Cache.User.GetInstance().MapingData.ContainsKey(area + tel)) { _Respone.IsSuccess = false; _Respone.Message = "手机号无注册,请先注册."; return(Json(_Respone)); } string info = ""; string mobileno = area + tel; var dlist = mmsgnocDal.GetListByWhere(string.Format("mobileno='{0}'", mobileno), ref info); if (dlist == null || dlist.Count == 0) { _Respone.IsSuccess = false; _Respone.Message = "请先获取短信验证码."; return(Json(_Respone)); } else { if (dlist[0].stopdatetime <= DateTime.Now) { _Respone.IsSuccess = false; _Respone.Message = "短信验证码已过期,请重新获取短信验证码。"; return(Json(_Respone)); } if (dlist[0].msgcode != scode) { _Respone.IsSuccess = false; _Respone.Message = "短信验证码不正确,请重新输入。"; return(Json(_Respone)); } dlist[0].stopdatetime = DateTime.Now.AddHours(-1); mmsgnocDal.Update(dlist[0]); } info = ""; var ulist = uinfoDal.GetListByWhere(string.Format("userid='{0}' and countrycode='{1}'", tel, area), ref info); if (!(ulist != null && ulist.Count > 0)) { _Respone.IsSuccess = false; _Respone.Message = "手机号无注册,请先注册."; return(Json(_Respone)); } else { var uinfo = ulist[0]; bool changewkcaddress = false; if (wkcaddress.Trim().Length > 0 && uinfo.wkcaddress.Trim() != wkcaddress.Trim()) { changewkcaddress = true; var ulist1 = uinfoDal.GetListByWhere(string.Format("wkcaddress='{0}' ", wkcaddress), ref info); if (ulist1 != null && ulist1.Count > 0) { _Respone.IsSuccess = false; _Respone.Message = "钱包已被其他用户绑定!"; return(Json(_Respone)); } } uinfoEntity ue = uinfo; ue.regdatetime = DateTime.Now; ue.nikename = nickname; ue.datachange_lasttime = DateTime.Now; if (changewkcaddress) { ue.wkcaddress = wkcaddress.Trim(); ue.wkccheckmoney = double.Parse("0.0" + Common.SMS.SMS.random.Next(1001, 2000).ToString()); ue.wkccheckpass = false; } if (pwd2.Trim().Length > 0) { ue.changepwd = SecurityHelp.EncryptMD5(pwd2); } if (pwd1.Trim().Length > 0) { ue.userpwd = SecurityHelp.EncryptMD5(pwd1); } _Respone.IsSuccess = uinfoDal.Update(ue); if (_Respone.IsSuccess) { _Respone.Message = "/login"; } else { _Respone.Message = "注册失败,请稍后尝试."; } } return(Json(_Respone)); }
public ActionResult URegister(string tel, string area, string scode, string pwd1, string pwd2, string wkcaddress, string nickname, string puid) { PostResponse _Respone = new PostResponse() { IsSuccess = false }; if (MvcApplication.Syspar.ContainsKey("AllowReg")) { if (MvcApplication.Syspar["AllowReg"].keyvalue == "0") { _Respone.IsSuccess = false; _Respone.Message = !string.IsNullOrEmpty(MvcApplication.Syspar["AllowReg"].keydes) ? MvcApplication.Syspar["AllowReg"].keydes : "暂停注册,请关注官方通知."; return(Json(_Respone)); } } tel = tel.Trim(); area = area.Trim(); wkcaddress = wkcaddress.Trim(); if (Common.Cache.User.GetInstance().MapingData.ContainsKey(area + tel)) { _Respone.IsSuccess = false; _Respone.Message = "账号已注册,请进入登录页面登录."; return(Json(_Respone)); } if (wkcaddress.Trim().Length == 0) { _Respone.IsSuccess = false; _Respone.Message = "钱包地址未填."; return(Json(_Respone)); } string info = ""; string mobileno = area + tel; var dlist = mmsgnocDal.GetListByWhere(string.Format("mobileno='{0}'", mobileno), ref info); if (dlist == null || dlist.Count == 0) { _Respone.IsSuccess = false; _Respone.Message = "请先获取短信验证码."; return(Json(_Respone)); } else { if (dlist[0].stopdatetime <= DateTime.Now) { _Respone.IsSuccess = false; _Respone.Message = "短信验证码已过期,请重新获取短信验证码。"; return(Json(_Respone)); } if (dlist[0].msgcode != scode) { _Respone.IsSuccess = false; _Respone.Message = "短信验证码不正确,请重新输入。"; return(Json(_Respone)); } dlist[0].stopdatetime = DateTime.Now.AddHours(-1); mmsgnocDal.Update(dlist[0]); } info = ""; var ulist = uinfoDal.GetListByWhere(string.Format("userid='{0}' and countrycode='{1}'", tel, area), ref info); if (ulist != null && ulist.Count > 0) { _Respone.IsSuccess = false; _Respone.Message = "账号已注册,请进入登录页面登录."; return(Json(_Respone)); } else { var ulist1 = uinfoDal.GetListByWhere(string.Format("wkcaddress='{0}' ", wkcaddress), ref info); if (ulist1 != null && ulist1.Count > 0) { _Respone.IsSuccess = false; _Respone.Message = "钱包已绑定!"; return(Json(_Respone)); } uinfoEntity ue = new uinfoEntity(); ue.regdatetime = DateTime.Now; ue.nikename = nickname; ue.userid = tel; ue.countrycode = area; ue.datachange_lasttime = DateTime.Now; ue.lastchecktime = DateTime.Now; ue.usertype = 0; ue.wkcaddress = wkcaddress; ue.wkccheckmoney = double.Parse("0.0" + Common.SMS.SMS.random.Next(1001, 2000).ToString()); ue.wkccheckpass = false; ue.changepwd = pwd2.Length > 0 ? SecurityHelp.EncryptMD5(pwd2) : ""; ue.userpwd = SecurityHelp.EncryptMD5(pwd1); ue.puid = int.Parse(string.IsNullOrEmpty(puid) ? "0" : puid); string fuid = string.Empty; _Respone.IsSuccess = uinfoDal.Insert(ue, ref fuid); if (_Respone.IsSuccess) { this.Request.RequestContext.HttpContext.Session["loginsessionuser"] = SecurityHelp.DESEncrypt(area + "-" + tel); // _Respone.Message = "/verify"; _Respone.Message = "/vote"; var ul = uinfoDal.GetListByWhere(string.Format("countrycode='{0}' and userid='{1}'", area, tel), ref info); } else { _Respone.Message = "注册失败,请稍后尝试."; } } return(Json(_Respone)); }