Esempio n. 1
0
        public static RoleM[] GetAllRoles()
        {
            DatabaseCall dbc = new DatabaseCall("Roles_BrowseAll", DBCallType.Select);

            System.Data.DataSet ds = new System.Data.DataSet();
            dbc.Fill(ds);

            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                return(new RoleM[0]);
            }
            else
            {
                RoleM[] roles = new RoleM[(ds.Tables[0].Rows.Count)];
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    int    roleID   = Convert.ToInt32(ds.Tables[0].Rows[i]["RoleID"]);
                    string roleName = ds.Tables[0].Rows[i]["Name"].ToString();
                    roles[i] = new RoleM(roleID, roleName);
                }
                return(roles);
            }
        }
 public void SetRoleInCourse(int courseID, int roleID)
 {
     RoleM.SetRoleInCourse(_userID, courseID, roleID);
 }
 public RoleM GetRoleInCourse(int courseID)
 {
     return(RoleM.GetUsersRoleInCourse(_userID, courseID));
 }