Example #1
0
        /// <summary>
        /// 添加文本事件
        /// </summary>
        protected void AddText()
        {
            DelEvent();//先删除原来的事件  再添加新事件
            //
            string EventId = Request.Form["EventId"];

            if (!string.IsNullOrEmpty(EventId))
            {
                menuMol       = menuBll.GetModel(Convert.ToInt32(EventId));
                menuMol.flat1 = 1;       //代表发送文本
                menuBll.Update(menuMol); //更新数据
                textMol.EventId    = Convert.ToInt32(EventId);
                textMol.msgContent = CommonMethod.CheckParamThrow(Request.Form["msgContent"]);
                textMol.EventCate  = "menu";//事件类型 菜单
                if (textBll.Add(textMol) != 0)
                {
                    CommonMethod.Alert("恭喜编辑菜单成功!", "wei_MenusConfig.aspx?menuFid=" + Request.Form["fid"]);
                }
                else
                {
                    CommonMethod.Alert("系统正忙,请稍后重试!");
                }
            }
            else
            {
                CommonMethod.Alert("系统正忙,请稍后重试!");
            }
        }
Example #2
0
        /// <summary>
        /// 添加图文事件
        /// </summary>
        protected void AddNews()
        {
            DelEvent();//先删除原来的事件  再添加新事件
            //
            string EventId = Request.Form["EventId"];

            if (!string.IsNullOrEmpty(EventId))
            {
                menuMol       = menuBll.GetModel(Convert.ToInt32(EventId));
                menuMol.flat1 = 2;       //代表发送图文
                menuBll.Update(menuMol); //更新数据
                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"]); newsMol.EventCate = "menu";//事件类型 菜单
                if (newsBll.Add(newsMol) != 0)
                {
                    CommonMethod.Alert("恭喜编辑菜单成功!", "wei_MenusConfig.aspx?menuFid=" + Request.Form["fid"]);
                }
                else
                {
                    CommonMethod.Alert("系统正忙,请稍后重试!");
                }
            }
            else
            {
                CommonMethod.Alert("系统正忙,请稍后重试!");
            }
        }
Example #3
0
 /// <summary>
 /// 检测菜单是否可以加事件
 /// </summary>
 /// <param name="Id">菜单Id</param>
 protected void checkMenu(string Id)
 {
     if (!string.IsNullOrEmpty(Id))
     {
         mol = bll.GetModel(Convert.ToInt32(Id));
         if (mol.WX_Fid == 0)//如果是一级菜单  则不可以
         {
             Response.Write("NOO");
         }
         else
         {
             if (mol.WX_MenuType != "1")//菜单事件不是click
             {
                 Response.Write("NO");
             }
             else
             {
                 Response.Write("OK");
             }
         }
     }
     else
     {
         Response.Write("error");
     }
     Response.End();
 }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BrnMall.Core.Model.YX_weiXinMenus model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into YX_weiXinMenus(");
            strSql.Append("WX_menuName,WX_MenuType,WX_MenusKey_URL,WX_Fid,WX_AddTime,remark1,remark2,remark3,flat1,flat2,remark4,remark5,remark6,flat7,flat8,RegTim1,RegTim2)");
            strSql.Append(" values (");
            strSql.Append("@WX_menuName,@WX_MenuType,@WX_MenusKey_URL,@WX_Fid,@WX_AddTime,@remark1,@remark2,@remark3,@flat1,@flat2,@remark4,@remark5,@remark6,@flat7,@flat8,@RegTim1,@RegTim2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WX_menuName",     SqlDbType.NVarChar,    20),
                new SqlParameter("@WX_MenuType",     SqlDbType.VarChar,     20),
                new SqlParameter("@WX_MenusKey_URL", SqlDbType.VarChar,   1000),
                new SqlParameter("@WX_Fid",          SqlDbType.Int,          4),
                new SqlParameter("@WX_AddTime",      SqlDbType.DateTime),
                new SqlParameter("@remark1",         SqlDbType.NVarChar,   500),
                new SqlParameter("@remark2",         SqlDbType.NVarChar,   500),
                new SqlParameter("@remark3",         SqlDbType.NText),
                new SqlParameter("@flat1",           SqlDbType.Int,          4),
                new SqlParameter("@flat2",           SqlDbType.Int,          4),
                new SqlParameter("@remark4",         SqlDbType.NVarChar,    50),
                new SqlParameter("@remark5",         SqlDbType.NVarChar,    50),
                new SqlParameter("@remark6",         SqlDbType.NText),
                new SqlParameter("@flat7",           SqlDbType.Int,          4),
                new SqlParameter("@flat8",           SqlDbType.Int,          4),
                new SqlParameter("@RegTim1",         SqlDbType.DateTime),
                new SqlParameter("@RegTim2",         SqlDbType.DateTime)
            };
            parameters[0].Value  = model.WX_menuName;
            parameters[1].Value  = model.WX_MenuType;
            parameters[2].Value  = model.WX_MenusKey_URL;
            parameters[3].Value  = model.WX_Fid;
            parameters[4].Value  = model.WX_AddTime;
            parameters[5].Value  = model.remark1;
            parameters[6].Value  = model.remark2;
            parameters[7].Value  = model.remark3;
            parameters[8].Value  = model.flat1;
            parameters[9].Value  = model.flat2;
            parameters[10].Value = model.remark4;
            parameters[11].Value = model.remark5;
            parameters[12].Value = model.remark6;
            parameters[13].Value = model.flat7;
            parameters[14].Value = model.flat8;
            parameters[15].Value = model.RegTim1;
            parameters[16].Value = model.RegTim2;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #5
