public string Delete(UsersBLLModel UserInfo) { UserInfoDAL UDAL = new UserInfoDAL(); string ReturnVal = UDAL.Delete(JsonConvert.DeserializeObject <UsersDALModel>(JsonConvert.SerializeObject(UserInfo))); return(ReturnVal); }
public static string GetUserCountByNameAndPwd(string name, string pwd, bool isAdmin) { pwd = MD5Encrypt.GetMD5(pwd); string msg = "登录失败, 没有匹配的记录"; if (isAdmin) { if (UserInfoDAL.SelectUserRole1(name, pwd) == 1) { msg = "登录成功"; } } else { if (UserInfoDAL.SelectUserRole0(name, pwd) == 1) { msg = "登录成功"; } } if (UserInfoDAL.SelectUserEnabled(name) == 0) { msg = "你已被封禁"; } return(msg); }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheck() { bool rbool = true; try { var LoginId = txtLoginId.Text.Trim(); if (LoginId == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "登录名不能为空!", txtLoginId, this); txtLoginId.Text = ""; txtLoginId.Focus(); rbool = false; } Expression <Func <View_UserInfo_D_R_d, bool> > funview_userinfo = n => n.UserLoginId == LoginId; if (UserInfoDAL.Query(funview_userinfo).Count() > 0) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "该用户名已存在", txtLoginId, this); txtLoginId.Focus(); rbool = false;; } return(rbool); } catch (Exception ex) { Common.WriteTextLog("用户管理 btnCheck()" + ex.Message.ToString()); rbool = false; } return(rbool); }
public static Boolean IsValidUser(String email) { ///Declare Object of EmailTemplate Model UserInfoDAL objmodelDal = new UserInfoDAL(); return(objmodelDal.IsValidUser(email)); }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheck() { bool rbool = true; try { var RoleNmae = txtRoleName.Text.Trim(); if (RoleNmae == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "角色名不能为空!", txtRoleName, this); txtRoleName.Text = ""; txtRoleName.Focus(); rbool = false; } Expression <Func <View_UserInfo_D_R_d, bool> > funview_userinfo = n => n.Role_Name == RoleNmae; if (UserInfoDAL.Query(funview_userinfo).Count() > 0) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "该角色已存在", txtRoleName, this); txtRoleName.Focus(); rbool = false;; } return(rbool); } catch (Exception ex) { Common.WriteTextLog("角色管理 btnCheck()" + ex.Message.ToString()); rbool = false; } return(rbool); }
public static t_CM_UserInfo Login(string username, string password, ControllerContext actionContext, out int ErrCode) { ErrCode = 0; t_CM_UserInfo userInf = null; if (!GetLicense()) { ErrCode = -1; return(userInf); } string MD5password = Lib.Base.Encrypt.MD5Encrypt(password); //List<t_CM_UserInfo> list = bll.t_CM_UserInfo.Where(u => u.UserName == username && u.UserPassWord == MD5password).ToList(); IList <IDAO.Models.t_CM_UserInfo> list = UserInfoDAL.getInstance().GetUsers(username, MD5password); if (list.Count > 0) { actionContext.HttpContext.Session["Huerinfo"] = userInf = list[0]; try { HttpCookie cookie = new HttpCookie("myYWAppInf"); //cookie.Expires = DateTime.Now.AddYears(20); cookie.Values.Set("appkey", Lib.Base.Encrypt.MD5Encrypt2(username)); cookie.Values.Add("appu", Lib.Base.Encrypt.MD5Encrypt2(password)); actionContext.HttpContext.Response.SetCookie(cookie); actionContext.HttpContext.Response.Cookies.Add(cookie); } catch (Exception ex) { LogHelper.Warn(ex); } } return(userInf); }
private bool btnCheck() { bool rbool = true; try { var LoginId = txtUserLoginID.Text.Trim(); if (LoginId == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "登录名不能为空!", txtUserLoginID, this); txtUserLoginID.Text = ""; txtUserLoginID.Focus(); rbool = false; } Expression <Func <UserInfo, bool> > funview_userinfo = n => n.UserLoginId == LoginId; if (UserInfoDAL.Query(funview_userinfo).Count() > 0) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "该用户名已存在", txtUserLoginID, this); txtUserLoginID.Focus(); rbool = false;; } return(rbool); } catch { CommonalityEntity.WriteTextLog("用户管理 btnCheck()"); rbool = false; } return(rbool); }
public static UserInfoModel GetUserInfoByID(int id) { UserInfoModel user = new UserInfoModel(); var reader = UserInfoDAL.SelectUserByID(id); if (reader == null) { return(user); } reader.Read(); user.id = reader.GetInt32(0); user.username = reader.GetString(1); user.password = reader.GetString(2); user.role = reader.GetInt32(3); user.reg_date = reader.GetDateTime(4); user.gender = reader.GetInt32(5); user.mail = reader.GetString(6); user.tel = reader.GetString(7); user.enabled = reader.GetInt32(8); user.avatar = reader.GetString(9); user.balance = reader.GetDouble(10); if (!reader.IsClosed) { reader.Close(); } return(user); }
public static object validateLoginAdmin(String username, String password, String CheckRememberme) { UserInfoDAL UMobject = new UserInfoDAL(); object result = UMobject.CheckIfUserExistsInDB(username, UtilityFunctions.EncryptPassword(password)); return(result); }
/// <summary> /// 获取卡相关的用户名 /// </summary> /// <param name="strCardID"></param> private bool GetCardName(string strCardID) { bool rbool = false; try { int userid = 0; Expression <Func <UserInfo, bool> > p = n => n.UserCarId == strCardID.Trim(); UserInfo userinfo = UserInfoDAL.Single(p); if (userinfo != null) { userid = userinfo.UserId; } if (userid > 0) { userInfo = userinfo; HelpClass.GetData.Person = userinfo.UserName; lblCardNO.Text = strCardID; this.ISPass = false; //txtCardID.Text = userinfo.UserName; rbool = true; /* * Expression<Func<RoleInfo, bool>> funroleinfo = n => n.Role_Id == userinfo.User_Role_Id; * foreach (var n in RoleInfoDAL.Query(funroleinfo)) * { * string peri = n.Role_Permission; * //水分管理 * if (peri.Substring(5, 1) == "1") * { * lblName.Text = "姓名"; * HelpClass.GetData.Person = userinfo.UserName; * txtCardID.Text = userinfo.UserName; * txtCardID.UseSystemPasswordChar = false; * txtCardID.Enabled = false; * } * else * { * txtCardID.Text = ""; * MessageBox.Show("请刷有用户关联的卡!", "操作提示", MessageBoxButtons.OK, * MessageBoxIcon.Warning); * } * break; * }*/ } else { ISPass = true; MessageBox.Show("请刷与用户关联的卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { ISPass = true; Common.WriteTextLog("读取卡号异常:" + ex.Message); } return(rbool); }
public List <UserInfo> GetList() { //创建数据层对象 UserInfoDAL userInfoDAL = new UserInfoDAL(); //调用查询方法 return(userInfoDAL.GetList()); }
/// <summary> /// 获取返回请求的数据 /// </summary> private void GetResponseData() { // 获取数据库中用户信息 List <UserInfo> userList = UserInfoDAL.QueryAllUserInfo(); String responseString = JsonConvert.SerializeObject(userList); // 发送返回请求的数据信息 SendRequestMessage(responseString); }
public UserInfo Code(UserInfo obj) { obj = new UserInfoDAL().Code(obj); if (obj != null) { HttpContext.Current.Session["Code"] = obj.Code; } return(obj); }
private void btnEditPwd_Click(object sender, EventArgs e) { if (txtPwd1.Text.Trim().ToLower() != txtpwd2.Text.Trim().ToLower()) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不一致!", txtPwd1, this); txtPwd1.Focus(); return; } if (string.IsNullOrEmpty(txtpwd2.Text.Trim())) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不能为空", txtpwd2, this); txtOlePwd.Focus(); return; } if (string.IsNullOrEmpty(txtOlePwd.Text.Trim())) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不能为空", txtOlePwd, this); txtOlePwd.Focus(); return; } if (LinQBaseDao.Query("select * from UserInfo where userid=" + CommonalityEntity.USERID + "").Tables[0].Rows.Count <= 0) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "登录信息有误,请重新登录!", txtOlePwd, this); GC.Collect(); Application.ExitThread(); Application.Exit(); Process.GetCurrentProcess().Kill(); System.Environment.Exit(System.Environment.ExitCode); Application.ExitThread(); return; } if ((LinQBaseDao.Query("select * from UserInfo where userid=" + CommonalityEntity.USERID + " and UserLoginId='" + CommonalityEntity.USERNAME + "' and UserLoginPwd='" + CommonalityEntity.EncryptDES(txtOlePwd.Text.Trim()) + "'").Tables[0].Rows.Count <= 0)) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码有误!", txtOlePwd, this); txtOlePwd.Focus(); return; } Action <UserInfo> action = n => { n.UserLoginPwd = CommonalityEntity.EncryptDES(txtpwd2.Text.Trim()); }; Expression <Func <UserInfo, bool> > funuser = n => n.UserId == CommonalityEntity.USERID; if (UserInfoDAL.Update(funuser, action) == true)//角色是否修改失败 { MessageBox.Show("密码修改成功!"); txtOlePwd.Text = ""; txtPwd1.Text = ""; txtpwd2.Text = ""; CommonalityEntity.WriteLogData("修改", "用户" + CommonalityEntity.USERNAME + "修改密码", CommonalityEntity.USERNAME);//添加日志 } }
/// <summary> /// 获取推荐用户信息 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static List <BizUserInfo> GetRecommendUserList(long userID) { var lstUser = new UserInfoDAL().GetSameHrefUserList(userID); if (lstUser != null) { return(lstUser.Select(model => new BizUserInfo(model)).ToList()); } return(new List <BizUserInfo>()); }
public CustomDO UpdateUserInfo(UserInfoDO userInfo) { userInfo.EmailId = EncodeItemToBase64(userInfo.EmailId); userInfo.UserMobile = EncodeItemToBase64(userInfo.UserMobile); CustomDO custom = new UserInfoDAL().UpdateUserInfo(userInfo); userInfo.EmailId = DecodeFrom64(userInfo.EmailId); userInfo.UserMobile = DecodeFrom64(userInfo.UserMobile); return(custom); }
public UserInfo Login(UserInfo obj) { obj = new UserInfoDAL().Login(obj); if (obj != null) { HttpContext.Current.Session["UserName"] = obj.userName; HttpContext.Current.Session["UserPhone"] = obj.userPhone; } return(obj); }
public static string SetNewPassword(UserInfoModel user) { string msg = "密码修改失败"; if (UserInfoDAL.UpdateUserPassword(user) > 0) { msg = "密码修改成功"; } return(msg); }
/// <summary> /// 邮箱/用户名搜索用户 /// </summary> /// <param name="nameOrEmail"></param> /// <returns></returns> public static List <BizUserInfo> SearchUserList(string nameOrEmail) { var list = new UserInfoDAL().SearchByNameOrEmail(nameOrEmail); if (list == null || list.Count() == 0) { return(new List <BizUserInfo>()); } return(list.Select(model => new BizUserInfo(model)).ToList()); }
public static string SetNewInfo(UserInfoModel user) { string msg = "个人信息修改失败"; if (UserInfoDAL.UpdateUserInfo(user) > 0) { msg = "个人信息修改成功"; } return(msg); }
public UserInfoDO GetUser(string emailId, string password) { emailId = EncodeItemToBase64(emailId); UserInfoDO userInfo = new UserInfoDAL().GetUser(emailId, password); if (userInfo != null) { userInfo.EmailId = DecodeFrom64(userInfo.EmailId); userInfo.UserMobile = DecodeFrom64(userInfo.UserMobile); } return(userInfo); }
/// <summary> /// 获取推荐用户信息 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static List <BizUserInfo> GetRandomUserList() { Random rm = new Random(DateTime.Now.Millisecond); var length = rm.Next(0, 20); var lstUser = new UserInfoDAL().GetRandomList(0, length); if (lstUser != null) { return(lstUser.Select(model => new BizUserInfo(model)).ToList()); } return(new List <BizUserInfo>()); }
private void update() { try { if (txtOldPwd.Text.Trim() == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不能为空!", txtOldPwd, this); txtOldPwd.Focus(); return; } else { if (txtOldPwd.Text.Trim() != Common.PWD) { mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不正确!", txtOldPwd, this); txtOldPwd.Focus(); return; } } if (txtNewPwd.Text.Trim() == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不能为空!", txtNewPwd, this); txtNewPwd.Focus(); return; } if (txtSurePwd.Text.Trim() == "") { mf.ShowToolTip(ToolTipIcon.Info, "提示", "两次输入的密码不一致,请重新输入!", txtNewPwd, this); txtNewPwd.Text = ""; txtSurePwd.Text = ""; txtNewPwd.Focus(); return; } Expression <Func <UserInfo, bool> > funUserinfo = n => n.UserLoginId == Common.USERNAME; Action <UserInfo> action = n => { n.UserLoginPwd = txtNewPwd.Text.Trim(); }; if (UserInfoDAL.Update(funUserinfo, action)) { MessageBox.Show("密码修改成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("修改失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { Common.WriteTextLog("SetPassWord +update()" + ex.Message.ToString()); } }
public static string UserCredennumSel(int iUID) { string sCredennum = UserInfoDAL.UserCredennumSelByID(iUID); if (string.IsNullOrEmpty(sCredennum) || "" == sCredennum.Trim()) { return(""); } else { return(sCredennum); } }
private void btnAdd_Click() { try { int j = 0; int rint = 0; if (!btnCheck()) { return; } var useradd = new UserInfo { UserLoginId = txtLoginId.Text.Trim(), UserLoginPwd = txtPassword.Text.Trim(), UserName = txtName.Text.Trim(), UserPhone = txtPhone.Text.Trim(), UserAddress = txtAddress.Text.Trim(), //,UserPermission //权限信息 //,UserIdentification //加密狗 UserCarId = txtCardNo.Text.Trim(), UserCreateTime = DateTime.Now, UserCreateName = userCreateName, //创建人 User_Duty_ID = Convert.ToInt32(cobDuty_Name.SelectedValue.ToString()), User_Role_Id = Convert.ToInt32(cmbRole.SelectedValue.ToString()), User_Dictionary_ID = Convert.ToInt32(cbxState.SelectedValue.ToString()), //用户状态 UserRemark = txtRemark.Text.Trim() }; if (UserInfoDAL.InsertOneQCRecord(useradd, out rint)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } string Log_Content = String.Format("用户名称:{0} ", txtLoginId.Text.Trim()); Common.WriteLogData("新增", Log_Content, Common.USERNAME);//添加日志 } catch (Exception ex) { Common.WriteTextLog("用户管理 btnAdd_Click()" + ex.Message.ToString()); MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { page = new PageControl(); page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString(); LoadData(); } }
/// <summary> /// 用户ID获取用户信息 /// </summary> /// <param name="lstUID"></param> /// <returns></returns> public static List <BizUserInfo> GetListByUIDList(List <long> lstUID) { if (lstUID == null || lstUID.Count == 0) { return(new List <BizUserInfo>()); } var list = new UserInfoDAL().GetByUserIDList(lstUID); if (list == null || list.Count() == 0) { return(new List <BizUserInfo>()); } return(list.Select(model => new BizUserInfo(model)).ToList()); }
/// <summary> /// 登录验证。如果登录成功,返回true;否则,返回false /// </summary> /// <param name="userName">用户名</param> /// <param name="password">密码</param> /// <returns>如果登录成功,返回true;否则,返回false</returns> public bool VerifyLogin(string userName, string password) { bool isSuccess = false; UserInfoDAL userDal = new UserInfoDAL(); UserInfo user = userDal.QueryUserByUserName(userName); if (user.UserName != null && user.UserPwd == password) { isSuccess = true; } return(isSuccess); }
/// <summary> ///删除用户信息 /// </summary> private void tbtnDelUser_delete() { try { int j = 0; UserIDSearch = lvwUserList.SelectedRows.Count; if (UserIDSearch > 0)//选中删除 { if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { //选中数量 //遍历 for (int i = 0; i < UserIDSearch; i++) { Expression <Func <UserInfo, bool> > funuserinfo = n => n.UserId == Convert.ToInt32(lvwUserList.SelectedRows[i].Cells["UserID"].Value); if (!UserInfoDAL.DeleteToMany(funuserinfo)) { j++; } else { CommonalityEntity.WriteLogData("删除", "删除用户名为:" + lvwUserList.SelectedRows[i].Cells["UserLoginId"].Value + "的信息", CommonalityEntity.USERNAME);//添加日志 } } if (j == 0) { MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else//没有选中 { MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { CommonalityEntity.WriteTextLog("用户管理 tbtnDelUser_delete()+"); } finally { page = new PageControl(); LoadData();//更新 } }
private void OnLoginButtonDown() { if (UserName.text == "") { Tooltips.text = "账号不能为空"; return; } else if (UserPassWord.text == "") { Tooltips.text = "密码不能为空"; return; } UserInfo userInfo = new UserInfo(); userInfo.UserName = UserName.text; userInfo.UserPwd = UserPassWord.text; UserInfoDAL userInfoDAL = new UserInfoDAL(); string msg; bool result = userInfoDAL.Login(userInfo, out msg); if (result) { Tooltips.text = "登录成功"; GameObject.Find("ScenesManager").GetComponent <GameManager>().Play(2, TrunMenu); } else if (msg == "密码错误") { Tooltips.text = "密码错误"; } else if (msg == "用户已存在") { Tooltips.text = "用户已存在"; } else { int r = userInfoDAL.AddUserInfo(userInfo); if (r == 1) { Tooltips.text = "用户注册成功"; GameObject.Find("ScenesManager").GetComponent <GameManager>().Play(2, TrunMenu); } else { Tooltips.text = "用户注册失败"; } } GameConfig.UserId = userInfoDAL.GetUserID(UserName.text); }
private void btnAdd_Click() { try { if (cmbUserState.SelectedItem == null) { MessageBox.Show("请选择状态!"); return; } int j = 0; int rint = 0; if (!btnCheck()) { return; } var useradd = new UserInfo { UserLoginId = txtUserLoginID.Text.Trim(), //登陆ID UserLoginPwd = CommonalityEntity.EncryptDES(txtPassword.Text.Trim()), //登陆密码 加密 UserName = txtName.Text.Trim(), //姓名 UserPhone = txtPhone.Text.Trim(), //电话 UserAddress = txtAddress.Text.Trim(), //地址 UserCreateTime = DateTime.Now, //创建时间 UserCreateName = CommonalityEntity.USERNAME, //创建人 UserRemark = txtRemark.Text.Trim(), //备注信息 UserSate = cmbUserState.SelectedItem.ToString(), UserRoleID = Convert.ToInt32(cmbRoleUser.SelectedValue), }; if (UserInfoDAL.InsertOneQCRecord(useradd, out rint)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } string Log_Content = String.Format("用户名称:{0} ", txtUserLoginID.Text.Trim()); CommonalityEntity.WriteLogData("新增", "新增" + Log_Content + "的权限", CommonalityEntity.USERNAME);//添加日志 } catch { CommonalityEntity.WriteTextLog("用户管理 btnAdd_Click()" + "".ToString()); MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { page = new PageControl(); //page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString(); LoadData(); } }