Beispiel #1
0
 public async Task <ResponseMessage <int> > UpdateAsync([FromBody] OaMailReceiver oaMailReceiver)
 {
     //OaMailReceiver entity = await _oaMailReceiverService.GetByIdAsync(oaMailReceiver.id);
     //Utils.CommmonUtils.EntityToEntity(oaMailReceiver, entity, null);
     //return new ResponseMessage<int> { data = await _oaMailReceiverService.UpdateAsync(entity) };
     return(new ResponseMessage <int> {
         data = await _oaMailReceiverService.UpdateAsync(oaMailReceiver)
     });
 }
Beispiel #2
0
        public ResponseMessage <int> SendMail([FromBody] OwnQueryRequest reqMsg)
        {
            OaMail oaMail = new OaMail();

            oaMail.title        = reqMsg.title;
            oaMail.content      = reqMsg.content;
            oaMail.publish_time = DateTime.Now;
            oaMail.group_id     = "GXBBWGKGLJ";
            var tf     = _oaMailService.Insert(oaMail);
            var mailid = _oaMailService.QueryId(reqMsg.title, (DateTime)oaMail.publish_time, oaMail.group_id);
            var files  = reqMsg.filenames.Split(',').ToList();

            for (int i = 0; i < files.Count; i++)
            {
                if (i == 0)
                {
                    files[i] = files[i] + "'";
                }
                else if (i == files.Count - 1)
                {
                    files[i] = "'" + files[i];
                }
                else
                {
                    files[i] = "'" + files[i] + "'";
                }
            }
            string attachids = _oaAttachmentService.QueryId(string.Join(',', files));

            foreach (var item in reqMsg.reciervers.Split(','))
            {
                OaMailReceiver oaMailReceiver = new OaMailReceiver();
                oaMailReceiver.mail_id    = mailid;
                oaMailReceiver.mail_title = reqMsg.title;
                var idarr = item.Split('#');
                oaMailReceiver.receiver_id   = long.Parse(idarr[0]);
                oaMailReceiver.receiver_name = idarr[1];
                TokenModel jwtToken = new TokenModel();
                jwtToken = JwtHelper.SerializeJWT(reqMsg.token);
                oaMailReceiver.sender_id      = long.Parse(jwtToken.Uid);
                oaMailReceiver.sender_name    = jwtToken.UserName;
                oaMailReceiver.attachment_ids = attachids;
                oaMailReceiver.send_time      = DateTime.Now;
                _oaMailReceiverService.Insert(oaMailReceiver);
            }
            return(new ResponseMessage <int> {
                data = int.Parse(tf)
            });
        }
Beispiel #3
0
        public Response <string> SendMail([FromBody] OaMailQueryRequest reqMsg)
        {
            var result = new Response <string>();
            //获取当前用户信息
            var user = _authUtil.GetCurrentUser().User;

            try
            {
                OaMail oaMail = new OaMail();
                oaMail.title        = reqMsg.title;
                oaMail.content      = reqMsg.content;
                oaMail.publish_time = DateTime.Now;
                oaMail.group_id     = "GXBBWGKGLJ";
                string id = _mailapp.Add(oaMail);
                result.Result = id;
                var files = reqMsg.files;
                foreach (var item in reqMsg.reciervers.Split(','))
                {
                    OaMailReceiver oaMailReceiver = new OaMailReceiver();
                    oaMailReceiver.mail_id    = id;
                    oaMailReceiver.mail_title = reqMsg.title;
                    var idarr = item.Split('#');
                    oaMailReceiver.receiver_id    = idarr[0];
                    oaMailReceiver.receiver_name  = idarr[1];
                    oaMailReceiver.sender_id      = user.Id;
                    oaMailReceiver.sender_name    = user.Name;
                    oaMailReceiver.attachment_ids = reqMsg.files;
                    oaMailReceiver.send_time      = DateTime.Now;
                    _mailReceiverapp.Add(oaMailReceiver);
                }
            }
            catch (Exception ex)
            {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }

            return(result);
        }
Beispiel #4
0
 ///<summary>
 ///异步更新
 ///</summary>
 public async Task <int> UpdateAsync(OaMailReceiver oaMailReceiver)
 {
     return(await OaMailReceiverRepository.UpdateAsync(oaMailReceiver));
 }
Beispiel #5
0
 ///<summary>
 ///更新
 ///</summary>
 public int Update(OaMailReceiver oaMailReceiver)
 {
     return(OaMailReceiverRepository.Update(oaMailReceiver));
 }
Beispiel #6
0
 ///<summary>
 ///异步新增
 ///</summary>
 public async Task <string> InsertAsync(OaMailReceiver oaMailReceiver)
 {
     return(await OaMailReceiverRepository.InsertAsync(oaMailReceiver));
 }
Beispiel #7
0
 ///<summary>
 ///新增
 ///</summary>
 public string Insert(OaMailReceiver oaMailReceiver)
 {
     return(OaMailReceiverRepository.Insert(oaMailReceiver));
 }
Beispiel #8
0
 public ResponseMessage <int> Update([FromBody] OaMailReceiver oaMailReceiver)
 {
     return(new ResponseMessage <int> {
         data = _oaMailReceiverService.Update(oaMailReceiver)
     });
 }
Beispiel #9
0
 public async Task <ResponseMessage <string> > InsertAsync([FromBody] OaMailReceiver oaMailReceiver)
 {
     return(new ResponseMessage <string> {
         data = await _oaMailReceiverService.InsertAsync(oaMailReceiver)
     });
 }
Beispiel #10
0
 public ResponseMessage <string> Insert([FromBody] OaMailReceiver oaMailReceiver)
 {
     return(new ResponseMessage <string> {
         data = _oaMailReceiverService.Insert(oaMailReceiver)
     });
 }