示例#1
0
        public string SendMessage(FormCollection context)
        {
            try
            {
                //用户ID
                string strUserID = SysVisitor.Instance.UserId;

                TB_MESSAGEMODEL mode;
                var             json    = context["json"];
                var             strJson = HttpUtility.UrlDecode(json);
                var             jObject = JObject.Parse(strJson);

                string ids     = jObject["ids"].ToString();
                string names   = jObject["names"].ToString();
                string Title   = jObject["title"].ToString();
                string content = jObject["content"].ToString();



                string[] arrayids   = ids.Split(',');
                string[] arraynames = names.Split(',');

                string message = "";

                for (int i = 0; i < arrayids.Length; i++)
                {
                    mode             = new TB_MESSAGEMODEL();
                    mode.FDATE       = DateTime.Now;
                    mode.FID         = "0";
                    mode.FRECEIVERID = arrayids[i];
                    mode.FSENDERID   = strUserID;
                    mode.FTITLE      = Title;
                    mode.FCONTENT    = System.Text.Encoding.UTF8.GetBytes(content);
                    mode.FSTATE      = 0;
                    mode.FSUBTYPE    = 0;
                    mode.FTYPE       = 0;
                    mode.FBILLNO     = "";
                    message         += TB_MessageBll.Instance.AddNewBT_MessageModel(mode, i);
                }

                if (message.Equals(""))
                {
                    message = "添加失败";
                }

                return(JSONhelper.ToJson(new { errCode = 0, errMsg = message }));
            }
            catch (Exception ex)
            {
                return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message }));
            }
        }
示例#2
0
        //添加
        public string AddNewBT_MessageModel(TB_MESSAGEMODEL model, int i)
        {
            string k   = "";
            string msg = "添加失败!";

            if (isSerialNumber(model.FID))
            {
                msg = "编号已存在!";
            }

            else
            {
                k = TB_MessageDal.Instance.Insert(model);
                if (k != "")
                {
                    msg       = "添加成功。";
                    model.FID = k;
                }
            }

            return("第" + i.ToString() + " 条消息," + msg);
        }
示例#3
0
        //修改
        public JsonMessage EditBT_MessageModel(TB_MESSAGEMODEL model)
        {
            string msg = "修改失败!";
            int    k   = 0;

            if (isFID(model.FID))
            {
                k = TB_MessageDal.Instance.Update(model);
            }
            if (k > 0)
            {
                msg = "修改成功";
            }
            else
            {
                msg = "修改失败!";
            }

            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k != 0
            });
        }
示例#4
0
        //
        // GET: /Login/

        public ActionResult Message()
        {
            string id = Request["id"];

            TB_MessageDal.Instance.UpdateWhatWhere(new { FState = 1 }, new { FID = id });

            TB_MESSAGEMODEL model = TB_MessageDal.Instance.Get(id);

            TB_SahowListMessageModel Model = new TB_SahowListMessageModel();

            Model.FID         = model.FID;
            Model.FDate       = model.FDATE;
            Model.FTitle      = model.FTITLE;
            Model.FSenderID   = model.FSENDERID;
            Model.FReceiverID = model.FID;
            Model.FState      = model.FSTATE;
            Model.FContent    = Encoding.UTF8.GetString(model.FCONTENT);
            Model.FType       = model.FTYPE;
            Model.FSubType    = model.FSUBTYPE;
            Model.FBillNo     = model.FBILLNO;

            return(View(Model));
        }
示例#5
0
        //添加
        public JsonMessage AddNewBT_MessageModel(TB_MESSAGEMODEL model)
        {
            string k   = "";
            string msg = "添加失败!";

            if (isSerialNumber(model.FID))
            {
                msg = "编号已存在!";
            }

            else
            {
                k = TB_MessageDal.Instance.Insert(model);
                if (k != "")
                {
                    msg       = "添加成功。";
                    model.FID = k;
                }
            }

            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k != ""
            });
        }