//通过客户端编号 获取所有文件列表 以及所有的文件类型 public JsonModelForReadingSync IReadingSync(string Data) { JsonModelForReadingSync model = new JsonModelForReadingSync(); DataTable table = null; DataTable tblFile = null; ParamModelIReadingSync param = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModelIReadingSync>(Data); SelfServiceMachine.DBReadingRecord bllFileGroup = new SelfServiceMachine.DBReadingRecord(); DBReadingRecord bllFile = new DBReadingRecord(); try { table = bllFileGroup.GetListForReadingSync("").Tables[0]; tblFile = bllFile.GetAllListWithFileType(param.clientid).Tables[0]; model.result = "0"; model.returnStr = "返回成功"; model.TypeList = table; model.FileList = tblFile; } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "0"; model.returnStr = "返回失败" + ex.ToString(); } return(model); }
// 保存阅读记录 public JsonModel SaveReadings(string Data) { MDSelfServiceMachine.MDReadHistory readingHistory = new MDSelfServiceMachine.MDReadHistory(); DBReadingRecord dbs = new DBReadingRecord(); Reading reading = Newtonsoft.Json.JsonConvert.DeserializeObject <Reading>(Data); JsonModel model = new JsonModel(); try { if (reading.data != null && reading.data.ReaderArray != null) { foreach (fReader trainman in reading.data.ReaderArray) { if (reading.data.TypeList != null) { foreach (fTypeList fType in reading.data.TypeList) { foreach (rFile file in fType.FileList) { readingHistory = new MDSelfServiceMachine.MDReadHistory(); readingHistory.SiteGUID = trainman.cid; readingHistory.strTrainmanGUID = trainman.TrainmanGUID; readingHistory.strFileGUID = file.strFileGUID; readingHistory.DtReadTime = file.dtReadTime; dbs.AddReadHistory(readingHistory); //更新阅读计划里边的第一次阅读时间、阅读次数 dbs.UpdateReadTime(file.strFileGUID, trainman.TrainmanGUID, file.dtReadTime); } } } } } model.result = "0"; model.returnStr = "提交成功"; } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "1"; model.returnStr = "提交失败:" + ex.Message; } return(model); }
//获取记名式传达 public JsonModel Get(string Data) { JsonModel model = new JsonModel(); DataTable table = null; //JsonData data = new JsonData(); List <TypeList> typeList = new List <TypeList>(); InnerData data = new InnerData(); data.TypeList = typeList; ParamModel param = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel>(Data); DBReadingRecord drr = new DBReadingRecord(); try { //string where = string.Format(" strTypeName='{0}'", "记名式传达"); table = drr.GetList("").Tables[0]; //table = bllGroup.GetAllList().Tables[0]; if (table != null) { foreach (DataRow row in table.Rows) { TypeList list = new TypeList(); list.strTypeGUID = row["strTypeGUID"].ToString(); list.strTypeName = row["strTypeName"].ToString(); list.FileList = drr.GetReadingHistoryOfTrainman(param.strTrainmanGUID, list.strTypeGUID); typeList.Add(list); } } model.result = "0"; model.returnStr = "返回成功"; model.data = data; } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "1"; model.returnStr = ex.Message.ToString(); } return(model); }