Ejemplo n.º 1
0
        public static SysUserGroupCollection get_Groups(SysUser _user)
        {
            SysUserGroup           grp    = new SysUserGroup();
            SysUserSysUserGroup    sugrp  = new SysUserSysUserGroup();
            SysUserGroupCollection result = new SysUserGroupCollection();

            string sql = "SELECT grp.* FROM " + grp.get_table() + " AS grp";

            sql += "   INNER JOIN " + sugrp.get_table() + " AS sugrp";
            sql += "     ON grp.id = sugrp.sysuser_group_id";
            sql += " WHERE sugrp.sysuser_id = @sysuser_id";

            grp.query.AddParameter("@sysuser_id", _user.id);
            DataTable dt = grp.query.get_DataTable(sql);

            foreach (DataRow row in dt.Rows)
            {
                grp = new SysUserGroup();
                grp.LoadBy_array(row);

                result.Add(grp);
            }

            return(result);
        }
Ejemplo n.º 2
0
 public bool BelongsToGroup(SysUserGroup _group)
 {
     return(groups.Contains(_group));
 }