Example #1
0
        /// <summary>
        /// 更新照片(签名照片和人员照片)
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public bool UpdatePhoto(UserInfoData userInfo)
        {
            //sql = "update 影像用户信息 set 签名图片=empty_blob(), 人员照片=empty_blob() where 用户ID=:用户ID";
            //sql = SqlHelper.GetSqlBiz().GetSqlContext("清除科室用户图形", sql);
            //_dbHelper.ExecuteSQL(sql, new SqlParamInfo[] { new SqlParamInfo("用户ID", DbType.String, userInfo.用户ID) });

            if (userInfo.签名图片 != null)
            {
                SQL sqlSignPhoto = CreateSQL("更新科室用户签名图片", "update 影像用户信息 set 签名图片=:签名图片 where 用户ID=:用户ID");

                sqlSignPhoto.AddParameter("签名图片", DbType.Binary, SqlHelper.ImageToBinary(userInfo.签名图片));
                sqlSignPhoto.AddParameter("用户ID", DbType.String, userInfo.用户ID);

                sqlSignPhoto.ExecuteSql();
            }


            if (userInfo.人员照片 != null)
            {
                SQL sqlUserPhoto = CreateSQL("更新科室用户人员照片", "update 影像用户信息 set 人员照片=:人员照片 where 用户ID=:用户ID");

                sqlUserPhoto.AddParameter("人员照片", DbType.Binary, SqlHelper.ImageToBinary(userInfo.人员照片));
                sqlUserPhoto.AddParameter("用户ID", DbType.String, userInfo.用户ID);

                sqlUserPhoto.ExecuteSql();
            }

            return(true);
        }
Example #2
0
 private SqlParamInfo[] GetUserInfoPars(UserInfoData userInfo)
 {
     return(new SqlParamInfo[] {
         new SqlParamInfo("用户ID", DbType.String, userInfo.用户ID),
         new SqlParamInfo("系统账号", DbType.String, userInfo.系统账号),
         new SqlParamInfo("用户名称", DbType.String, userInfo.用户名称),
         new SqlParamInfo("职称级别", DbType.Int32, userInfo.职称级别),
         new SqlParamInfo("账号信息", DbType.String, userInfo.账号信息.ToString()),
         new SqlParamInfo("人员信息", DbType.String, userInfo.人员信息.ToString())
     });
 }
Example #3
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="hisServerData"></param>
        public void UpdateUserInfo(UserInfoData userInfo, UserReleationData userReleation)
        {
            //添加事务处理
            _dbHelper.TransactionBegin();
            try
            {
                string sql = "Update 影像用户信息 " +
                             " Set 系统账号=:系统账号, 用户名称=:用户名称, 职称级别=:职称级别, 账号信息=:账号信息,人员信息=:人员信息" + //,变更日志=:变更日志 " +
                             " where 用户ID=:用户ID ";
                sql = SqlHelper.GetSqlBiz().GetSqlContext("更新科室用户信息", sql);

                SqlParamInfo[] sqlPars = new SqlParamInfo[] { new SqlParamInfo("系统账号", DbType.String, userInfo.系统账号),
                                                              new SqlParamInfo("用户名称", DbType.String, userInfo.用户名称),
                                                              new SqlParamInfo("职称级别", DbType.Int32, userInfo.职称级别),
                                                              new SqlParamInfo("账号信息", DbType.String, userInfo.账号信息.ToString()),
                                                              new SqlParamInfo("人员信息", DbType.String, userInfo.人员信息.ToString()),
                                                              //new SqlParamInfo("变更日志", DbType.String, JsonHelper.SerializeObject(userInfo.变更日志)),
                                                              new SqlParamInfo("用户ID", DbType.String, userInfo.用户ID) };

                _dbHelper.ExecuteSQL(sql, sqlPars);


                //更新角色关联
                if (userReleation != null)
                {
                    sql = "update 影像用户关联 " +
                          " set 角色ID=:角色ID " +
                          " where 用户ID=:用户ID and 科室ID=:科室ID";
                    sql = SqlHelper.GetSqlBiz().GetSqlContext("更新科室用户关联", sql);

                    sqlPars = new SqlParamInfo[] { new SqlParamInfo("角色ID", DbType.String, userReleation.角色ID),
                                                   new SqlParamInfo("用户ID", DbType.String, userInfo.用户ID),
                                                   new SqlParamInfo("科室ID", DbType.String, userReleation.科室ID) };

                    _dbHelper.ExecuteSQL(sql, sqlPars);
                }


                //更新照片
                UpdatePhoto(userInfo);
                _dbHelper.TransactionCommit();
            }
            catch (Exception ex)
            {
                _dbHelper.TransactionRollback();
                throw new Exception("保存账户信息失败", ex);
            }
        }
Example #4
0
        public UserInfoData GetUserInfoByUserID(string userId)
        {
            SQL sql = SqlHelper.CreateSQL("根据用户ID查询影像用户信息", "select 用户ID,系统账号, 用户名称, 职称级别, 账号信息, 人员信息, 人员照片, 签名图片,变更日志 from 影像用户信息 where 用户ID=:用户ID");

            sql.AddParameter("用户ID", System.Data.DbType.String, userId);

            DataTable dtUser = _dbHelper.ExecuteSQL(sql);

            if (dtUser == null || dtUser.Rows.Count <= 0)
            {
                return(null);
            }

            UserInfoData result = new UserInfoData();

            result.BindRowData(dtUser.Rows[0]);

            return(result);
        }
