コード例 #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();

                    // replace with localized name if available
                    string localizedName = SharedSupport.GetLocalizedString("UserRole_" + roleName);
                    if (localizedName != String.Empty)
                    {
                        roleName = localizedName;
                    }
                    roles[i] = new RoleM(roleID, roleName);
                }
                return(roles);
            }
        }
コード例 #2
0
 public void SetRoleInCourse(int courseID, int roleID)
 {
     RoleM.SetRoleInCourse(_userID, courseID, roleID);
 }
コード例 #3
0
 public RoleM GetRoleInCourse(int courseID)
 {
     return(RoleM.GetUsersRoleInCourse(_userID, courseID));
 }