0
        /// <summary>
        ///检测是否拥有事件,已拥有,则可编辑事件!
        /// </summary>
        /// <param name="id">菜单Id</param>
        protected void cekevent2(string id)
        {
            mol = bll.GetModel(Convert.ToInt32(id));
            int flat = Convert.ToInt32(mol.flat1);

            if (flat != 0)//已添加事件
            {
                Response.Write("OK");
            }
            else
            {
                Response.Write("NO");
            }
            Response.End();
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                (Master.FindControl("childmenu") as Label).Text = "微事件编辑";
                string id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    mol       = bll.GetModel(Convert.ToInt32(id));
                    eventType = mol.flat1.ToString();

                    switch (eventType)
                    {
                    case "1": dt_text = textBll.GetList(" EventId=" + id + " and EventCate='menu'").Tables[0]; break;    //文本

                    case "2": dt_News = newsBll.GetList(" EventId=" + id + " and EventCate='menu'").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"]));
                    }
                }
            }

            if (Request.Form["action"] == "text")
            {
                AddText();
            }
            if (Request.Form["action"] == "news")
            {
                AddNews();
            }
        }
Example #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BrnMall.Core.Model.YX_weiXinMenus GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,WX_menuName,WX_MenuType,WX_MenusKey_URL,WX_Fid,WX_AddTime,remark1,remark2,remark3,flat1,flat2,remark4,remark5,remark6,flat7,flat8,RegTim1,RegTim2 from YX_weiXinMenus ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            BrnMall.Core.Model.YX_weiXinMenus model = new BrnMall.Core.Model.YX_weiXinMenus();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WX_menuName"] != null && ds.Tables[0].Rows[0]["WX_menuName"].ToString() != "")
                {
                    model.WX_menuName = ds.Tables[0].Rows[0]["WX_menuName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WX_MenuType"] != null && ds.Tables[0].Rows[0]["WX_MenuType"].ToString() != "")
                {
                    model.WX_MenuType = ds.Tables[0].Rows[0]["WX_MenuType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WX_MenusKey_URL"] != null && ds.Tables[0].Rows[0]["WX_MenusKey_URL"].ToString() != "")
                {
                    model.WX_MenusKey_URL = ds.Tables[0].Rows[0]["WX_MenusKey_URL"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WX_Fid"] != null && ds.Tables[0].Rows[0]["WX_Fid"].ToString() != "")
                {
                    model.WX_Fid = int.Parse(ds.Tables[0].Rows[0]["WX_Fid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WX_AddTime"] != null && ds.Tables[0].Rows[0]["WX_AddTime"].ToString() != "")
                {
                    model.WX_AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["WX_AddTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["remark1"] != null && ds.Tables[0].Rows[0]["remark1"].ToString() != "")
                {
                    model.remark1 = ds.Tables[0].Rows[0]["remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark2"] != null && ds.Tables[0].Rows[0]["remark2"].ToString() != "")
                {
                    model.remark2 = ds.Tables[0].Rows[0]["remark2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark3"] != null && ds.Tables[0].Rows[0]["remark3"].ToString() != "")
                {
                    model.remark3 = ds.Tables[0].Rows[0]["remark3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["flat1"] != null && ds.Tables[0].Rows[0]["flat1"].ToString() != "")
                {
                    model.flat1 = int.Parse(ds.Tables[0].Rows[0]["flat1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["flat2"] != null && ds.Tables[0].Rows[0]["flat2"].ToString() != "")
                {
                    model.flat2 = int.Parse(ds.Tables[0].Rows[0]["flat2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["remark4"] != null && ds.Tables[0].Rows[0]["remark4"].ToString() != "")
                {
                    model.remark4 = ds.Tables[0].Rows[0]["remark4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark5"] != null && ds.Tables[0].Rows[0]["remark5"].ToString() != "")
                {
                    model.remark5 = ds.Tables[0].Rows[0]["remark5"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark6"] != null && ds.Tables[0].Rows[0]["remark6"].ToString() != "")
                {
                    model.remark6 = ds.Tables[0].Rows[0]["remark6"].ToString();
                }
                if (ds.Tables[0].Rows[0]["flat7"] != null && ds.Tables[0].Rows[0]["flat7"].ToString() != "")
                {
                    model.flat7 = int.Parse(ds.Tables[0].Rows[0]["flat7"].ToString());
                }
                if (ds.Tables[0].Rows[0]["flat8"] != null && ds.Tables[0].Rows[0]["flat8"].ToString() != "")
                {
                    model.flat8 = int.Parse(ds.Tables[0].Rows[0]["flat8"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RegTim1"] != null && ds.Tables[0].Rows[0]["RegTim1"].ToString() != "")
                {
                    model.RegTim1 = DateTime.Parse(ds.Tables[0].Rows[0]["RegTim1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RegTim2"] != null && ds.Tables[0].Rows[0]["RegTim2"].ToString() != "")
                {
                    model.RegTim2 = DateTime.Parse(ds.Tables[0].Rows[0]["RegTim2"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BrnMall.Core.Model.YX_weiXinMenus model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update YX_weiXinMenus set ");
            strSql.Append("WX_menuName=@WX_menuName,");
            strSql.Append("WX_MenuType=@WX_MenuType,");
            strSql.Append("WX_MenusKey_URL=@WX_MenusKey_URL,");
            strSql.Append("WX_Fid=@WX_Fid,");
            strSql.Append("WX_AddTime=@WX_AddTime,");
            strSql.Append("remark1=@remark1,");
            strSql.Append("remark2=@remark2,");
            strSql.Append("remark3=@remark3,");
            strSql.Append("flat1=@flat1,");
            strSql.Append("flat2=@flat2,");
            strSql.Append("remark4=@remark4,");
            strSql.Append("remark5=@remark5,");
            strSql.Append("remark6=@remark6,");
            strSql.Append("flat7=@flat7,");
            strSql.Append("flat8=@flat8,");
            strSql.Append("RegTim1=@RegTim1,");
            strSql.Append("RegTim2=@RegTim2");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WX_menuName",     SqlDbType.NVarChar,    20),
                new SqlParameter("@WX_MenuType",     SqlDbType.VarChar,     20),
                new SqlParameter("@WX_MenusKey_URL", SqlDbType.VarChar,   1000),
                new SqlParameter("@WX_Fid",          SqlDbType.Int,          4),
                new SqlParameter("@WX_AddTime",      SqlDbType.DateTime),
                new SqlParameter("@remark1",         SqlDbType.NVarChar,   500),
                new SqlParameter("@remark2",         SqlDbType.NVarChar,   500),
                new SqlParameter("@remark3",         SqlDbType.NText),
                new SqlParameter("@flat1",           SqlDbType.Int,          4),
                new SqlParameter("@flat2",           SqlDbType.Int,          4),
                new SqlParameter("@remark4",         SqlDbType.NVarChar,    50),
                new SqlParameter("@remark5",         SqlDbType.NVarChar,    50),
                new SqlParameter("@remark6",         SqlDbType.NText),
                new SqlParameter("@flat7",           SqlDbType.Int,          4),
                new SqlParameter("@flat8",           SqlDbType.Int,          4),
                new SqlParameter("@RegTim1",         SqlDbType.DateTime),
                new SqlParameter("@RegTim2",         SqlDbType.DateTime),
                new SqlParameter("@Id",              SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.WX_menuName;
            parameters[1].Value  = model.WX_MenuType;
            parameters[2].Value  = model.WX_MenusKey_URL;
            parameters[3].Value  = model.WX_Fid;
            parameters[4].Value  = model.WX_AddTime;
            parameters[5].Value  = model.remark1;
            parameters[6].Value  = model.remark2;
            parameters[7].Value  = model.remark3;
            parameters[8].Value  = model.flat1;
            parameters[9].Value  = model.flat2;
            parameters[10].Value = model.remark4;
            parameters[11].Value = model.remark5;
            parameters[12].Value = model.remark6;
            parameters[13].Value = model.flat7;
            parameters[14].Value = model.flat8;
            parameters[15].Value = model.RegTim1;
            parameters[16].Value = model.RegTim2;
            parameters[17].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }