private void AddOrModify(HttpContext context)
        {
            //===============================================================
            //获取字段:【用户name】
            string id, title, isDeleted, content;
            id = title = isDeleted = content = "";

            if (null != context.Request.QueryString["id"])
            {
                id = context.Request.QueryString["id"].ToString().Trim();
            }
            if (null != context.Request.QueryString["title"])
            {
                title = context.Request.QueryString["title"].ToString().Trim();
            }
            if (null != context.Request.QueryString["isDeleted"])
            {
                isDeleted = context.Request.QueryString["isDeleted"].ToString().Trim();
            }
            if (null != context.Request.QueryString["content"])
            {
                content = context.Request.QueryString["content"].ToString().Trim();
            }

            if (id != "")
            {
                T_Notice model = bll_notice.GetModel(Convert.ToInt32(id));

                model.title = title;
                model.content = content;
                model.isDeleted = Convert.ToInt16(isDeleted);
                model.create_time = DateTime.Now;
                if (context.Session["user_id"] != null)
                {
                    model.admin_id = Convert.ToInt32(context.Session["user_id"]);
                }

                bool flag = bll_notice.Update(model);
                if (flag)
                {
                    message.flag = true;
                    message.msg = "修改成功";
                }
                else
                {
                    message.flag = false;
                    message.msg = "修改失败";
                }
            }
            else {
                T_Notice model = new T_Notice();

                model.title = title;
                model.isDeleted = Convert.ToInt16(isDeleted);
                model.content = content;
                model.create_time = DateTime.Now;
                if (context.Session["user_id"] != null)
                {
                    model.admin_id = Convert.ToInt32(context.Session["user_id"]);
                }

                int n = bll_notice.Add(model);
                if (n>0)
                {
                    message.flag = true;
                    message.msg = "添加成功";
                }
                else
                {
                    message.flag = false;
                    message.msg = "添加失败";
                }
            }

            String jsonString = JsonHelper.Object2Json<Message>(message);
            context.Response.Write(jsonString);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.T_Notice model)
 {
     return(dal.Update(model));
 }
        private void Lock(HttpContext context)
        {
            bool flag = false;
            string id = "";
            string opt = "";

            if (null != context.Request.QueryString["id"])
            {
                id = context.Request.QueryString["id"].ToString().Trim();
            }

            Model.T_Notice t_notice = new T_Notice();
            t_notice = bll_notice.GetModel(Convert.ToInt32(id));
            if (t_notice.isDeleted == 1)
            {
                t_notice.isDeleted = 0;
                opt = "开启";
            }
            else
            {
                t_notice.isDeleted = 1;
                opt = "关闭";
            }
            flag = bll_notice.Update(t_notice);

            message = new Message();
            if (flag)
            {
                message.flag = true;
                message.msg = opt + "成功";
            }
            else
            {
                message.flag = false;
                message.msg = opt + "失败";
            }
            context.Response.Write(JsonHelper.Object2Json<Message>(message));//返回给前台页面
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.T_Notice model)
 {
     return(dal.Add(model));
 }