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,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...
随机推荐
- 硬件抽象层:HAL
本章主要讲硬件抽象层:HAL,它是建立在Linux驱动之上的一套程序库.刚开始介绍了为什么要在Android中加入HAL,目的有三个,一,统一硬件的调用接口.二,解决了GPL版权问题.三,针对一些特殊 ...
- Android驱动开发前的准备(二)
搭建android开发环境 2.1 Android底层开发需要哪些工具 2.2 安装 JDK 2.3 搭建Android 应用程序开发环境 2.4安装Android NDK开发环境 2.5安装交叉编译 ...
- 通过sougou输入法,解决卡在Setup Wizard(小绿人)界面
本人使用海信EG900手机(安卓2.3.5,已root),为了使用google的服务,先后手动复制和CWM recovery刷入google服务包(gapps-gb-20110828-signed.z ...
- Linux达人养成第一季
Linux简介 一.Linux发展史 二.开源软件简介 三.Linux应用领域 四.Linux学习方法 五.Linux与Windows的不同 六.字符界面的优势 Linux系统安装 一.虚拟机安装 二 ...
- mysql 的max_connections和max_user_connections 的区别
----查看max_user_connections 默认值 MySQL> show variables like 'max_user_connections'; +-------------- ...
- BZOJ 1801中国象棋 DP
1801: [Ahoi2009]chess 中国象棋 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 1426 Solved: 826[Submit][ ...
- Hibernate4.1之后关于占位符的问题
hibernate 4.1之后对于HQL中查询参数的占位符做了改进,如果仍然用老式的占位符会有类似如下的告警信息 [main] WARN [org.hibernate.hql.internal.ast ...
- POI2012
现在才开始写 POI 是不是太弱了? -Rendezvous 怎么说呢,我发现我的代码好长啊-长啊-长啊-长长长长长长长长长长长长长长长长长长长长长长啊- 大概就是在一个内向树上搞一个类似 lca 的 ...
- 【PKU1001】Exponentiation(高精度乘法)
Exponentiation Time Limit: 500MS Memory Limit: 10000K Total Submissions: 145642 Accepted: 35529 ...
- Java后台判断请求来自PC端还是移动端
核心代码