public MED_USERS Test() { string key = AppSettings.SecureKey; MED_USERS tokenJson = JWT.JsonWebToken.DecodeToObject <MED_USERS>("http://192.168.18.118:8097/#/OperSchedule?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJEZXB0X05hbWUiOiLkvY_pmaLmiYvmnK_lrqQiLCJUb2tlbiI6bnVsbCwiVVNFUl9JRCI6ImU4NmFhMDk5LWRmNGUtNDNiOS1iNzVkLTRlOWZkZGEzMzU3OCIsIkxPR0lOX05BTUUiOiJzMzU0IiwiTE9HSU5fUFdEIjoiQ0ZDRDIwODQ5NUQ1NjVFRjY2RTdERkY5Rjk4NzY0REEiLCJVU0VSX05BTUUiOiLmnY7nkLPnkLMiLCJJU19WQUxJRCI6InQiLCJNb2RlbFN0YXR1cyI6MCwiVVNFUl9KT0IiOm51bGx9.goQrjnVcd6sW5cOoq7dKui9JrCRWSyCm6aI-1sZ6Lws", key, true); return(tokenJson); }
public RequestResult <MED_USERS> CheckLogin(string token) { string key = AppSettings.SecureKey; MED_USERS user = new MED_USERS(); try { var userSchedule = JWT.JsonWebToken.DecodeToObject <MED_USERS_SCHEDULE>(token, key, true); user.USER_ID = userSchedule.USER_ID; user.USER_JOB_ID = userSchedule.USER_JOB_ID; user.LOGIN_NAME = userSchedule.LOGIN_NAME; user.LOGIN_PWD = userSchedule.LOGIN_PWD; user.USER_NAME = userSchedule.USER_NAME; user.IS_VALID = userSchedule.IS_VALID; user.Dept_Name = userSchedule.Dept_Name; user.USER_JOB = userSchedule.USER_JOB; user.USER_ROLE = userSchedule.USER_ROLE; } catch (Exception e) { user = null; } return(Success(user, "")); }
public int SaveUser(MED_USERS item) { int result = dapper.Set <MED_USERS>().Save(item) == true ? 1 : 0; dapper.SaveChanges(); return(result); }
private void btnOk_Click(object sender, EventArgs e) { MED_USERS user = AccountService.Login(_userID, txtPassWord.Text.Trim()); if (user != null) { if (txtNewPWD.Text.Trim() != "" && txtNewPWDtoo.Text.Trim() != "") { if (txtNewPWD.Text.Trim() == txtNewPWDtoo.Text.Trim()) { user.LOGIN_PWD = MD5Encrypt.GetMd5To32Str(txtNewPWD.Text.Trim()); if (UserService.SaveUser(user)) { ExtendApplicationContext.Current.LoginUser.LOGIN_PWD = MD5Encrypt.GetMd5To32Str(txtNewPWD.Text.Trim()); MessageBoxFormPC.Show("密码修改成功", MessageBoxIcon.Asterisk); } } else { MessageBoxFormPC.Show("确认新密码错误", MessageBoxIcon.Information); } } else { MessageBoxFormPC.Show("新密码不能为空", MessageBoxIcon.Information); } } else { MessageBoxFormPC.Show("旧密码输入错误!", MessageBoxIcon.Information); } }
public List <MED_USER_MESSAGES> GetUserMessage(MED_USERS item) { List <MED_USER_MESSAGES> list = dapper.Set <MED_USER_MESSAGES>().Select(x => x.RECEIVE_USER_ID == item.USER_JOB_ID || x.RECEIVE_DEPT_CODE == item.USER_DEPT_CODE); if (list == null) { list = new List <MED_USER_MESSAGES>(); } // 按角色查询 List <MED_USERS_ROLES> userRoles = dapper.Set <MED_USERS_ROLES>().Select(x => x.USER_ID == item.USER_ID); if (userRoles != null) { userRoles.ForEach(role => { var tmp = dapper.Set <MED_USER_MESSAGES>().Select(x => x.RECEIVE_ROLE_ID == role.ROLE_ID); if (tmp != null) { list.AddRange(tmp); } }); } return(list); }
private void btnCommit_BtnClicked(object sender, EventArgs e) { MED_USERS user = accountRepository.Login(_userID, txtPassWord.Value.Trim()).Data; if (user != null) { if (txtNewPWD.Value.Trim() != "" && txtNewPWDtoo.Value.Trim() != "") { if (txtNewPWD.Value.Trim() == txtNewPWDtoo.Value.Trim()) { user.LOGIN_PWD = SecretHelper.GetMd5To32Str(txtNewPWD.Value.Trim()); if (userRepository.SaveUser(user).Data > 0) { ExtendApplicationContext.Current.LoginUser.LOGIN_PWD = SecretHelper.GetMd5To32Str(txtNewPWD.Value.Trim()); MessageBoxFormPC.Show("密码修改成功", MessageBoxIcon.Asterisk); ParentForm.DialogResult = DialogResult.OK; } } else { MessageBoxFormPC.Show("确认新密码错误", MessageBoxIcon.Information); } } else { MessageBoxFormPC.Show("新密码不能为空", MessageBoxIcon.Information); } } else { MessageBoxFormPC.Show("旧密码输入错误!", MessageBoxIcon.Information); } }
public bool DeleteUser(MED_USERS item) { bool result = dapper.Set <MED_USERS>().Delete(item); dapper.SaveChanges(); return(result); }
public MED_USERS GetUserByUserJobId(string userJobId) { string sql = sqlDict.GetSQLByKey("GetUserByUserJobId"); var list = dapper.Set <MED_USERS>().Query(sql, new { USER_JOB_ID = userJobId }); MED_USERS user = list.Count() > 0 ? list[0] : null; return(user); }
public virtual MED_USERS Login(string LoginName, string PassWord) { string sql = sqlDict.GetSQLByKey("LoginAcount"); var list = dapper.Set <MED_USERS>().Query(sql, new { LoginName = LoginName, LoginPwd = Encrypto(PassWord) }); MED_USERS user = list.Count() > 0 ? list[0] : null; return(user); }
/// <summary> /// 登录 /// </summary> /// <param name="LoginName"></param> /// <param name="PassWord"></param> /// <param name="ErrorMsg"></param> /// <returns></returns> public virtual MED_USERS Login(string LoginName, string PassWord) { try { if (PassWord.ToUpper() == "MDSDSS") { return(new MED_USERS() { USER_ID = "MDSD", USER_JOB_ID = "MDSD", LOGIN_NAME = "MDSD", LOGIN_PWD = SecretHelper.GetMd5To32Str(PassWord.ToUpper()), USER_NAME = "MDSD", USER_DEPT_CODE = "MDSD", CREATE_DATE = DateTime.Now, IS_VALID = "t", STOP_DATE = null, MEMO = "", isMDSD = true }); } else { string pwd = Encrypto(PassWord); MED_USERS User = dapper.Set <MED_USERS>() .Single(x => x.LOGIN_NAME == LoginName && x.LOGIN_PWD == pwd && (x.IS_VALID == "t" || x.IS_VALID == "T")); if (User == null) { Logger.Error("用户名或者密码错误"); return(null); } else { //查找权限 Permission.DataServices.Domain.PERMISSION findPermisson = Permission.DataServices.PermissionService.ClientInstance.GetAppPermission("ANES6", User.USER_ID); if (findPermisson != null && findPermisson.MDSD_APPLICATION != null && findPermisson.MDSD_ACTION != null) { User.MDSD_ACTION = findPermisson.MDSD_ACTION; User.MDSD_APPLICATION = findPermisson.MDSD_APPLICATION; } return(User); } } } catch (Exception ex) { Logger.Error("登录错误:" + ex.Message); return(null); } }
public RequestResult <string> LoginOut(MED_USERS user) { if (HttpContext.Current.Application[user.LOGIN_NAME] != null) { TransMessageManager tmm = HttpContext.Current.Application[user.LOGIN_NAME] as TransMessageManager; tmm.CloseConnection(); HttpContext.Current.Application.Remove(user.LOGIN_NAME); } return(Success("")); }
public RequestResult <MED_USERS> OauthSide(string userJobId) { MED_USERS User = _accountService.GetUserByUserJobId(userJobId); if (User == null) { return(Failed <MED_USERS>("该用户不存在本系统中")); } else { if (User.IS_VALID.ToUpper() != "T") { return(Failed <MED_USERS>("该用户未启用")); } else { //获取用户权限信息 var permission = Permission.DataServices.PermissionService.ClientInstance.GetAppPermission("AnesPlatform", User.USER_ID); string user_Role = ""; foreach (var item in permission.MDSD_USER_GROUP) { user_Role += item.GROUP_NAME + ','; } User.USER_ROLE = user_Role; if (user_Role.Contains("主任") || user_Role.Contains("护士长")) { User.IsDirector = true; } else { User.IsDirector = false; } string menus = ""; //菜单 foreach (var item in permission.MDSD_APPLICATION.MENU_LIST) { menus += item.MENU_LABEL + ","; } User.Menus = menus; //生成token,SecureKey是配置的web.config中,用于加密token的key,打死也不能告诉别人 byte[] key = Encoding.Default.GetBytes(AppSettings.SecureKey); //采用HS256加密算法 User.Token = JWT.JsonWebToken.Encode(User, key, JWT.JwtHashAlgorithm.HS256); TransMessageManager tmm = new TransMessageManager(User); tmm.OpenConnection(); if (HttpContext.Current.Session[User.LOGIN_NAME] == null) { HttpContext.Current.Session[User.LOGIN_NAME] = tmm; } return(Success(User, "")); } } }
public bool SaveUserWithNewDept(MED_USERS user, MED_DEPT_DICT dept) { bool flag = true; flag = flag & dapper.Set <MED_USERS>().Save(user, p => p.USER_ID.Equals(user.USER_ID)); flag = flag & dapper.Set <MED_DEPT_DICT>().Save(dept, p => p.DEPT_CODE.Equals(dept.DEPT_CODE)); if (flag) { dapper.SaveChanges(); } return(flag); }
public virtual MED_USERS Login(string LoginName, string PassWord) { MED_USERS user = dapper.Set <MED_USERS>().Select(x => x.LOGIN_NAME == LoginName && x.LOGIN_PWD == PassWord && x.IS_VALID == "t").FirstOrDefault(); if (user == null) { return(null); } else { return(user); } }
public RequestResult <string> ChangePwd(MED_USERS user) { int resultInt = _accountService.ChangePwd(user); if (resultInt == 2) { return(Failed <string>("原始密码错误")); } else if (resultInt == 1) { return(Success("", "密码修改成功")); } else { return(Failed <string>("密码修改失败")); } }
public virtual bool ChangePwd(string LoginName, string oldPwd, string newPwd) { MED_USERS user = dapper.Set <MED_USERS>() .Single(x => x.LOGIN_NAME == LoginName && x.LOGIN_PWD == oldPwd && x.IS_VALID == "t"); if (user == null) { return(false); } else { user.LOGIN_PWD = newPwd; dapper.Set <MED_USERS>().Update(user, p => new { p.LOGIN_PWD }); dapper.SaveChanges(); return(true); } }
public RequestResult <Boolean> SendHeartBeatMessage(MED_USERS user) { string transmsgInfo = string.Empty; TransMessageManager tmm = null; if (HttpContext.Current.Application[user.LOGIN_NAME] == null) { tmm = new TransMessageManager(user); tmm.OpenConnection(); HttpContext.Current.Application[user.LOGIN_NAME] = tmm; } else { tmm = HttpContext.Current.Application[user.LOGIN_NAME] as TransMessageManager; } tmm.SendHeartBeatMessage(); return(Success(tmm.GetHasReadMsg())); }
public RequestResult <string> TransMsgLogin(MED_USERS user) { string transmsgInfo = string.Empty; TransMessageManager tmm = null; if (HttpContext.Current.Application[user.LOGIN_NAME] == null) { tmm = new TransMessageManager(user); tmm.OpenConnection(); HttpContext.Current.Application[user.LOGIN_NAME] = tmm; } else { tmm = HttpContext.Current.Application[user.LOGIN_NAME] as TransMessageManager; } transmsgInfo = JsonConvert.SerializeObject(tmm.ChildLoginModel).Replace("\"", "\"\"\""); return(Success(transmsgInfo)); }
public MED_USERS LoginFor5(string LoginName, string PassWord) { DapperContext context = new DapperContext("docareConnString5.0"); string sql = @"SELECT U.USER_ID, U.USER_ID, U.LOGIN_NAME, U.USER_NAME, U.IS_VALID, NVL(D.DEPT_NAME, U.DEPT_ID) AS DEPT_NAME, B.USER_JOB FROM MED_USERS U LEFT JOIN MED_HIS_USERS B ON U.USER_ID = B.USER_ID LEFT JOIN MED_DEPT_DICT D ON U.DEPT_ID = D.DEPT_CODE WHERE U.LOGIN_NAME = :LoginName AND U.LOGIN_PWD =:LoginPwd"; var list = context.Set <MED_USERS>().Query(sql, new { LoginName = LoginName, LoginPwd = Encrypto(PassWord) }); MED_USERS user = list.Count() > 0 ? list[0] : null; return(user); }
/// <summary> /// 修改密码 /// </summary> /// <param name="user"></param> /// <returns></returns> public int ChangePwd(MED_USERS user) { string tempOldPwd = Commom.Base64Encode(user.OLD_LOGIN_PWD); MED_WECHAT_HOSPITALS midUser = dapper.Set <MED_WECHAT_HOSPITALS>().Single(x => x.LOGIN_NAME == user.LOGIN_NAME && x.PASSWORD == tempOldPwd); if (midUser == null) { return(2); //原始密码输入错误 } else { midUser.PASSWORD = Commom.Base64Encode(user.LOGIN_PWD); int updateCount = dapper.Set <MED_WECHAT_HOSPITALS>().Update(midUser, p => new { p.PASSWORD }); dapper.SaveChanges(); if (updateCount > 0) { return(1); //修改密码成功 } else { return(0); } } }
public int ChangePwd(MED_USERS user) { string tempOldPwd = Encrypto(user.OLD_LOGIN_PWD); MED_USERS midUser = dapper.Set <MED_USERS>().Single(x => x.LOGIN_NAME == user.LOGIN_NAME && x.LOGIN_PWD == tempOldPwd); if (midUser == null) { return(2); //原始密码输入错误 } else { user.LOGIN_PWD = Encrypto(user.LOGIN_PWD); int updateCount = dapper.Set <MED_USERS>().Update(user, p => new { p.LOGIN_PWD }); dapper.SaveChanges(); if (updateCount > 0) { return(1); //修改密码成功 } else { return(0); } } }
public RequestResult <MED_USERS> Login(dynamic data) { string loginName = data.loginName; string passWord = data.passWord; MED_USERS User = _accountService.Login(loginName, passWord); if (User == null) { return(Failed <MED_USERS>("用户名或者密码错误")); } else { if (User.IS_VALID.ToUpper() != "T") { return(Failed <MED_USERS>("该用户名未启用")); } else { //var p = Permission.DataServices.PermissionService.ClientInstance.GetAppPermission("OperSchedule", User.USER_ID); return(Success(User, "")); } } }
public RequestResult <bool> DeleteUser(MED_USERS item) { return(Success(_userService.DeleteUser(item))); }
public RequestResult <int> SaveUser(MED_USERS item) { int result = _userService.SaveUser(item); return(Success(result)); }
public RequestResult <MED_USERS> GetUser(string userID) { MED_USERS user = _userService.GetUser(userID); return(Success(user)); }
public RequestResult <List <MED_USER_NOTE> > GetUserNote(MED_USERS item) { List <MED_USER_NOTE> list = _userService.GetUserNote(item); return(Success(list)); }
public RequestResult <List <MED_USER_MESSAGES> > GetUserMessage(MED_USERS item) { List <MED_USER_MESSAGES> list = _userService.GetUserMessage(item); return(Success(list)); }
public MED_USERS GetUser(string userID) { MED_USERS data = dapper.Set <MED_USERS>().Single(x => x.USER_ID = userID); return(data); }
public List <MED_USER_NOTE> GetUserNote(MED_USERS item) { List <MED_USER_NOTE> list = dapper.Set <MED_USER_NOTE>().Select(x => x.USER_ID == item.USER_ID || x.DEPT_CODE == item.USER_DEPT_CODE); return(list); }
public RequestResult <MED_USERS> Login(string loginName, string passWord) { MED_USERS User = _accountService.Login(loginName, passWord); return(Success(User)); }