123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import 'dart:convert';
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:vitalapp/managers/interfaces/exam.dart';
- import 'package:vitalapp/rpc.dart';
- import 'package:vitalapp/store/store.dart';
- import 'package:fis_common/logger/logger.dart';
- class ExamManager implements IExamManager {
- @override
- Future<bool?> createExam(CreateExamRequest examRequest) async {
- try {
- examRequest.token = Store.user.token;
- final examCode = await rpc.exam.createExamAsync(
- examRequest,
- );
- print(jsonEncode(examRequest.toJson()));
- if (examCode.isNotEmpty) {
- return true;
- }
- return false;
- } catch (e) {
- logger.e("ExamManager sync user info error.", e);
- return null;
- }
- }
- @override
- Future<bool?> editExam(UpdateExamRequest examRequest) async {
- try {
- examRequest.token = Store.user.token;
- final result = await rpc.exam.updateExamAsync(
- examRequest,
- );
- return result;
- } catch (e) {
- logger.e("ExamManager sync user info error.", e);
- return null;
- }
- }
- @override
- Future<bool?> updateExamByBatchNumberAsync(
- UpdateExamByBatchNumberRequest updateExamByBatchNumberRequest) async {
- try {
- updateExamByBatchNumberRequest.token = Store.user.token;
- final result = await rpc.exam.updateExamByBatchNumberAsync(
- updateExamByBatchNumberRequest,
- );
- print(jsonEncode(updateExamByBatchNumberRequest.toJson()));
- return result;
- } catch (e) {
- logger.e("updateExamByBatchNumberAsync sync user info error.", e);
- return null;
- }
- }
- }
|