Ejemplo n.º 1
0
        /// <summary>
        /// 添加通知
        /// </summary>
        /// <param name="input_param"></param>
        /// <param name="output"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool AddNotice(NoticeAddDto input_param, ref ReturnNoticeAddDto output, ref string errMsg)
        {
            bool result = HttpCommonMethod <NoticeAddDto, ReturnNoticeAddDto>("/notifications/group/add", GlobalVariable.RequestMethod.POST, input_param, ref output, ref errMsg);

            if (result && output.result == (int)GlobalVariable.Result.Failure)
            {
                errMsg = string.IsNullOrEmpty(output.errorCode) ? "添加通知失败" : resources.GetString("E_" + output.errorCode);
                return(false);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <NoticeDto> > CreateNotice([FromBody] NoticeAddDto noticeAddDto)
        {
            //ApiController在遇到noticeAddDto为空时可以自动返回400错误
            var notice = _mapper.Map <Notice>(noticeAddDto);

            _noticeRepository.AddNotice(notice);//只是被添加到DbContext里
            await _noticeRepository.SaveAsync();

            var noticeDto = _mapper.Map <NoticeDto>(notice);

            return(CreatedAtRoute(nameof(GetNotice), new { noticeId = notice.NoticeId }, noticeDto));
        }
        public NoticeDetailsWindowViewModel(NoticeWindowListsViewModel notice, NoticeAddDto dtos)
        {
            this.notice = notice;
            this.dtos   = dtos;
            //inFindDetailsNotice inData = new inFindDetailsNotice();
            //inData.userId = AntSdkService.AntSdkCurrentUserInfo.userId;
            //inData.version = "1.0";
            //inData.notificationId = dtos.notificationId;
            //inData.token = AntSdkService.AntSdkLoginOutput.token;
            //ReturnNoticeAddDto rData = null;
            var    errorCode = 0;
            string errorMsg  = "";
            //TODO:AntSdk_Modify
            //DONE:AntSdk_Modify
            var result = AntSdkService.GetNotificationsById(dtos.notificationId, ref errorCode, ref errorMsg);

            //bool result = false;//new HttpService().SearchNoticeDetailsByNoticeId(inData, ref rData, ref errorMsg, GlobalVariable.RequestMethod.GET);
            if (result != null)
            {
                noticeTitle   = result.title;
                noticeContent = result.content;

                explain = result.createBy + "  编辑于  " + DataConverter.FormatTimeByTimeStamp(result.createTime);
                if (result.attach != null)
                {
                    gridHeight = 90;
                    List <data> datas = JsonConvert.DeserializeObject <List <data> >(result.attach);

                    foreach (var list in datas)
                    {
                        if (list == null)
                        {
                            continue;
                        }
                        AddAttachmentDto add = new AddAttachmentDto();
                        add.fileGuid = Guid.NewGuid().ToString().Replace("-", "");
                        add.fileName = list.fileName;
                        if (Convert.ToInt32(list.fileSize) < 1024)
                        {
                            add.fileLength = list.fileSize + "B";
                        }
                        if (Convert.ToInt32(list.fileSize) > 1024)
                        {
                            add.fileLength = Math.Round((double)Convert.ToInt32(list.fileSize) / 1024, 2) + "KB";
                        }
                        if (Convert.ToInt32(list.fileSize) > 1024 * 1024)
                        {
                            add.fileLength = Math.Round((double)Convert.ToInt32(list.fileSize) / 1024 / 1024, 2) + "MB";
                        }
                        add.localPath     = list.downloadURL;
                        add.fileimageShow = fileShowImage.showImageHtmlPath(list.fileType, "");
                        add.btnStatus     = "downLoad";
                        add.btnforeground = "0";
                        _attachment.Add(add);
                    }
                }
                else
                {
                    gridHeight = 0;
                }
            }
        }