/// <summary> /// 插入权限 /// </summary> /// <param name="resource"></param> /// <returns></returns> public int Insert(Neusoft.HISFC.BizLogic.Privilege.Model.Priv resource) { //using (DaoManager _dao = new DaoManager()) //{ //AbstractSqlModel _sql = new SqlModel("Security.Resource.Insert"); //_sql["resourceid"] = resource.Id; //_sql["resourcename"] = resource.Name; //_sql["parentid"] = resource.ParentId; //_sql["resourcetype"] = resource.Type; //_sql["description"] = resource.Description; //DbCommand _command = _dao.DataConnection.CreateTextCommand(); //SqlMapping _mapping = new Neusoft.Framework.DataAccess.SqlMapping.SqlMapping(_dao, _sql); //_mapping.Mapper(_command); //return _command.ExecuteNonQuery(); //} string[] args = new string[] { resource.Id, resource.Name, resource.ParentId, resource.Type, resource.Description }; string sql = ""; if (this.Sql.GetSql("SECURITY.MENU.INSERT", ref sql) == -1) { return(-1); } try { sql = string.Format(sql, args); } catch (Exception ex) { this.Err = ex.Message; return(-1); } if (this.ExecNoQuery(sql) <= 0) { return(-1); } return(0); }
/// <summary> /// 撤销权限 /// </summary> /// <param name="ResourceType"></param> /// <param name="role"></param> /// <param name="resource"></param> /// <returns></returns> public int Revoke(string ResourceType, Neusoft.HISFC.BizLogic.Privilege.Model.Role role, Neusoft.HISFC.BizLogic.Privilege.Model.Priv resource) { // LoadPermissionProvider(); PermissionFactory.LoadPermissionProvider(); ResourceType _resType = GetResourceTypeByID(ResourceType); if (_resType == null) { throw new Exception("没有类型为:" + ResourceType + "的资源!"); } return(GetPermissionProviderByResType(_resType).Revoke(role, resource)); }