示例#1
0
        public ActionResult savemsg(string title, string cate, string forids, string fornames, string remark,string attrname,string attrguid)
        {
            Guid msg = Guid.NewGuid();
            MsgSend send = new MsgSend();
            send.createDate = DateTime.Now;
            send.isDelete = false;
            send.msgcate = cate;
            send.hadAttr = false;
            send.msgcontent = remark;
            send.msgId = msg;
            send.receIds = forids;
            send.receNames = fornames;
            send.staffId = Masterpage.CurrUser.staffid;
            send.title = title;
            if (attrname != null && attrname != "" && attrguid != null && attrguid != "")
            {
                send.hadAttr = true;
                ServiceDB.Instance.ExecuteSqlCommand("insert into Attachment values(newid(),'" + msg + "','" + attrguid + "','" + attrname + "','',getdate())");
            }

            bool exc = manageService.SaveSendMessage(send);
            int rececount = 0;
            if (exc)
            {
                string[] rece = forids.Split(',');
                foreach (var item in rece)
                {
                    if (item != "")
                    {
                        var row = ServiceDB.Instance.ExecuteSqlCommand("insert into MsgRece values('" + msg + "'," + item + ",0,null,0,null)");
                        rececount += row;
                    }
                }
            }
            ReturnValue r = new ReturnValue();
            r.status = rececount > 0;
            return Json(r, JsonRequestBehavior.AllowGet);
        }
示例#2
0
 public bool SaveSendMessage(MsgSend send)
 {
     return _manageRepository.SaveSendMessage(send);
 }