/// <summary> /// 添加底部菜单 /// </summary> /// <param name="id"></param> /// <param name="description"></param> /// <param name="imageUrl"></param> /// <param name="url"></param> /// <returns></returns> public JsonResult AddFootMenu(string id, string description, string imageUrl, string url) { BaseController.Result result = new BaseController.Result(); MobileFootMenuInfo footmenu = new MobileFootMenuInfo(); long num = 0L; if (!string.IsNullOrEmpty(id)) { num = Convert.ToInt64(id); } footmenu.Id = Convert.ToInt64(num); footmenu.MenuIcon = imageUrl; footmenu.Url = url.ToLower(); footmenu.Name = HttpUtility.UrlDecode(description); if (footmenu.Id > 0L) { this._iWeixinMenuService.UpdateMobileFootMenu(footmenu); } else { this._iWeixinMenuService.AddMobileFootMenu(footmenu); } result.success = true; if (result.success) { return(this.Json((object)new { status = "0" })); } return(this.Json((object)new { status = "1" })); }
/// <summary> /// 读取底部菜单根据ID /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult GetFootMenuInfoById(string id) { if (!(id != "undefined")) { return(this.Json((object)new { status = "1" })); } MobileFootMenuInfo footMenusById = this._iWeixinMenuService.GetFootMenusById(Convert.ToInt64(id)); if (footMenusById == null) { return(this.Json((object)new { status = "1" })); } var fAnonymousType8f = new { menuid = footMenusById.Id, type = "", name = footMenusById.Name, shopmenupic = footMenusById.MenuIcon, content = footMenusById.Url }; return(this.Json((object)new { status = "0", data = fAnonymousType8f })); }
/// <summary> /// 修改导航栏 /// </summary> /// <param name="footmenu"></param> public void UpdateMobileFootMenu(MobileFootMenuInfo footmenu) { DbFactory.Default .Set <MobileFootMenuInfo>() .Set(n => n.Name, footmenu.Name) .Set(n => n.Url, footmenu.Url) .Set(n => n.MenuIcon, footmenu.MenuIcon) .Where(n => n.Id == footmenu.Id) .Succeed(); }
/// <summary> /// 添加底部菜单 /// </summary> /// <param name="footmenu"></param> public void AddMobileFootMenu(MobileFootMenuInfo footmenu) { using (DbConnection dbConnection = (DbConnection) new MySqlConnection(Connection.ConnectionString)) { dbConnection.Open(); DbCommand command = dbConnection.CreateCommand(); command.CommandText = "INSERT INTO Himall_MobileFootMenus (Name, Url, MenuIcon)VALUES (@Name, @Url, @MenuIcon)"; command.Parameters.Add((object)new MySqlParameter("@Name", (object)footmenu.Name)); command.Parameters.Add((object)new MySqlParameter("@Url", (object)footmenu.Url)); command.Parameters.Add((object)new MySqlParameter("@MenuIcon", (object)footmenu.MenuIcon)); command.ExecuteNonQuery(); } }
/// <summary> /// 增加导航栏 /// </summary> /// <param name="footmenu"></param> public void AddMobileFootMenu(MobileFootMenuInfo footmenu) { DbFactory.Default.Add(footmenu); }
/// <summary> /// 更新底部菜单 /// </summary> /// <param name="footmenu"></param> public void UpdateMobileFootMenu(MobileFootMenuInfo footmenu) { this.Context.Database.ExecuteSqlCommand("UPDATE Himall_MobileFootMenus SET Name=@p1,Url=@p2,MenuIcon=@p3 WHERE Id=@p0", (object)footmenu.Id, (object)footmenu.Name, (object)footmenu.Url, (object)footmenu.MenuIcon); }