コード例 #1
0
 public async Task <APIResult> Get()
 {
     if (Request.Query.Count > 1)
     {
         string fromDate      = Request.Query["fromDate"];
         string toDate        = Request.Query["toDate"];
         string noticeReaders = Request.Query["noticeReaders"];
         string status        = Request.Query["status"];
         string needReply     = Request.Query["needReply"];
         string title         = Request.Query["title"];
         string noticeNo      = Request.Query["noticeNo"];
         string inUserId      = Request.Query["inUserId"];
         return(await _notifiMngService.SearchMadeNoticeList(fromDate,
                                                             toDate,
                                                             noticeReaders,
                                                             status,
                                                             needReply,
                                                             title,
                                                             noticeNo,
                                                             inUserId));
     }
     else
     {
         return(await _notifiMngService.SearchMadeNoticeDetailInfo(Request.Query["id"]));
     }
 }
コード例 #2
0
        private async void SetNoticeDetail(string noticeId)
        {
            try
            {
                _commonFun.ShowLoading("查询中...");
                //TO-DO
                var result = await _notifiMngService.SearchMadeNoticeDetailInfo(noticeId);

                if (result.ResultCode == Module.ResultType.Success)
                {
                    NoticeDetailDto noticeList = CommonHelper.DecodeString <NoticeDetailDto>(result.Body);
                    if (noticeList != null)
                    {
                        _commonFun.HideLoading();
                        ResultDto         = noticeList;
                        NoticeTitle       = ResultDto.Title;
                        NoticeNo          = ResultDto.NoticeNo;
                        StartNoticeDate   = ResultDto.SDate;
                        StartDateStr      = ResultDto.SDate.ToString("yyyy-MM-dd");
                        EndNoticeDate     = ResultDto.EDate;
                        EndDateStr        = ResultDto.EDate.ToString("yyyy-MM-dd");
                        ReplySelected     = ResultDto.NeedReply;
                        ReplySelectedName = ResultDto.NeedReplyName;
                        AllDisItems       = ResultDto.NoticeDisList;
                        AllDepItems       = ResultDto.NoticeDepList;
                        NoticeContent     = ResultDto.Content;
                        oldAttachmentList = new List <AttachDto>();
                        oldAttachmentList.AddRange(ResultDto.AttachList);
                        NotifiAttachmentList = oldAttachmentList;
                        LstHeight            = oldAttachmentList.Count * _lstRowHeight;
                        List <MultiSelectDto> disList = new List <MultiSelectDto>();
                        List <MultiSelectDto> depList = new List <MultiSelectDto>();
                        if ((CommonContext.Account.UserType == "A" || CommonContext.Account.UserType == "R" || CommonContext.Account.UserType == "Z"))
                        {
                            if (ResultDto.Status == "T")
                            {
                                List <ServerDto> serverList = new List <ServerDto>();
                                foreach (var item in CommonContext.Account.ZionList[0].AreaList)
                                {
                                    serverList.AddRange(item.ServerList);
                                }
                                foreach (ServerDto item in serverList)
                                {
                                    if (AllDisItems.Exists(a => a.DisCode == item.SId))
                                    {
                                        disList.Add(new MultiSelectDto {
                                            DisCode = item.SId, DisName = item.SName, IsChecked = true
                                        });
                                    }
                                    else
                                    {
                                        disList.Add(new MultiSelectDto {
                                            DisCode = item.SId, DisName = item.SName, IsChecked = false
                                        });
                                    }
                                }

                                List <DepartmentDto> departmentList = new List <DepartmentDto>();
                                departmentList.AddRange(CommonContext.Account.DepartmentList);
                                foreach (DepartmentDto item in departmentList)
                                {
                                    if (AllDepItems.Exists(a => a.DisCode == item.DId))
                                    {
                                        depList.Add(new MultiSelectDto {
                                            DisCode = item.DId, DisName = item.DName, IsChecked = true
                                        });
                                    }
                                    else
                                    {
                                        depList.Add(new MultiSelectDto {
                                            DisCode = item.DId, DisName = item.DName, IsChecked = false
                                        });
                                    }
                                }
                            }
                            else
                            {
                                disList = AllDisItems;
                                depList = AllDepItems;
                            }
                        }
                        else if (CommonContext.Account.UserType == "S")
                        {
                            disList.Add(new MultiSelectDto {
                                DisCode = CommonContext.Account.OrgServerId, DisName = CommonContext.Account.OrgServerName, IsChecked = true
                            });
                            List <DepartmentDto> departmentList = new List <DepartmentDto>();
                            departmentList.AddRange(CommonContext.Account.DepartmentList);
                            foreach (DepartmentDto item in departmentList)
                            {
                                if (AllDepItems.Exists(a => a.DisCode == item.DId))
                                {
                                    depList.Add(new MultiSelectDto {
                                        DisCode = item.DId, DisName = item.DName, IsChecked = true
                                    });
                                }
                                else
                                {
                                    depList.Add(new MultiSelectDto {
                                        DisCode = item.DId, DisName = item.DName, IsChecked = false
                                    });
                                }
                            }
                        }
                        else
                        {
                            disList.Add(new MultiSelectDto {
                                DisCode = CommonContext.Account.OrgServerId, DisName = CommonContext.Account.OrgServerName, IsChecked = true
                            });
                            depList.Add(new MultiSelectDto {
                                DisCode = CommonContext.Account.OrgDepartmentId, DisName = CommonContext.Account.OrgDepartmentName, IsChecked = true
                            });
                        }
                        MessagingCenter.Send <List <MultiSelectDto> >(disList, MessageConst.NOTICE_DISTRIBUTOR_SHOW);
                        MessagingCenter.Send <List <MultiSelectDto> >(depList, MessageConst.NOTICE_DEPARTMENT_SHOW);
                        if (AllDisItems != null && AllDisItems.Count > 0)
                        {
                            NoticeReadersSelect = string.Format("共选择{0}项", AllDisItems.Count);
                            NoticeReadersColor  = Color.FromHex("3998C0");
                            DisHasSelect        = true;
                        }
                        else
                        {
                            NoticeReadersSelect = "选择经销商";
                            NoticeReadersColor  = StaticColor.ContentFontColor;
                            DisHasSelect        = false;
                        }
                        if (AllDepItems != null && AllDepItems.Count > 0)
                        {
                            NoticeSelectDep = string.Format("共选择{0}项", AllDepItems.Count);
                            NoticeColorDep  = Color.FromHex("3998C0");//
                            DepHasSelect    = true;
                        }
                        else
                        {
                            NoticeSelectDep = "选择角色";
                            NoticeColorDep  = StaticColor.ContentFontColor;
                            DepHasSelect    = false;
                        }
                        _noticeId = ResultDto.NoticeId;
                    }
                    else
                    {
                        _commonFun.HideLoading();
                        ResultDto = new NoticeDetailDto();
                        _commonFun.ShowToast("没有数据");
                    }
                }
                else
                {
                    _commonFun.HideLoading();
                    ResultDto = new NoticeDetailDto();
                    _commonFun.AlertLongText("查询失败,请重试。 " + result.Msg);
                }
            }
            catch (OperationCanceledException)
            {
                _commonFun.HideLoading();
                ResultDto = new NoticeDetailDto();
                _commonFun.AlertLongText("请求超时。");
            }
            catch (Exception)
            {
                _commonFun.HideLoading();
                ResultDto = new NoticeDetailDto();
                _commonFun.AlertLongText("查询异常,请重试。");
            }
            finally
            {
                _commonFun.HideLoading();
            }
        }