1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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.vitalExam.createExamAsync(
- examRequest,
- );
- print(jsonEncode(examRequest.toJson()));
- if (examCode.isNotEmpty) {
- return true;
- }
- return false;
- } catch (e) {
- print(jsonEncode(examRequest.toJson()));
- 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.vitalExam.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.vitalExam.updateExamByBatchNumberAsync(
- updateExamByBatchNumberRequest,
- );
- print(jsonEncode(updateExamByBatchNumberRequest.toJson()));
- return result;
- } catch (e) {
- logger.e("updateExamByBatchNumberAsync sync user info error.", e);
- return null;
- }
- }
- }
|