Class DataAccess
Wrapper for API calls. Fetches data, handles and caches it.
Inherited Members
Namespace: EduCATS.Data
Assembly: EduCATS.dll
Syntax
public static class DataAccess
Properties
ErrorMessage
Error message.
Declaration
public static string ErrorMessage { get; set; }
Property Value
Type | Description |
---|---|
string |
IsConnectionError
Is network connection issue.
Declaration
public static bool IsConnectionError { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsError
Is error occurred.
Declaration
public static bool IsError { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsSessionExpiredError
Is session expired issue.
Declaration
public static bool IsSessionExpiredError { get; set; }
Property Value
Type | Description |
---|---|
bool |
Username
Declaration
public static string Username { get; }
Property Value
Type | Description |
---|---|
string |
Methods
AnswerQuestionAndGetNext(TestAnswerPostModel)
Answer question.
Declaration
public static Task<object> AnswerQuestionAndGetNext(TestAnswerPostModel answer)
Parameters
Type | Name | Description |
---|---|---|
TestAnswerPostModel | answer | Answer data. |
Returns
Type | Description |
---|---|
Task<object> | String. |
DeleteAccount()
Declaration
public static Task<DeleteAccountModel> DeleteAccount()
Returns
Type | Description |
---|---|
Task<DeleteAccountModel> |
GetAccountData()
Declaration
public static Task<SecondUserModel> GetAccountData()
Returns
Type | Description |
---|---|
Task<SecondUserModel> |
GetAvailableTests(int, int)
Fetch tests.
Declaration
public static Task<List<TestModel>> GetAvailableTests(int subjectId, int userId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | userId | User ID. |
Returns
Type | Description |
---|---|
Task<List<TestModel>> | List of test data. |
GetConceptCascade(int)
Fetch Electronic Educational Methodological Complexes concept cascade.
Declaration
public static Task<ConceptModelTest> GetConceptCascade(int elementId)
Parameters
Type | Name | Description |
---|---|---|
int | elementId | Root element ID. |
Returns
Type | Description |
---|---|
Task<ConceptModelTest> | Concept data. |
GetConceptTree(int)
Fetch Electronic Educational Methodological Complexes concept tree.
Declaration
public static Task<ConceptModel> GetConceptTree(int elementId)
Parameters
Type | Name | Description |
---|---|---|
int | elementId | Root element ID. |
Returns
Type | Description |
---|---|
Task<ConceptModel> | Concept data. |
GetDataObject<T>(IDataAccess<T>, bool)
Get data object and set error details.
Declaration
public static Task<object> GetDataObject<T>(IDataAccess<T> dataAccess, bool isList)
Parameters
Type | Name | Description |
---|---|---|
IDataAccess<T> | dataAccess | Data Access instance. |
bool | isList | Is object a list or a single object. |
Returns
Type | Description |
---|---|
Task<object> | Object. |
Type Parameters
Name | Description |
---|---|
T | Object type. |
GetDetailsFilesTest(string)
Declaration
public static Task<List<FileDetailsModelTest>> GetDetailsFilesTest(string uri)
Parameters
Type | Name | Description |
---|---|---|
string | uri |
Returns
Type | Description |
---|---|
Task<List<FileDetailsModelTest>> |
GetFiles(int)
Fetch files.
Declaration
public static Task<FilesModel> GetFiles(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
Returns
Type | Description |
---|---|
Task<FilesModel> | Files data. |
GetFilesTest(int)
Declaration
public static Task<FilesModelTest> GetFilesTest(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId |
Returns
Type | Description |
---|---|
Task<FilesModelTest> |
GetGroupInfo(string)
Load goup info by groupName
Declaration
public static Task<GroupInfo> GetGroupInfo(string groupName)
Parameters
Type | Name | Description |
---|---|---|
string | groupName | group Name |
Returns
Type | Description |
---|---|
Task<GroupInfo> |
GetGroupsData()
Fetch groups data.
Declaration
public static Task<List<GroupItemModel>> GetGroupsData()
Returns
Type | Description |
---|---|
Task<List<GroupItemModel>> | Group data. |
GetInfoLectures(int)
Fetch subjects.
Declaration
public static Task<InfoLecturesModel> GetInfoLectures(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId |
Returns
Type | Description |
---|---|
Task<InfoLecturesModel> | Subjects data. |
GetKey(string, object)
Declaration
public static string GetKey(string key, object id)
Parameters
Type | Name | Description |
---|---|---|
string | key | |
object | id |
Returns
Type | Description |
---|---|
string |
GetKey(string, object, object)
Get complex key with identifiers.
Declaration
public static string GetKey(string key, object firstId, object secondId)
Parameters
Type | Name | Description |
---|---|---|
string | key | Basic key. |
object | firstId | First ID. |
object | secondId | Second ID. |
Returns
Type | Description |
---|---|
string |
GetLabs(int)
Declaration
public static Task<Laboratories> GetLabs(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId |
Returns
Type | Description |
---|---|
Task<Laboratories> |
GetLabs(int, int)
Fetch laboratory works data.
Declaration
public static Task<LabsModel> GetLabs(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<LabsModel> | Laboratory works data. |
GetLabsTest(int, int)
Fetch laboratory works data.
Declaration
public static Task<TakedLabs> GetLabsTest(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<TakedLabs> | Laboratory works data. |
GetLectures(int, int)
Fetch lectures data.
Declaration
public static Task<LecturesModel> GetLectures(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<LecturesModel> | Lectures data. |
GetLecturesTest(int, int)
Declaration
public static Task<LecturesModel> GetLecturesTest(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | |
int | groupId |
Returns
Type | Description |
---|---|
Task<LecturesModel> |
GetNews(string)
Fetch news.
Declaration
public static Task<List<NewsModel>> GetNews(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username. |
Returns
Type | Description |
---|---|
Task<List<NewsModel>> | News data. |
GetNextQuestion(int, int, int)
Fetch next question.
Declaration
public static Task<TestQuestionModel> GetNextQuestion(int testId, int questionNumber, int userId)
Parameters
Type | Name | Description |
---|---|---|
int | testId | Test ID. |
int | questionNumber | Question number. |
int | userId | User ID. |
Returns
Type | Description |
---|---|
Task<TestQuestionModel> | Test question data. |
GetOnlyGroups(int)
Fetch groups.
Declaration
public static Task<GroupModel> GetOnlyGroups(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
Returns
Type | Description |
---|---|
Task<GroupModel> | Group data. |
GetPractTest(int, int)
Declaration
public static Task<TakedLabs> GetPractTest(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | |
int | groupId |
Returns
Type | Description |
---|---|
Task<TakedLabs> |
GetPracticals(int)
Declaration
public static Task<Practs> GetPracticals(int subjectId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId |
Returns
Type | Description |
---|---|
Task<Practs> |
GetProfileInfo(string)
Fetch profile information.
Declaration
public static Task<UserProfileModel> GetProfileInfo(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username. |
Returns
Type | Description |
---|---|
Task<UserProfileModel> | User profile data. |
GetProfileInfoCalendar(string)
Fetch calendar data.
Declaration
public static Task<CalendarModel> GetProfileInfoCalendar(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username. |
Returns
Type | Description |
---|---|
Task<CalendarModel> | Calendar data. |
GetProfileInfoSubjects(string)
Fetch subjects.
Declaration
public static Task<List<SubjectModel>> GetProfileInfoSubjects(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username. |
Returns
Type | Description |
---|---|
Task<List<SubjectModel>> | Subjects data. |
GetRecommendations(int, int)
Fetch recommendations (adaptive learning).
Declaration
public static Task<List<RecommendationModel>> GetRecommendations(int subjectId, int userId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | userId | User ID. |
Returns
Type | Description |
---|---|
Task<List<RecommendationModel>> | List of recommendations data. |
GetRootConcepts(string, string)
Fetch Electronic Educational Methodological Complexes root concepts.
Declaration
public static Task<RootConceptModel> GetRootConcepts(string userId, string subjectId)
Parameters
Type | Name | Description |
---|---|---|
string | userId | User ID. |
string | subjectId | Subject ID. |
Returns
Type | Description |
---|---|
Task<RootConceptModel> | Root concept data. |
GetSchedule(string)
Fetch schedule calendar data.
Declaration
public static Task<CalendarSubjectModelTest> GetSchedule(string date)
Parameters
Type | Name | Description |
---|---|---|
string | date |
Returns
Type | Description |
---|---|
Task<CalendarSubjectModelTest> | Calendar data. |
GetStatistics(int, int)
Fetch statistics.
Declaration
public static Task<StatsModel> GetStatistics(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<StatsModel> | Statistics data. |
GetTest(int)
Get test information.
Declaration
public static Task<TestDetailsModel> GetTest(int testId)
Parameters
Type | Name | Description |
---|---|---|
int | testId | Test ID. |
Returns
Type | Description |
---|---|
Task<TestDetailsModel> | Test details data. |
GetTestPracticialStatistics(int, int)
Fetch statistics.
Declaration
public static Task<LabsVisitingList> GetTestPracticialStatistics(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<LabsVisitingList> | Statistics data. |
GetTestStatistics(int, int)
Fetch statistics.
Declaration
public static Task<LabsVisitingList> GetTestStatistics(int subjectId, int groupId)
Parameters
Type | Name | Description |
---|---|---|
int | subjectId | Subject ID. |
int | groupId | Group ID. |
Returns
Type | Description |
---|---|
Task<LabsVisitingList> | Statistics data. |
GetToken(string, string)
Declaration
public static Task<TokenModel> GetToken(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | |
string | password |
Returns
Type | Description |
---|---|
Task<TokenModel> |
GetUserAnswers(int)
Declaration
public static Task<ExtendedTestResultModel> GetUserAnswers(int testId)
Parameters
Type | Name | Description |
---|---|---|
int | testId |
Returns
Type | Description |
---|---|
Task<ExtendedTestResultModel> |
GetUserAnswers(int, int)
Fetch test answers.
Declaration
public static Task<List<TestResultsModel>> GetUserAnswers(int userId, int testId)
Parameters
Type | Name | Description |
---|---|---|
int | userId | User ID. |
int | testId | Test ID. |
Returns
Type | Description |
---|---|
Task<List<TestResultsModel>> | List of results data. |
Login(string, string)
Authorize.
Declaration
public static Task<UserModel> Login(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | Username. |
string | password | Password. |
Returns
Type | Description |
---|---|
Task<UserModel> | User data. |
ResetData()
Delete data cache.
Declaration
public static void ResetData()
SetError(string, bool, bool)
Set error details.
Declaration
public static void SetError(string message, bool isConnectionError, bool sessionExpired)
Parameters
Type | Name | Description |
---|---|---|
string | message | Error message. |
bool | isConnectionError | Is network connection issue. |
bool | sessionExpired | Is session expired issue. |
Remarks
Can be null
(if no error occurred).