Esempio n. 1
0
        /// <summary>
        /// 取指定岗位下的所有角色
        /// </summary>
        /// <param name="_postid"></param>
        /// <returns></returns>
        public static List <SinoRole> Get_RolesOfGW(string _postid)
        {
            string _sql = string.Format(" select a.jsid,a.jsmc,a.jssm,a.ssdwid from qx2_gwjsgxb t,qx_jsdyb a ");

            _sql += string.Format("where a.jsid = t.jsid and t.gwid = :GWID");
            SqlParameter[] _param =
            {
                new SqlParameter(":GWID", SqlDbType.Decimal),
            };
            _param[0].Value = decimal.Parse(_postid);

            List <SinoRole> roles = new List <SinoRole>();

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

            while (dr.Read())
            {
                SinoRole _sr = RightFunctions.CreateRoleItem(dr.GetDecimal(0).ToString(),
                                                             dr.IsDBNull(1) ? "" : dr.GetString(1),
                                                             dr.IsDBNull(2) ? "" : dr.GetString(2),
                                                             dr.IsDBNull(3) ? "" : dr.GetDecimal(3).ToString()
                                                             );
                roles.Add(_sr);
            }
            dr.Close();

            return(roles);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        /// <summary>
        /// 取用户的角色
        /// </summary>
        /// <param name="yhid"></param>
        /// <returns></returns>
        public static ArrayList Get_RoleByYHID(string yhid)
        {
            string _sql = string.Format(" select a.jsid,a.jsmc,a.jssm,a.ssdwid from qx_yhjsgxb t,qx_jsdyb a ");

            _sql += string.Format("where a.jsid = t.jsid and yhid = {0}", yhid);
            DataTable _dt   = SqlHelper.Get_Data(_sql, "ROLES");
            ArrayList roles = new ArrayList();

            foreach (DataRow _dr in _dt.Rows)
            {
                SinoRole _sr = RightFunctions.CreateRoleItem(_dr);
                roles.Add(_sr);
            }
            return(roles);
        }