net3000.schools 1.0.4

dotnet add package net3000.schools --version 1.0.4
                    
NuGet\Install-Package net3000.schools -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="net3000.schools" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="net3000.schools" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="net3000.schools" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add net3000.schools --version 1.0.4
                    
#r "nuget: net3000.schools, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package net3000.schools@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=net3000.schools&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=net3000.schools&version=1.0.4
                    
Install as a Cake Tool

schoolsCore

Overview

The schoolsCore library powers course and registration workflows for Net3000 education clients. It delivers utilities for retrieving course catalogs, computing pricing and availability, building PayPal links, formatting registration documents, and sending transactional emails. Entity Framework contexts for school data are included.

Public API

<details> <summary>Net3000.Schools.SchoolLibrary</summary>

Member Summary Parameters
SchoolLibrary SchoolLibrary(IConfiguration _configuration) Constructor with configuration. _configuration (IConfiguration)
SchoolLibrary SchoolLibrary() Default constructor. None
IEnumerable<sc_promotions> ActivePromotions(string promoCode, double total, int studentCount, int programCount) Returns active promotions matching account, promo code, date window, minimum amount, and student count. promoCode (string), total (double), studentCount (int), programCount (int)
async Task<(bool saved, sc_students student, bool notFound, bool duplicateName)> addOrUpdateStudentAsync(sc_students input, int clientId) Adds a new student or updates an existing one for a client. Returns saved status, student entity, not-found flag, and duplicate-name flag. input (sc_students), clientId (int)
async Task AppendStudentCourseSessionsAndSaveAsync(sc_registrations registration, sc_registrations model) Appends student-course-session rows from the model to the registration, resolves or creates student records, and persists to the database. registration (sc_registrations), model (sc_registrations)
string AvailableSpots(int? limit, int? regcount, int warnUnder, string warnMsg, bool warnOnly) Returns a spots-remaining message when a session is near capacity. limit (int?), regcount (int?), warnUnder (int), warnMsg (string), warnOnly (bool)
string BackForMoreLink(int courseID, string categoryIDs, string prefix) Builds a relative link back to the category or course page for continued browsing. courseID (int), categoryIDs (string), prefix (string)
RegistrationDetailDto buildRegistrationDetailDto(sc_registrations reg, string status) Builds a DTO containing registration header data and line items (course, student, date, price, tax). reg (sc_registrations), status (string)
void CalculateRegistrationTotal(sc_registrations registration, loginUser currentUser) Recalculates pricing for every student-course-session on a registration: applies session prices, early bird discounts, auto-promotions, and taxes. registration (sc_registrations), currentUser (loginUser)
string CategoryLink(sc_categories category) Generates a friendly relative URL for a category page. category (sc_categories)
void ClearRegistrationSessionsCache() Clears the cached registration sessions so the next calculation reloads from the database. None
string CourseLink(sc_courses course) Generates a friendly relative URL for a course page. course (sc_courses)
async Task<bool> deleteStudentForClientAsync(int studentId, int loginUserId) Deletes a student record owned by a client. Returns true if found and removed. studentId (int), loginUserId (int)
void EnsureRegistrationClientAddress(sc_registrations registration, loginUser currentUser) Loads the client's address from the database when the registration's client has no address data. registration (sc_registrations), currentUser (loginUser)
async Task<SchoolSettings> getApiSettingsAsync() Loads public API settings for the current account from accountApps and sc_configuration tables. Returns null if no accountApps row exists. None
async Task<List<DateTime?>> getAvailableSessionStartDatesForDayAsync(int dayOfWeek, int courseSessionId) Returns up to four upcoming start dates for a session filtered by day of week. dayOfWeek (int), courseSessionId (int)
List<sc_categories> GetCategories(int? account, int? parentID, bool activeOnly, bool includeCourses, int pageIndex, int pageSize) Returns a paged list of categories, optionally filtered by parent and active courses. account (int?), parentID (int?), activeOnly (bool), includeCourses (bool), pageIndex (int), pageSize (int)
sc_categories getCategory(int id, int? account, bool activeOnly, bool includeCourses, int pageIndex, int pageSize, string search) Loads a single category with optional course includes and paging. id (int), account (int?), activeOnly (bool), includeCourses (bool), pageIndex (int), pageSize (int), search (string)
sc_courses getCourse(int id) Loads a course by ID with sessions, locations, trainers, packages, categories, and early bird prices. id (int)
sc_courses getCourse(string code) Loads a course by course code with sessions, locations, packages, categories, and early bird prices. code (string)
List<sc_courseSessions> getCoursedates(int account, int courseId) Returns all sessions for a course within an account. account (int), courseId (int)
List<sc_courses> getCourses(int? account, bool activeOnly, int pageSize, int pageIndex, string search) Returns a paged, searchable list of courses for an account. Sets totalCount. account (int?), activeOnly (bool), pageSize (int), pageIndex (int), search (string)
sc_courseSessions getCourseSession(int? id) Loads a single course session by ID. id (int?)
async Task<sc_courseSessions> GetCourseSessionAsync(int? id) Async load of a course session by ID, including its parent course. id (int?)
object getDashboardStats() Returns an anonymous object with dashboard statistics: upcoming confirmed/pending registrations, total clients, upcoming/archive/open-date course counts. None
string GetDate(DateTime? startdate, DateTime? enddate) Formats a start/end date range as "dd MMM - dd MMM yyyy", or "Open Date" when no dates. startdate (DateTime?), enddate (DateTime?)
async Task<List<object>> getMainCategoriesNavSummaryAsync() Returns top-level categories (parentID is null) with id, title, description, feature image, meta fields, and link for navigation. None
List<sc_packages> getPackages(int courseId) Returns all packages for a course. courseId (int)
sc_registrations getRegistration(int id, int? account) Loads a full registration by ID with students, sessions, courses, locations, payments, and client. id (int), account (int?)
(List<Registration> list, int totalCount) getRegistrations(int pageIndex, int pageSize, string search, int? courseId, int? sessionId, bool orderByStudentCourseSessionId, bool? archive) Returns a paged list of registration rows (student-course-session level) with client info, balance, and session reg counts. pageIndex (int), pageSize (int), search (string), courseId (int?), sessionId (int?), orderByStudentCourseSessionId (bool), archive (bool?)
async Task<(List<RegistrationIndexItem> Items, int TotalCount)> GetRegistrationIndexForClientAsync(int clientId, int account, int pageIndex, int pageSize) Returns paged registration index items for a client, each with id, status, date, and unique course titles with start dates. clientId (int), account (int), pageIndex (int), pageSize (int)
async Task<string> getSchoolCurrencyLowerAsync() Returns the lowercase currency code from sc_configuration, defaulting to "usd". None
async Task<List<sc_students>> GetUniqueStudentsForClientAsync(int clientId, int account) Returns deduplicated students for a client (by first/last name), keeping the record with the lowest id. clientId (int), account (int)
async Task<List<sc_courseSessions>> getUpcomingAvailableCourseSessionsForAccountAsync() Returns future available sessions for the account, ordered by start date, with course outline copied. None
async Task<sc_registrations> LoadRegistrationForEmailAsync(int registrationId) Loads a registration with all includes needed for email rendering (students, courses, locations, payments). registrationId (int)
string mergeRegistrationData(sc_registrations reginfo, string template, bool admin) Merges registration data into an HTML template, replacing placeholders for client, students, payments, and settings. reginfo (sc_registrations), template (string), admin (bool)
string payPalLink(sc_registrations registrationDV) Builds a PayPal Standard checkout URL for a registration. registrationDV (sc_registrations)
string priceDisplay(double? originalPrice, double? price) Formats a price for display, showing a strikethrough original price when a discount applies. originalPrice (double?), price (double?)
string printRegistration(sc_registrations reginfo, string template, bool admin) Renders a registration confirmation using the email template, falling back to the "registration-email" template. reginfo (sc_registrations), template (string), admin (bool)
async Task<(sc_registrations registration, string paymentLink)> registerByHourAsync(int sessionId, IReadOnlyList<string> selectedHours, string date, string metaDataJson, loginUser user) Creates a by-hour registration for selected time slots, persists it, sends email, and returns an optional PayPal link. sessionId (int), selectedHours (IReadOnlyList<string>), date (string), metaDataJson (string), user (loginUser)
IQueryable<sc_studentCourseSessions> RegistrationsIndexSessionQuery(string search, int? courseId, int? sessionId, bool? archive) Returns the same filtered query as the registrations index (including upcoming vs archive). Use for CSV export and bulk operations. search (string), courseId (int?), sessionId (int?), archive (bool?)
int? RemainingCount(int? limit, int? regcount) Calculates the number of remaining spots for a session. limit (int?), regcount (int?)
async Task<(bool categoryNotFound, List<CategoryCourseItem> list, int totalCount)> searchCategoryCoursesPagedAsync(int? categoryId, string locationIDs, string keyword, int pageSize, int pageIndex, bool activeOnly, bool openDate) Searches courses within a category with location, keyword, and active/open-date filters. Returns paged results sorted by next upcoming date. categoryId (int?), locationIDs (string), keyword (string), pageSize (int), pageIndex (int), activeOnly (bool), openDate (bool)
async Task<(List<CourseSearchResult> items, int totalCount)> searchCoursesPagedAsync(string categories, string keyword, int pageSize, int pageIndex, bool activeOnly) Searches courses by category IDs and keyword with paging. Returns results with next future session info. categories (string), keyword (string), pageSize (int), pageIndex (int), activeOnly (bool)
List<sc_courses> searchCoursesSimple(string keywords, bool activeOnly) Simple keyword search for courses by title or code, optionally limited to active sessions. keywords (string), activeOnly (bool)
void sendRegistrationEmail(sc_registrations reginfo, sendTo sendTo) Sends the registration confirmation email to the client, admin, or both. reginfo (sc_registrations), sendTo (sendTo)
void SetEarlyBirdPricesForSessions(IEnumerable<sc_courseSessions> sessions) Sets earlyBirdPrice on each session from its early bird price tiers based on days until start. sessions (IEnumerable<sc_courseSessions>)
bool showBackToRegistrationLink() Returns true when a registration cookie exists and the current page is not a registration step. None
async Task<(bool categoryNotFound, CategoryFiltersResponse data)> tryBuildCategoryFiltersAsync(int? categoryId) Builds filter options (subcategories, locations) for the category course search UI. categoryId (int?)
async Task<(bool notFound, CategoryNavNode tree)> tryBuildCategoryNavTreeAsync(int? id) Builds a category navigation tree node with children or siblings for breadcrumb/sidebar navigation. id (int?)
(sc_categories data, int count)? tryGetCategoryForApi(int id, bool activeOnly, bool includeCourses, int pageSize, int pageIndex, string fields) Loads a category for the API, optionally projecting to requested fields. Returns null if not found. id (int), activeOnly (bool), includeCourses (bool), pageSize (int), pageIndex (int), fields (string)
async Task<AvailableHoursApiResult> tryGetAvailableHoursAsync(int sessionId, string date) Returns available time slots for a session on a given date, validating day-of-week constraints. sessionId (int), date (string)
async Task<bool> tryRecordPayPalIpnPaymentAsync(int registrationId, double amount, string transactionId) Records a PayPal IPN payment, confirms the registration status, and saves. Returns false if registration not found. registrationId (int), amount (double), transactionId (string)
List<string> ValidateRegistration(sc_registrations model, loginUser currentUser) Validates a registration model, removing unavailable or sold-out sessions and returning error messages. model (sc_registrations), currentUser (loginUser)

