Nopcommerce 二次开发2 Admin
Admin
菜单 增加 siteMap.config增加一行
<siteMapNode SystemName="Hotels" nopResource="Admin.Catalog.Hotels" PermissionNames="ManageProducts" controller="Hotel" action="List" IconClass="fa-dot-circle-o"/>
Controllers 增加新控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Nop.Admin.Extensions;
using Nop.Admin.Models.Blogs;
using Nop.Core.Domain.Blogs;
using Nop.Core.Domain.Customers;
using Nop.Services.Hotels;
using Nop.Services.Helpers;
using Nop.Services.Localization;
using Nop.Services.Security;
using Nop.Services.Seo;
using Nop.Services.Stores;
using Nop.Web.Framework;
using Nop.Web.Framework.Controllers;
using Nop.Web.Framework.Kendoui;
using Nop.Web.Framework.Mvc; namespace Nop.Admin.Controllers
{
public class HotelController : Controller
{ #region Fields private readonly IHotelService _hotelService;
private readonly ILanguageService _languageService;
private readonly IDateTimeHelper _dateTimeHelper;
private readonly ILocalizationService _localizationService;
private readonly IPermissionService _permissionService;
private readonly IUrlRecordService _urlRecordService;
private readonly IStoreService _storeService;
private readonly IStoreMappingService _storeMappingService; #endregion #region Constructors public HotelController(IHotelService hotelService, ILanguageService languageService,
IDateTimeHelper dateTimeHelper,
ILocalizationService localizationService, IPermissionService permissionService,
IUrlRecordService urlRecordService,
IStoreService storeService, IStoreMappingService storeMappingService)
{
this._hotelService = hotelService;
this._languageService = languageService;
this._dateTimeHelper = dateTimeHelper;
this._localizationService = localizationService;
this._permissionService = permissionService;
this._urlRecordService = urlRecordService;
this._storeService = storeService;
this._storeMappingService = storeMappingService;
} #endregion // GET: Hotel
public ActionResult Index()
{
return View();
} public ActionResult List()
{
return View();
} [HttpPost]
public ActionResult List(DataSourceRequest command)
{
var hotels = _hotelService.GetAllHotels(command.Page-,command.PageSize,true);
var gridModel = new DataSourceResult
{
Data=hotels,
Total=hotels.TotalCount
};
return Json(gridModel); }
}
}
视图 增加 List.cshtml
@{
    //page title
    ViewBag.Title = T("Admin.Catalog.Manufacturers").Text;
}
@Html.AntiForgeryToken()
<div class="content-header clearfix">
    <h1 class="pull-left">
        @T("Admin.Catalog.Manufacturers")
    </h1>
    <div class="pull-right">
        <a href="@Url.Action("Create")" class="btn bg-blue">
            <i class="fa fa-plus-square"></i>
            @T("Admin.Common.AddNew")
        </a>
    </div>
</div>
<div class="content">
    <div class="form-horizontal">
        <div class="panel-group">
            <div class="panel panel-default panel-search">
                <div class="panel-body">
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <div id="hotels-grid"></div>
                    <script>
                        $(document).ready(function() {
                            $("#hotels-grid").kendoGrid({
                                dataSource: {
                                    type: "json",
                                    transport: {
                                        read: {
                                            url: "@Html.Raw(Url.Action("List", "Hotel"))",
                                            type: "POST",
                                            dataType: "json",
                                            data: additionalData
                                        }
                                    },
                                    schema: {
                                        data: "Data",
                                        total: "Total",
                                        errors: "Errors"
                                    },
                                    error: function(e) {
                                        display_kendoui_grid_error(e);
                                        // Cancel the changes
                                        this.cancelChanges();
                                    },
                                    pageSize:,
                                    serverPaging: true,
                                    serverFiltering: true,
                                    serverSorting: true
                                },
                                pageable: {
                                    refresh: true,
                                    pageSizes: []
                                },
                                editable: {
                                    confirmation: "@T("Admin.Common.DeleteConfirmation")",
                                    mode: "inline"
                                },
                                scrollable: false,
                                columns: [
                                {
                                    field: "Name",
                                    width: ,
                                    title: "酒店名称"
                                }, {
                                    field: "Telephone",
                                    width: ,
                                    title: "电话"
                                }, {
                                    field: "Introduce",
                                    title: "介绍"
                                }, {
                                    field: "Id",
                                    title: "@T("Admin.Common.Edit")",
                                    width: ,
                                    template: '<a href="Edit/#=Id#">@T("Admin.Common.Edit")</a>'
                                }
                                ]
                            });
                        });
                    </script>
                    <script type="text/javascript">
                        $(document).ready(function() {
                            //search button
                            //$('#search-manufacturers').click(function() {
                            //    //search
                            //    var grid = $('#manufacturers-grid').data('kendoGrid');
                            //    grid.dataSource.page(1); //new search. Set page size to 1
                            //    //grid.dataSource.read(); we already loaded the grid above using "page" function
                            //    return false;
                            //});
                            @*$("#@Html.FieldIdFor(model => model.SearchManufacturerName)").keydown(function(event) {
                                if (event.keyCode == ) {
                                    $("#search-manufacturers").click();
                                    return false;
                                }
                            });*@
                        });
                        function additionalData() {
                            var data = {
                            };
                            addAntiForgeryToken(data);
                            return data;
                        }
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
Nopcommerce 二次开发2 Admin的更多相关文章
- Nopcommerce  二次开发0
		
