Beispiel #1
0
        /// <summary>
        /// 取指定岗位下的指定类型的授权
        /// </summary>
        /// <param name="postid"></param>
        /// <param name="_qxlx"></param>
        /// <returns></returns>
        public static Dictionary <string, UserRightItem> GetRightsOfPost(string postid, string _qxlx)
        {
            Dictionary <string, UserRightItem> _ret = new Dictionary <string, UserRightItem>();
            DataTable _dt = new DataTable();

            using (SqlConnection cn = SqlHelper.OpenConnection())
            {
                SqlCommand _cmd = new SqlCommand();
                _cmd.CommandText = "zhtj_zzjg2.Get_GWCZQX_OWN";
                _cmd.CommandType = CommandType.StoredProcedure;
                _cmd.Connection  = cn;

                SqlParameter _p1 = _cmd.Parameters.Add("ngwid", SqlDbType.Decimal);
                _p1.Value = decimal.Parse(postid);

                SqlParameter _p2 = _cmd.Parameters.Add("strqxlx", SqlDbType.NVarChar, 1000);
                _p2.Value = _qxlx;

                //_cmd.Parameters.Add("curQXDW", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);

                SqlDataAdapter _adapter = new SqlDataAdapter(_cmd);
                _adapter.Fill(_dt);
                cn.Close();
            }
            foreach (DataRow _dr in _dt.Rows)
            {
                UserRightItem _item = RightFunctions.CreateUserRightItem(_dr);
                _ret.Add(_item.Right.RightID, _item);
            }
            return(_ret);
        }
Beispiel #2
0
        /// <summary>
        /// 获取超级管理员信息
        /// </summary>
        /// <returns></returns>
        public static SinoUser GetAdminInfo()
        {
            SinoUser _su = new SinoUser();

            _su.LoginName   = "administrator";
            _su.Dwdm        = "";
            _su.DwID        = "";
            _su.DwName      = "";
            _su.UserID      = "0";
            _su.UserName    = "******";
            _su.SecretLevel = 1000;
            _su.QxszJB      = "直属海关级";
            _su.Posts       = new List <SinoPost>();

            SinoPost _adminPost = new SinoPost();

            _adminPost.PostID   = "0";
            _adminPost.PostName = "超级管理员";
            _adminPost.PostDwID = ConfigFile.SytemDWRootID;
            _adminPost.Rights   = new Dictionary <string, UserRightItem>();

            StringBuilder _sb = new StringBuilder();

            _sb.Append("SELECT dbo.GETDWDM_hgjs(@DWID) dwdm,dbo.GETDWMC(@DWID2) DWMC ");
            //_sb.Append("FROM DUAL ");
            SqlParameter[] _param =
            {
                new SqlParameter("@DWID",  SqlDbType.Decimal),
                new SqlParameter("@DWID2", SqlDbType.Decimal),
            };
            _param[0].Value = decimal.Parse(_adminPost.PostDwID);
            _param[1].Value = decimal.Parse(_adminPost.PostDwID);

            SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringProfile, CommandType.Text,
                                                       _sb.ToString(), _param);

            while (dr.Read())
            {
                _adminPost.PostDWDM = dr.IsDBNull(0) ? "" : dr.GetString(0);
                _adminPost.PostDWMC = dr.IsDBNull(1) ? "" : dr.GetString(1);
            }
            dr.Close();

            //取权限
            DataTable _dt = GetUserRightsByYHID(_su.UserID, "");

            foreach (DataRow _row in _dt.Rows)
            {
                UserRightItem _rightItem = RightFunctions.CreateUserRightItem(_row);
                _adminPost.Rights.Add(_rightItem.Right.RightID, _rightItem);
            }
            _adminPost.SecretLevel = 1000;
            _su.Posts.Add(_adminPost);
            _su.DefaultPost = _adminPost;
            _su.CurrentPost = _adminPost;
            return(_su);
        }