コード例 #1
0
        /// <summary>
        /// 添加文本事件
        /// </summary>
        protected void AddText()
        {
            textMol.EventCate = Request.Form["EventName"];//事件类型  菜单  关注等
            string EventId = Request.Form["EventId"];

            DelEvent();//先删除 后添加
            if (!string.IsNullOrEmpty(EventId))
            {
                eventMol         = eventBll.GetModel(Convert.ToInt32(EventId));
                eventMol.msgType = 1;
                eventMol.flat1   = 1;      //是否存在相应的消息事件 1代表已拥有
                eventBll.Update(eventMol); //更新事假的消息类型
                textMol.EventId    = Convert.ToInt32(EventId);
                textMol.msgContent = CommonMethod.CheckParamThrow(Request.Form["msgContent"]);
                if (textBll.Add(textMol) != 0)
                {
                    CommonMethod.Alert("操作成功!", "wei_MsgConfig.aspx?menuFid=" + Request.Form["fid"]);
                }
                else
                {
                    CommonMethod.Alert("系统正忙,请稍后重试!");
                }
            }
            else
            {
                CommonMethod.Alert("系统正忙,请稍后重试!");
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加图文事件
        /// </summary>
        protected void AddNews()
        {
            newsMol.EventCate = Request.Form["EventName"];//事件类型  菜单  关注等
            string EventId = Request.Form["EventId"];

            DelEvent();//先删除 后添加
            if (!string.IsNullOrEmpty(EventId))
            {
                eventMol         = eventBll.GetModel(Convert.ToInt32(EventId));
                eventMol.msgType = 2;
                eventMol.flat1   = 1;      //是否存在相应的消息事件 1代表已拥有
                eventBll.Update(eventMol); //更新事假的消息类型

                newsMol.EventId         = Convert.ToInt32(EventId);
                newsMol.newsTitle       = CommonMethod.CheckParamThrow(Request.Form["newsTitle"]);
                newsMol.newsDescription = CommonMethod.CheckParamThrow(Request.Form["newsDescription"]);
                newsMol.newsPicUrl      = CommonMethod.CheckParamThrow(Request.Form["newsPicUrl"]);
                newsMol.newsUrl         = CommonMethod.CheckParamThrow(Request.Form["newsUrl"]);
                if (newsBll.Add(newsMol) != 0)
                {
                    CommonMethod.Alert("操作成功!", "wei_MsgConfig.aspx?menuFid=" + Request.Form["fid"]);
                }
                else
                {
                    CommonMethod.Alert("系统正忙,请稍后重试!");
                }
            }
            else
            {
                CommonMethod.Alert("系统正忙,请稍后重试!");
            }
        }
コード例 #3
0
        /// <summary>
        /// 删除事件 并删除对应的消息
        /// </summary>
        protected void weixinEventDel(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                mol = bll.GetModel(Convert.ToInt32(id));
                string enentname = mol.EventName;
                int    msgType   = Convert.ToInt32(mol.msgType);
                string sql       = "";
                switch (msgType)//删除对应的消息
                {
                case 1: sql = "delete from YX_text where EventId=" + id + " and EventCate='" + enentname + "'"; break;

                case 2: sql = "delete from YX_news where EventId=" + id + " and EventCate='" + enentname + "'"; break;

                case 3: sql = "delete from YX_image where EventId=" + id + " and EventCate='" + enentname + "'"; break;

                case 4: sql = "delete from YX_voice where EventId=" + id + " and EventCate='" + enentname + "'"; break;

                case 5: sql = "delete from YX_vedio where EventId=" + id + " and EventCate='" + enentname + "'"; break;

                case 6: sql = "delete from YX_music where EventId=" + id + " and EventCate='" + enentname + "'"; break;
                }
                imp.GetSqlCount(CommandType.Text, sql);
                if (bll.Delete(Convert.ToInt32(id)))
                {
                    Response.Write("OK");
                }
                else
                {
                    Response.Write("NO");
                }
            }
            else
            {
                Response.Write("NO");
            }
            Response.End();
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            (Master.FindControl("childmenu") as Label).Text = "配置微事件";
            if (Request.Form["action"] == "text")
            {
                AddText(); return;
            }
            if (Request.Form["action"] == "news")
            {
                AddNews(); return;
            }
            if (!Page.IsPostBack)
            {
                loadMenus(Request.QueryString["msgtype"]);
                string Id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(Id))
                {
                    eventMol = eventBll.GetModel(Convert.ToInt32(Id));
                    string eventType = eventMol.msgType.ToString();
                    switch (eventType)
                    {
                    case "1": dt_text = textBll.GetList(" EventId=" + Id + " and EventCate='" + eventMol.EventName + "'").Tables[0]; break;    //文本

                    case "2": dt_News = newsBll.GetList(" EventId=" + Id + " and EventCate='" + eventMol.EventName + "'").Tables[0]; break;    //图文
                    }
                    if (dt_text.Rows.Count != 0)
                    {
                        textMol = textBll.GetModel(Convert.ToInt32(dt_text.Rows[0]["Id"]));
                    }
                    if (dt_News.Rows.Count != 0)
                    {
                        newsMol = newsBll.GetModel(Convert.ToInt32(dt_News.Rows[0]["Id"]));
                    }
                }
            }
        }