Exemplo n.º 1
0
 public SiteGroupCms.Entity.Role GetEntity(int _roleid)
 {
     SiteGroupCms.Entity.Role role = new SiteGroupCms.Entity.Role();
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_roleinfo] WHERE [id]=" + _roleid;
         DataTable dt = _doh.GetDataTable();
         SiteGroupCms.Dal.RightDal rightdal = new RightDal();
         SiteGroupCms.Entity.Right right    = new SiteGroupCms.Entity.Right();
         if (dt.Rows.Count > 0)
         {
             role.Title       = dt.Rows[0]["role"].ToString();
             role.Id          = _roleid;
             role.Rights      = dt.Rows[0]["rights"].ToString();
             role.Sort        = Str2Int(dt.Rows[0]["sort"].ToString());
             role.Description = dt.Rows[0]["description"].ToString();
             string[] strs = role.Rights.Split(',');
             for (int i = 0; i < strs.Length - 1; i++)
             {
                 role.Righttitle += rightdal.GetEntity(Str2Int(strs[i])).Title + ";";
             }
         }
     }
     return(role);
 }
Exemplo n.º 2
0
        public string Getrighttitle(int _roleid)
        {
            string   str      = "";
            string   returns  = "";
            RightDal rightdal = new RightDal();

            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.SqlCmd = "SELECT * FROM [yy_roleinfo] WHERE [id]=" + _roleid;
                DataTable dt = _doh.GetDataTable();
                if (dt.Rows.Count > 0)
                {
                    str = dt.Rows[0]["rights"].ToString();
                    string[] strs = str.Split(',');
                    for (int i = 0; i < strs.Length - 1; i++)
                    {
                        returns += rightdal.GetEntity(Str2Int(strs[i])).Title + "  ,";
                    }
                }
            }
            return(returns);
        }