Example #5
0
        /// <summary>
        /// 根据名称获取用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        public UserInfoData GetUserInfoByUserName(string userName, string departmentId)
        {
            SQL sql = SqlHelper.CreateSQL("根据用户账号查询影像用户信息", "select a.用户ID,a.系统账号, a.用户名称, a.职称级别, a.账号信息, a.人员信息, a.人员照片, a.签名图片,a.变更日志 " +
                                          " from 影像用户关联 a, 影像用户信息 b where a.用户ID=b.用户ID and a.科室ID=:科室ID and b.用户名称=:用户名称");

            sql.AddParameter("用户名称", System.Data.DbType.String, userName);
            sql.AddParameter("科室ID", System.Data.DbType.String, departmentId);

            DataTable dtUser = _dbHelper.ExecuteSQL(sql);

            if (dtUser == null || dtUser.Rows.Count <= 0)
            {
                return(null);
            }

            UserInfoData result = new UserInfoData();

            result.BindRowData(dtUser.Rows[0]);

            return(result);
        }
Example #6
0
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="hisServerData"></param>
        /// <returns></returns>
        public bool NewUser(UserInfoData userInfo, UserReleationData userReleation)
        {
            //添加事务处理
            _dbHelper.TransactionBegin();
            try
            {
                string sql = "insert into " +
                             " 影像用户信息(用户ID, 系统账号, 用户名称, 职称级别,账号信息, 人员信息, 签名图片, 人员照片) " +
                             " values " +
                             " (:用户ID, :系统账号,  :用户名称, :职称级别, :账号信息, :人员信息, empty_blob(), empty_blob())";
                sql = SqlHelper.GetSqlBiz().GetSqlContext("插入科室用户信息", sql);

                SqlParamInfo[] sqlPars = GetUserInfoPars(userInfo);

                DataTable dtResult = _dbHelper.ExecuteSQL(sql, sqlPars);

                if (userReleation != null)
                {
                    //创建用户关联
                    sql = "insert into " +
                          " 影像用户关联(用户关联ID, 用户ID, 科室ID, 角色ID ) " +
                          " values " +
                          " (:用户关联ID, :用户ID, :科室ID, :角色ID) ";
                    sql = SqlHelper.GetSqlBiz().GetSqlContext("插入科室用户关联", sql);

                    SqlParamInfo[] sqlReleationPars = GetUserReleationPars(userReleation);
                    dtResult = _dbHelper.ExecuteSQL(sql, sqlReleationPars);
                }

                UpdatePhoto(userInfo);
                _dbHelper.TransactionCommit();
                return(true);
            }catch (Exception ex)
            {
                _dbHelper.TransactionRollback();
                throw new Exception("添加账户失败", ex);
            }
        }
Example #7
0
        /// <summary>
        /// 开始认证
        /// </summary>
        /// <param name="user"></param>
        /// <param name="pwd"></param>
        /// <param name="attachInfo"></param>
        /// <param name="strErr"></param>
        /// <returns></returns>
        public ILoginUser StartVerify(string userAccount, string pwd, out string attachInfo, out string strErr)
        {
            attachInfo = "";
            strErr     = "";

            //验证用户是否有效
            UserModel    um       = new UserModel(_dbQuery);
            UserInfoData userData = um.GetUserInfoByAccountName(userAccount);

            if (userData == null)
            {
                if (_isSettingTools == false)
                {
                    MessageBox.Show("未检索到对应用户信息,不能进行登录。", "提示");
                    return(null);
                }
                else
                {
                    //登录系统配置设置
                    if (userAccount.Equals(UserModel.ADMIN_NAME))
                    {
                        UserData adminUser = new UserData();

                        adminUser.UserId  = UserModel.ADMIN_ID;
                        adminUser.Name    = "管理员";
                        adminUser.Account = userAccount;
                        adminUser.Level   = 0;

                        return(adminUser);
                    }
                    else
                    {
                        MessageBox.Show("不能识别的账号,不能进行登录。", "提示");
                        return(null);
                    }
                }
            }

            if (_isSettingTools == true)
            {
                if (userData.用户ID.Equals(UserModel.ADMIN_ID) == false)
                {
                    MessageBox.Show("非管理员账号,不能进行登录。", "提示");
                    return(null);
                }
            }

            //用户密码判断
            if (UserModel.DecryPwd(userData.账号信息.密码).Equals(pwd) == false)
            {
                MessageBox.Show("密码输入错误,不能进行登录。", "提示");
                return(null);
            }

            UserInfoData userInfo = um.GetUserInfoByAccountName(userAccount);

            if (userInfo == null)
            {
                MessageBox.Show("未获取到对应的用户信息。", "提示");
                return(null);
            }

            UserData loginUser = new UserData();

            loginUser.UserId  = userInfo.用户ID;
            loginUser.Account = userInfo.系统账号;
            loginUser.Name    = userInfo.用户名称;
            loginUser.Level   = userInfo.职称级别;
            loginUser.SignImg = userInfo.签名图片;
            loginUser.Pwd     = pwd;

            loginUser.AssistUserInfo1.Account = userInfo.系统账号;
            loginUser.AssistUserInfo1.Name    = userInfo.用户名称;
            loginUser.AssistUserInfo1.UserId  = userInfo.用户ID;
            loginUser.AssistUserInfo1.SignImg = userInfo.签名图片;

            loginUser.AssistUserInfo2.Account = userInfo.系统账号;
            loginUser.AssistUserInfo2.Name    = userInfo.用户名称;
            loginUser.AssistUserInfo2.UserId  = userInfo.用户ID;
            loginUser.AssistUserInfo2.SignImg = userInfo.签名图片;

            loginUser.AssistUserInfo3.Account = userInfo.系统账号;
            loginUser.AssistUserInfo3.Name    = userInfo.用户名称;
            loginUser.AssistUserInfo3.UserId  = userInfo.用户ID;
            loginUser.AssistUserInfo3.SignImg = userInfo.签名图片;


            return(loginUser);
        }