</details>

<details> <summary>Net3000.Schools.DbContext.sc_courseSessions</summary>

Member Summary Parameters
string metaField(string fieldName) Returns the value of a metadata field by name, or null if not present. fieldName (string)

</details>

<details> <summary>Net3000.Schools.DbContext.sc_courses</summary>

Member Summary Parameters
sc_courses sc_courses() Default constructor; initializes the sessions collection. None

</details>

<details> <summary>Net3000.Schools.DbContext.SchoolDB</summary>

Member Summary Parameters
SchoolDB SchoolDB(DbContextOptions<SchoolDB> options) Initializes a new SchoolDB context. options (DbContextOptions<SchoolDB>)

</details>

<details> <summary>Net3000.Schools.Models.Settings</summary>

Member Summary Parameters
Settings Settings() Default constructor; sets initial values for payment and requirement flags. None
void FillDefaults() Fills default values for studentLabel, courseLabel, and cashMessage if not already set. None

</details>

<details> <summary>Net3000.Schools.Extensions.ScStudentCourseSessionQueryableExtensions</summary>

Member Summary Parameters
static IQueryable<sc_studentCourseSessions> WhereUpcomingCourseRegistrations(this IQueryable<sc_studentCourseSessions> query, DateTime now) Filters to upcoming registrations: session not ended and status is not Archive. query (IQueryable<sc_studentCourseSessions>), now (DateTime)
static IQueryable<sc_studentCourseSessions> WhereArchivedCourseRegistrations(this IQueryable<sc_studentCourseSessions> query, DateTime now) Filters to archived registrations: status is Archive, or the session has ended. query (IQueryable<sc_studentCourseSessions>), now (DateTime)

</details>

Usage Notes

  • Configure SchoolLibrary with IConfiguration and account context before loading courses or registrations.
  • Use helper methods such as priceDisplay, mergeRegistrationData, and sendRegistrationEmail to keep presentation and communications consistent.
  • Database models under DBContext expose metadata helpers like metaField; avoid altering generated attributes manually.

License

This library is proprietary to Net3000. Redistribution or use outside Net3000.ca solutions is not permitted.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 98 7/4/2026
1.0.3 138 4/4/2026
1.0.2 334 12/17/2025
1.0.0 316 12/16/2025

1.0.4: Rebuilt against net3000.common 10.0.21 (assembly `common`). The published 1.0.3 referenced the old `net3000.common` assembly (renamed to `common` in 10.0.21), causing FileNotFoundException in consumers. No API changes.