Exemplo n.º 1
0
        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));
        }