Example #1
0
        public JsonResult AppMsg()
        {
            string msgID = Request.Params["msgID"];
            string fName = Request.Params["fName"];
            string msgContent = "<li>" + fName + ": " + Request.Params["msgContent"] + "</li>";

            LC_Msg lcMsg = db.sp_LC_SearchMsg(msgID).First();
            if ((Request.Params["msgContent"].Trim()).Equals("Dialog has been finished."))
            {
                lcMsg.Status = "F";
            }
            lcMsg.UserID = Request.Params["userID"];
            lcMsg.MsgContent += msgContent;
            db.SaveChanges();

            Message msg = new Message();
            msg.MsgID = lcMsg.MsgID;
            msg.MsgContent = lcMsg.MsgContent;
            msg.UserID = lcMsg.UserID;
            msg.PostTime = lcMsg.PostTime.ToString();
            msg.FName = lcMsg.FName;
            msg.LName = lcMsg.LName;
            msg.Status = lcMsg.Status;

            return Json(new { msg = msg }, JsonRequestBehavior.DenyGet);
        }
Example #2
0
        public JsonResult AppMsg()
        {
            string msgID = Request.Params["msgID"];
            string fName = Request.Params["fName"];
            string msgContent = "<li>" + fName + ": " + Request.Params["msgContent"] + "</li>";

            LC_Msg msg = new LC_Msg();
            Message message = new Message();
            message.MsgID = msgID;
            message.MsgContent = msgContent;

            using (LiveChatEntities db = new LiveChatEntities())
            {
                msg = message.UserSave();
            }

            return Json(new { msg = msg }, JsonRequestBehavior.DenyGet);
        }
Example #3
0
        public JsonResult CreateMsg()
        {
            string fName = Request.Params["fName"];
            string lName = Request.Params["lName"];

            Message message = new Message();
            LC_Msg msg = new LC_Msg();

            using (LiveChatEntities db = new LiveChatEntities())
            {
                if (fName != "" && lName != "")
                {
                    message.FName = fName;
                    message.LName = lName;
                    msg = message.Save();
                }
                else
                {
                    msg = null;
                }
            }

            return Json(new { msg = msg }, JsonRequestBehavior.DenyGet);
        }
Example #4
0
        public JsonResult MessageDetails()
        {
            List<LC_Msg> lcMsgList = new List<LC_Msg>();

            lcMsgList = (from lcMsg in db.LC_Msg
                         select lcMsg).ToList();

            List<Message> msgList = new List<Message>();
            Message msg;
            foreach (var lcMsg in lcMsgList)
            {
                msg = new Message();
                msg.MsgID = lcMsg.MsgID;
                msg.MsgContent = lcMsg.MsgContent;
                msg.UserID = lcMsg.UserID;
                var postTime = lcMsg.PostTime ?? DateTime.Now;
                msg.PostTime = postTime.ToString("yyyy/MM/dd");
                msg.FName = lcMsg.FName;
                msg.LName = lcMsg.LName;
                msg.Status = lcMsg.Status;
                msgList.Add(msg);
            }

            return Json(new { msgList = msgList }, JsonRequestBehavior.AllowGet);
        }