/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public ApiMessage <string> Registered(UserInfoEx user) { var api = new ApiMessage <string>(); var gCode = CacheHelper.GetCache("VCode_" + user.UserCode); if (_dal.GetByPhone(user.UserCode).Success) { api.Success = false; api.Msg = "手机号已注册"; return(api); } if (gCode == null) { api.Success = false; api.Msg = "验证码已过期"; return(api); } if (gCode.ToString() != user.VerifyCode) { api.Success = false; api.Msg = "验证码有误"; return(api); } var strDate = ConfigurationManager.AppSettings["Member_Date"]; if (string.IsNullOrEmpty(strDate)) { strDate = "2020-10-31"; } var dbUser = new userinfo { ID = Guid.NewGuid().ToString(), IsActive = 1, IsMember = 0, PassWord = Encrypt.MD5(user.PassWord), CreateDate = DateTime.Now, Phone = user.UserCode, UserCode = user.UserCode, ImgUrl = "", UserName = "******" + new Random().Next(100000, 999999), MemberDate = DateTime.Parse(strDate) }; api = _dal.Add(dbUser); return(api); }
//添加、修改用户 public bool AddEdit(UserInfo userInfo) { bool iResult = false; if (userInfo.Id > 0) { iResult = userInfoDAL.Edit(userInfo); } else { iResult = userInfoDAL.Add(userInfo); } return(iResult); }
/// <summary> /// 增加新用户 /// </summary> public bool Add(UserInfoModel model, string roleid, string authcommunity, int uid) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into userinfo("); strSql.Append("loginName,password,nickName,mobile,headimg,companyName,departmentName,remark)"); strSql.Append(" values ("); strSql.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');", model.loginName, model.password, model.nickName, model.mobile, model.headimg, model.companyName, model.departmentName, model.remark); strSql.Append(" select last_insert_id() as insertId"); List <string> acclist = new List <string>(); acclist.Add(""); acclist.Add(string.Format("insert into userrolerelative(userID,roleID) values ([@],'{0}')", roleid)); if (string.IsNullOrEmpty(authcommunity)) { acclist.AddRange(new BLL.CommunityInfoBLL().GetCommunity(" and isdel=0 ", uid).Select(s => string.Format("insert into usercommunityrelative(userID,communityID,insertTime) values ([@],{0},'{1}')", s.communityID, DateTime.Now))); } else { acclist.AddRange(authcommunity.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => string.Format("insert into usercommunityrelative(userID,communityID,insertTime) values ([@],{0},'{1}')", s, DateTime.Now))); } return(userinfo_dal.Add(strSql.ToString(), acclist)); }
public bool Add(UserInfo model) { return(userinfodal.Add(model) > 0); }
///<summary> ///新增 ///</summary> /// <param name="model"></param> public bool Add(UserInfoEntity model) { return(dal.Add(model)); }