public List<RoleExtension> GetRoleExtensions()
 {
     List<RoleExtension> data=new List<RoleExtension>();
     using(DataCommand cmd=DataCommandManager.GetDataCommand("GetRolePermission"))
     {
         using(IDataReader dr=cmd.ExecuteDataReader())
         {
             while (dr.Read())
             {
                 RoleExtension model=new RoleExtension();
                 if (!Convert.IsDBNull(dr["RoleId"]))
                 {
                     model.RoleId = Convert.ToInt32(dr["RoleId"]);
                 }
                 if (!Convert.IsDBNull(dr["RoleName"]))
                 {
                     model.RoleName = dr["RoleName"].ToString();
                 }
                 if (!Convert.IsDBNull(dr["PermissionId"]))
                 {
                     model.PermissionId = Convert.ToInt32(dr["PermissionId"]);
                 }
                 if (!Convert.IsDBNull(dr["Fullname"]))
                 {
                     model.PermissionName = dr["Fullname"].ToString();
                 }
                 if (!Convert.IsDBNull(dr["Code"]))
                 {
                     model.PermissionCode = dr["Code"].ToString();
                 }
                 data.Add(model);
             }
         }
     }
     return data;
 }
 public RoleExtension GetRoleExtensionByRoleId(int roleId)
 {
     RoleExtension model = new RoleExtension();
     using (DataCommand cmd = DataCommandManager.GetDataCommand("GetRolePermissionByRoleId"))
     {
         cmd.SetParameterValue("@RoleId", roleId);
         using (IDataReader dr = cmd.ExecuteDataReader())
         {
             while (dr.Read())
             {
                 if (Convert.IsDBNull(dr["RoleId"]))
                 {
                     model.RoleId = Convert.ToInt32(dr["RoleId"]);
                 }
                 if (Convert.IsDBNull(dr["RoleName"]))
                 {
                     model.RoleName = dr["RoleName"].ToString();
                 }
                 if (Convert.IsDBNull(dr["PermissionId"])) {
                     model.PermissionId = Convert.ToInt32(dr["PermissionId"]);
                 }
                 if (Convert.IsDBNull(dr["Fullname"])) {
                     model.PermissionName = dr["Fullname"].ToString();
                 }
                 if (Convert.IsDBNull(dr["Code"])) {
                     model.PermissionCode = dr["Code"].ToString();
                 }
             }
         }
     }
     return model;
 }