private void CheckCurrentPwd() { BLL.UserBLL bll = new BLL.UserBLL(); string pwd = ReStr("OldPwd"); string UserId = bll.CurrentUserId(); if (bll.CheckUserIdAndPwd(UserId, pwd)) { //用户密码正确! ReTrue(); } else { //用户密码错误! throw new Exception("密码输入错误!"); } }
private void SaveUser() { Model.UserInfoModel model = new Model.UserInfoModel(); model.Birthday = ReTime("Birthday", DateTime.Parse("1900-01-01")); model.CreateTime = DateTime.Now; model.Currency = 0; model.Email = ReStr("Email", ""); model.FlagMerchant = true; model.IdNo = ReStr("IdNo", ""); model.Memo = ReStr("Memo", ""); model.Phone = ReStr("Phone", ""); model.PicBig = ReStr("PicBig", ""); model.PicMid = ReStr("PicMid", ""); model.PicSmall = ReStr("PicSmall", ""); model.Power = 0; model.Pwd = ReStr("Pwd", ""); model.PwdMd5 = ReStr("PwdMd5", ""); model.qq = ReStr("qq", ""); model.RealName = ReStr("RealName", ""); model.Sex = ReStr("sex", "未知"); model.StreetId = 0; model.Tell = ReStr("Tell", ""); model.TownId = 1; model.UserCode = ReInt("UserCode", 0); model.UserId = ReStr("uid", ""); if (model.UserId.Trim() == "") { throw new Exception("不能为空!"); } model.UserLv = ReInt("UserLv", 90); model.UserTitle = ReStr("UserTitle", ""); model.UserTypeId = 3; model.Validated = ReBool("Validated", true); model.WxOpenID = ReStr("WxOpenID", ""); BLL.MerchantBLL mbll = new BLL.MerchantBLL(); BLL.UserBLL ubll = new BLL.UserBLL(); if (model.UserId == "小王") { if (ubll.CurrentUserId() != "小王") { throw new Exception("小王不是一般人能改的!-_-!"); } } ubll.SaveMyUserInfo(model); ReTrue(); }
/// <summary> /// 完善资料 /// </summary> private void SaveMyUserInfo() { BLL.UserBLL ubll = new BLL.UserBLL(); Model.UserInfoModel model = ubll.GetModel(ubll.CurrentUserId()); if (model.UserId.Trim() != "") { model = ubll.GetModel(model.UserId); } model.Birthday = ReTime("Birthday"); model.CreateTime = DateTime.Now; model.Memo = ReStr("Memo"); model.RealName = ReStr("RealName"); model.Sex = ReStr("Sex"); model.TownId = ReDecimal("TownId"); if (model.UserTitle != ReStr("UserTitle")) { try { //用户修改了状态 Model.DynamicModel dyModel = new Model.DynamicModel(); dyModel.DynamicLv = 80; dyModel.DynamicMerId = 0; dyModel.DynamicTitle = "" + model.UserId + "修改了自己的状态: '" + Common.StringPlus.GetLeftStr(ReStr("UserTitle"), 100, "...") + "'"; dyModel.DynamicType = "用户状态"; dyModel.DynamicUserId = model.UserId; BLL.CommBLL.AddDynamic(dyModel); } catch (Exception ex) { //什么都不做,失败就算了,不重要. } } model.UserTitle = ReStr("UserTitle"); model.PicBig = ReStr("PicBig"); model.PicMid = model.PicBig; model.PicSmall = model.PicBig; model.qq = ReStr("qq", ""); ubll.SaveMyUserInfo(model); ReTrue(); }
private void ChangePwd() { BLL.UserBLL bll = new BLL.UserBLL(); string OldPwd = ReStr("OldPwd"); string NewPwd1 = ReStr("NewPwd1"); string NewPwd2 = ReStr("NewPwd2"); string UserId = bll.CurrentUserId(); if (!bll.CheckUserIdAndPwd(UserId, OldPwd)) { throw new Exception("原始密码与当前用户不符!"); } if (NewPwd1.Trim() != NewPwd2.Trim()) { throw new Exception("输入了两次不同的新密码!"); } bll.ChangePwd(UserId, NewPwd1); bll.LoginIn(UserId, NewPwd1); ReTrue(); }