天津23维预案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

121 lines
5.4 KiB

using UnityEngine;
using System.Collections.Generic;
using System;
using Mono.Data.Sqlite;
using AX.MessageSystem;
using AX.NetworkSystem;
public class ExamScoreResultCheckManager : BaseExamManager {
//public static List<ExamRecordInfo> ExamRecordInfoList;// = new List<ExamRecordInfo>();
public override void GetData(IMessage message)
{
ExamList.Clear();
var data = (PagingReplyInfo<ExaminationInfo>)message.Data;
ExamList = data.Items;//来自服务器的数据
if (ExamList.Count == 0)
{
this.gameObject.transform.parent.Find("bulletin").gameObject.SetActive(true);//没有考试信息的告示
}
GenerateExamItem();
//GetExamInfoFromServer();//处理来自服务端的数据
if (TimeManager.CurExam != null && TimeManager.CurQues != null)
{
MessageDispatcher.SendMessage(TimeManager.CurExam.ID, "ToggleTrue", (object)TimeManager.CurQues.ID);
}
}
public override void GetExamInfoFromServer()
{
//连接服务器,获取考试评分结束的考试记录数据,准备查看评分
//此处只刷新已关闭评分的考试记录,详见 https://git.oschina.net/AX2017/TacticalTrainingAndExaminationSystem/issues/14
//ToDo...
//考试记录数据插入到本地数据库
//ToDo...
//1.使用本地数据库ScoreID与服务端对比,增量更新到本地数据库,然后使用本地数据库数据实例化考试记录
//2.本地数据库已有的考试记录 + 增量更新的考试记录 (同时增量更新添加到本地数据库记录中)
//3.首先读取本地数据库已有考试记录,生成本地的ExamRecordInfoList,然后用最大ID对比服务端,增量更新ID大的考试记录,
// 添加到到本地ExamRecordInfoList中,同时再插入到本地数据库中 准备采用这种方式
//ExamRecordInfoList.Clear();
//ReadDataFromTable("ScoreRecordT");//首先读取本地数据库的考试记录
//本地记录与服务端记录进行对比
//int serverID= ExamRecordInfoListFromServer[ExamRecordInfoListFromServer.Count-1].
//if (ExamRecordInfoListFromServer[])
//跟服务端对比,增量更新,增加的记录添加到ExamRecordInfoList,同时插入到本地数据库中,然后下载评分文件到本地score文件夹中
//ToDo...从服务端对比请求数据
//考试记录数据写入到Exam结构中,画出UI
//ExamList.Clear();
//for (int i = 0; i < ExamRecordInfoList.Count; i++)
//{
// ExamInfo exam = new ExamInfo();
// exam.ExamName = ExamRecordInfoList[i].ExamName;
// exam.ExamID = ExamRecordInfoList[i].ExamID;
// exam.StartTime = ExamRecordInfoList[i].ExamStartTime;
// exam.DurationTime = ExamRecordInfoList[i].ExamDurationTime;
// exam.EndTime = ExamRecordInfoList[i].ExamEndTime;
// exam.QuestionList = new List<QuestionInfo_o>();
// string[] questionIDList = ExamRecordInfoList[i].QuestionID.Split(';');
// string[] questionNameList = ExamRecordInfoList[i].QuestionName.Split(';');
// string[] questionSceneIDList = ExamRecordInfoList[i].QuestionSceneID.Split(';');
// if(questionIDList.Length == questionNameList.Length && questionNameList.Length == questionSceneIDList.Length)
// {
// for(int j=0;j< questionIDList.Length; j++)
// {
// QuestionInfo_o question = new QuestionInfo_o();
// question.QuestionID = questionIDList[j];
// question.QuestionName = questionNameList[j];
// question.SceneID = questionSceneIDList[j];
// exam.QuestionList.Add(question);
// }
// }
// else
// {
// Debug.LogError("数据项信息长度不一致!");
// }
// ExamList.Add(exam);
//}
//下载答案文件到本地,本地管理一份记录
//ToDo...
}
private void InsertDataToTable(ExamRecordInfo examRecord,string tablename)
{
DbTool dbTool = DbTool.getInstance();
dbTool.OpenDB(DbTool.dataBase);
string sqlStr = "insert into " + tablename +
"(ExamRecordID,ExamID,ExamName,ExamStartTime,ExamDurationTime,ExamEndTime,QuestionID,QuestionName,QuestionSceneID,MakeScorerID,MakeScorerName,Score,ScoreXmlPath)" +
" values('"+ examRecord.ExamRecordID+"','"+ examRecord.ExamID+"','"+ examRecord.ExamName+ "','"+examRecord.ExamStartTime+ "','" +
examRecord.ExamDurationTime+ "','" + examRecord.ExamEndTime+ "','" + examRecord.QuestionID+ "','" + examRecord.QuestionName+ "','" +
examRecord.QuestionSceneID+ "','" + examRecord.MakeScorerID+ "','" + examRecord.MakeScorerName+ "','" + examRecord.Score+ "','" +
examRecord.ScoreXmlPath+"')";
dbTool.ExecuteQuery(sqlStr);
dbTool.CloseSqlConnection();
}
SqliteDataReader read;
public override void InitMessageType()
{
MESSAGETYPE = "GET_MARKING_EXAMINATION_INFOS_REFRESH";
}
public override void InitInfo()
{
//给预制体复制
ItemPrefab = Resources.Load<GameObject>("UIPrefab/Examination/ExamResultCheck");
}
}