示例#1
0
        public ActionResult ReplyMsg(int id, FormCollection col)
        {
            string msg = col["Msg"];

            if (string.IsNullOrEmpty(msg))
            {
                msg = "内容不能为空,描述下您想咨询的事情吧!";
                return(RedirectToAction("msgdetail", new { id = id, msg = msg }));
            }
            int             touser = string.IsNullOrEmpty(col["ToUser"]) ? 0 : int.Parse(col["ToUser"]);
            Inpinke_Message model  = new Inpinke_Message()
            {
                ReplyID  = id,
                Msg      = col["Msg"],
                FromUser = UserSession.CurrentUser.ID,
                ToUser   = touser,
                MsgType  = (int)MsgType.UserReply
            };
            BaseResponse br = DBMessageBLL.SendMessage(model);

            return(RedirectToAction("msgdetail", new { id = id, msg = br.Message }));
        }
示例#2
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static BaseResponse SendMessage(Inpinke_Message model)
        {
            BaseResponse br = new BaseResponse();

            try
            {
                model.CreateTime = DateTime.Now;
                model.UpdateTime = DateTime.Now;
                model.Status     = (int)RecordStatus.Nomral;
                model.MsgStatus  = (int)MsgStatus.NoRead;
                model.InsertWhenSubmit(InpinkeDataContext.Instance);
                InpinkeDataContext.Instance.Submit();
                br.IsSuccess   = true;
                br.ResponseObj = model;
            }
            catch (Exception ex)
            {
                br.IsSuccess = false;
                br.Message   = "发送消息失败,请稍后再试";
                Logger.Error(string.Format("SendMessage FromUser:{0},ToUser:{1},Error:{2}", model.FromUser, model.ToUser, ex.ToString()));
            }
            return(br);
        }