public string GetLawInfoList_Web(QueryCommon <LawInfoQuery_Web> query) { ILawInfoService jobsService = ServiceHelper.Create <ILawInfoService>(); Result_List_Pager <Result_LawInfo> res = jobsService.GetLawInfoList_Web(query); List <Result_AttachmentInfo> resItem = new List <Result_AttachmentInfo>(); foreach (var item in res.List) { resItem = GetObjectList_ById_Web(item.Id).List.Where(x => x.AttachmentName != null && x.AttachmentName != "" && x.AttachmentName.LastIndexOf('.') > 0).ToList(); if (resItem != null && resItem.Count > 0) { Result_AttachmentInfo imgItem = resItem.Where(x => HashSet_Common.ImageTypeArr.Contains(x.AttachmentName.Substring(x.AttachmentName.LastIndexOf('.'), x.AttachmentName.Length - x.AttachmentName.LastIndexOf('.')))).FirstOrDefault(); if (imgItem != null) { item.AttachmentName = imgItem.AttachmentName; } else { item.AttachmentName = ""; } } else { item.AttachmentName = ""; } } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }
public string Get_PageInfo(QueryCommon <LawInfoQuery_Web> query) { Result_Model <PageInfo> resModel = new Result_Model <PageInfo>(); ILawInfoService jobsService = ServiceHelper.Create <ILawInfoService>(); resModel = jobsService.Get_PageInfo_Web(query); return(Newtonsoft.Json.JsonConvert.SerializeObject(resModel)); }
public Result_List <Result_AttachmentInfo> GetObjectList_ById_Web(long Id) { Result_List <Result_AttachmentInfo> res = new Result_List <Result_AttachmentInfo>(); try { ILawInfoService jobsService = ServiceHelper.Create <ILawInfoService>(); res = jobsService.GetObjectList_ById_Web(Id); //res.List.Select(x => x.FileName == System.IO.Path.GetFileName(x.AttachmentName)); } catch (Exception ex) { res.Msg = new Result_Msg() { IsSuccess = false, Message = "读取失败,失败原因:" + ex.Message }; } return(res); }
public Result_List <Result_Model <LawInfo> > Get_PreNext_ById_Web(long Id) { Result_List <Result_Model <LawInfo> > res = new Result_List <Result_Model <LawInfo> >() { Msg = new Result_Msg() { IsSuccess = true } }; try { ILawInfoService jobsService = ServiceHelper.Create <ILawInfoService>(); res = jobsService.Get_PreNext_ById_Web(Id); } catch (Exception ex) { res.Msg = new Result_Msg() { IsSuccess = false, Message = "读取失败,失败原因:" + ex.Message }; } return(res); }
public string GetObjectById_Web(int Id) { Result_Model_LawAttachmentList_PreNextRow resAll = new Result_Model_LawAttachmentList_PreNextRow() { Model = new Result_LawInfo(), AttachmentList = new Result_List <Result_AttachmentInfo>(), Msg = new Result_Msg() { IsSuccess = true, Message = string.Empty }, PreNextRow = new Result_List <Result_Model <LawInfo> >() }; try { ILawInfoService jobsService = ServiceHelper.Create <ILawInfoService>(); resAll.Model = jobsService.GetObjectById_Web(Id); if (resAll.Model != null && resAll.Msg.IsSuccess) { resAll.AttachmentList = GetObjectList_ById_Web(Id); if (!resAll.AttachmentList.Msg.IsSuccess) { resAll.Msg.IsSuccess = false; resAll.Msg.Message += "获取附件列表失败\n\r"; } else { foreach (var item in resAll.AttachmentList.List) { try { item.FileName = item.AttachmentName.Substring(item.AttachmentName.LastIndexOf('/') + 1, item.AttachmentName.Length - item.AttachmentName.LastIndexOf('/') - 1); } catch (Exception) { item.FileName = "附件信息获取失败"; } } } resAll.PreNextRow = Get_PreNext_ById_Web(Id); if (!resAll.PreNextRow.Msg.IsSuccess) { resAll.Msg.IsSuccess = false; resAll.Msg.Message += "获取上一页、下一页\n\r"; } } else { resAll.Msg.IsSuccess = false; resAll.Msg.Message += "获取会议数据失败\n\r"; } } catch (Exception ex) { resAll.Msg = new Result_Msg() { IsSuccess = false, Message = "读取失败,失败原因:" + ex.Message }; } return(Newtonsoft.Json.JsonConvert.SerializeObject(resAll)); }