Nopcommerce 是国外的一个高质量的开源b2c网站系统,基于EntityFramework6.0和MVC5.0,使用Razor模板引擎,有很强的插件机制,包括支付配送功能都是通过插件来实现的 ...
 - Nopcommerce 二次开发2 WEB
		
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndica ...
 - Nopcommerce  二次开发1  基础
		
1 Doamin 酒店 namespace Nop.Core.Domain.Hotels { /// <summary> /// 酒店 /// </summary> p ...
 - nopcommerce 二次开发
		
http://www.cnblogs.com/nopcommerce-b2c/ http://www.nopchina.net/ 数据库结构 http://www.xcode.me/open/docu ...
 - NopCommerce上二次开发 触发器记录
		
最近要在NopCommerce上二次开发. 开发也就算了,该项目的架构设计很好,但性能不可谓不低. 扯远了,为了保持项目以后升级顺利,开次开发不允许在原项目基础上大改,只能以插件形式开发…… 因一个功 ...
 - Django Admin后台管理功能使用+二次开发
		
一 使用环境 开发系统: windows IDE: pycharm 数据库: msyql,navicat 编程语言: python3.7 (Windows x86-64 executable in ...
 - ecshop二次开发 给商品添加自定义字段【包含我自己进一步的开发实例详解】
		
本文包含商品自定义添加教程及进一步的开发实例: 教程: 说起自定义字段,我想很多的朋友像我一样会想起一些开源的CMS(比如Dedecms.Phpcms.帝国)等,他们是可以在后台直接添加自定义字段的. ...
 - WeCenter二次开发教程(一):熟悉模板结构
		
<1>程序文件目录介绍: app – 应用目录 models – 模型目录 plugins – 插件目录 static – 静态文件 system – 系统目录 views – 模板目录 ...
 - shopnc二次开发(一)
		
---恢复内容开始--- 以前没有怎么接触过shopnc,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...
 
随机推荐
- textarea关于空格和换行那点事
			
textarea中空格连续输入多个的情况下,数据回显的时候页面只是显示一个:换行同样有问题,在textarea中有换行,在页面上却没有,今天终于看到个写的比较具体的文章,拿过来收藏下. 地址链接: h ...
 - CocoaPods报错:The dependency `Alamofire ` is not used in any concrete target
			
看到这个错误提示,首先看看自己的版本是不是 OS X EI Capitan,也就是10.10以后的版本,因为这个版本是比较新的版本,网络上找的那些安装cocoapod命令其实有些过时了,特别是创建po ...
 - 替换节点及replaceEach方法
			
需求: 为所有的 li 节点添加 onclick 响应函数实现 city 子节点和 game 子节点对应位置的元素的互换 window.onload = function(){ //自定义互换两个节点 ...
 - 如何修改WAMP中mysql默认空密码
			
WAMP安装好后,mysql密码是为空的,那么要如何修改呢?其实很简单,通过几条指令就行了,下面我就一步步来操作. 首先,通过WAMP打开mysql控制台. 提示输入密码,因为现在是空,所以直接按 ...
 - eclipse安装ADT后在windows菜单下找不到android SDK and AVD Manager
			
eclipse安装ADT后在windows菜单下找不到android SDK and AVD Manager选项的解决办法 - zhjr1220的专栏 - 博客频道 - CSDN.NET http: ...
 - Docker 官网信息
			
Docker Engine Docker-for-linuxhttps://docs.docker.com/engine/installation/linux/rhel/https://docs.do ...
 - 2016-12-15 java开发工作中,尚未做的工作
			
目前未涉及的工作内容: 1.将静态页导入工程,建成jsp文件.配置css.js.img文件.跳转路径 2.未用工具生成pojo dao service等源码文件 3.未签入自己写的代码 4.未搭建子系 ...
 - Saying that Java is nice because it works on every OS is like saying that anal sex is nice because it works on every gender.
			
Saying that Java is nice because it works on every OS is like saying that anal sex is nice because i ...
 - springmvc+spring-security+mybatis +redis +solar框架抽取
			
参考文章:Spring MVC 3 深入总结: 第二章 Spring MVC入门 —— 跟开涛学SpringMVC 参考博客:http://www.cnblogs.com/liukemng/categ ...
 - Jquery:hide一个元素,需要注意的问题(offset)
			
$(".load_more").css('display','none'); 或 $(that.more).find("strong").hide(); 需要注 ...