コード例 #1
0
ファイル: NewsMenuDao.cs プロジェクト: zklve/NewsWebsite
        /// <summary>
        ///  更新数据
        /// </summary>
        /// Author  :Napoleon
        /// Created :2015-06-06 02:02:25
        public int UpdateNewsMenu(NewsMenu model)
        {
            int i = 0;

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendFormat("update News_Menu set Id=@Id,ParentId=@ParentId,MenuName=@MenuName,IsParent=@IsParent,IsUse=@IsUse,OperationTime=@OperationTime,OrderBy=@OrderBy where Id=@Id");
                i = DbHelper.ExecuteSql(sql.ToString(), model);
            }
            catch (Exception exception)
            {
                Log4Dao.InsertLog4(exception.Message);
            }
            return(i);
        }
コード例 #2
0
ファイル: NewsMenuDao.cs プロジェクト: zklve/NewsWebsite
        /// <summary>
        ///  新增数据
        /// </summary>
        /// Author  :Napoleon
        /// Created :2015-06-06 02:02:25
        public int InsertNewsMenu(NewsMenu model)
        {
            int i;

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendFormat("insert into News_Menu(Id,ParentId,MenuName,IsParent,IsUse,OperationTime,OrderBy) values(@Id,@ParentId,@MenuName,@IsParent,@IsUse,@OperationTime,@OrderBy)");
                i = DbHelper.ExecuteSql(sql.ToString(), model);
            }
            catch (Exception exception)
            {
                i = -1;
                Log4Dao.InsertLog4(exception.Message);
            }
            return(i);
        }
コード例 #3
0
        /// <summary>
        ///  保存新增的新闻菜单
        /// </summary>
        /// <param name="menuName">菜单名称</param>
        /// <param name="isParent">是否父菜单</param>
        /// <param name="parentId">父菜单ID</param>
        /// <param name="isUse">是否可用</param>
        /// <param name="orderBy">排序</param>
        /// Author  : Napoleon
        /// Created : 2015-06-09 15:37:10
        public ActionResult SaveAdd(string menuName, string isParent, string parentId, string isUse, decimal orderBy)
        {
            string   status = "failue", msg = "新增失败!", json;
            NewsMenu menu = new NewsMenu();

            menu.Id            = CustomId.GetCustomId();
            menu.MenuName      = menuName;
            menu.ParentId      = parentId;
            menu.IsParent      = isParent;
            menu.IsUse         = int.Parse(isUse);
            menu.OrderBy       = orderBy;
            menu.OperationTime = DateTime.Now;
            int i = _menuService.InsertNewsMenu(menu);

            switch (i)
            {
            case 1:
                status = "success";
                msg    = "新增成功!";
                break;
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }
コード例 #4
0
ファイル: NewsMenuService.cs プロジェクト: zklve/NewsWebsite
 /// <summary>
 ///  更新数据
 /// </summary>
 /// Author  :Napoleon
 /// Created :2015-06-06 02:02:25
 public int UpdateNewsMenu(NewsMenu model)
 {
     return(_newsmenuDao.UpdateNewsMenu(model));
 }
コード例 #5
0
ファイル: NewsMenuService.cs プロジェクト: zklve/NewsWebsite
 /// <summary>
 ///  新增数据
 /// </summary>
 /// Author  :Napoleon
 /// Created :2015-06-06 02:02:25
 public int InsertNewsMenu(NewsMenu model)
 {
     return(_newsmenuDao.InsertNewsMenu(model));
 }