public void AddAuthority(XObject subject, XObject target , AuthorityType authorityType, AuthorityValue authorityValue) { Command.DbHelper.AddInput("@operation", 1, SqlDbType.Int); Command.DbHelper.AddInput("@subjectzType", subject?.XObjectType, SqlDbType.Int); Command.DbHelper.AddInput("@subjectz", subject?.Id, SqlDbType.Int); Command.DbHelper.AddInput("@targetzType", target?.XObjectType, SqlDbType.Int); Command.DbHelper.AddInput("@targetz", target?.Id, SqlDbType.Int); Command.DbHelper.AddInput("@authorityType", (int)authorityType, SqlDbType.Int); Command.DbHelper.AddInput("@authorityValue", (int)authorityValue, SqlDbType.Int); Command.DbHelper.StoredProcedure("p_AuthorityManager"); }
public List <XObject> GetAuthorizedObjectList(XObject subject, int targetType , AuthorityType authorityType, AuthorityValue authorityValue) { List <XObject> targets = new List <XObject>(); DataSet ds = new DataSet(); Command.DbHelper.AddInput("@operation", 4, SqlDbType.Int); Command.DbHelper.AddInput("@subjectzType", subject.XObjectType, SqlDbType.Int); Command.DbHelper.AddInput("@subjectz", subject.Id, SqlDbType.Int); Command.DbHelper.AddInput("@targetzType", targetType, SqlDbType.Int); Command.DbHelper.AddInput("@authorityType", (int)authorityType, SqlDbType.Int); Command.DbHelper.AddInput("@authorityValue", (int)authorityValue, SqlDbType.Int); Command.DbHelper.StoredProcedure("p_AuthorityManager", ds); foreach (DataRow r in ds.Tables[0].Rows) { Dictionary <string, object> dictionary = ToDictionary(ds.Tables[0].Rows[0]); XObject obj = new XObject(targetType, dictionary); targets.Add(obj); } return(targets); }