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,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...
随机推荐
- codeforces A. Difference Row
link:http://codeforces.com/contest/347/problem/A 开始看起来很复杂的样子,但是刚写下样例,就发现因为中间的都消去了,其实起作用的就是最大值和最小值=_= ...
- CSS布局奇技淫巧:各种居中
居中是我们使用css来布局时常遇到的情况.使用css来进行居中时,有时一个属性就能搞定,有时则需要一定的技巧才能兼容到所有浏览器,本文就居中的一些常用方法做个简单的介绍. 注:本文所讲方法除了特别说明 ...
- dhtmlxScheduler日程安排控件
dhtmlxScheduler是一个JavaScript日程安排控件 官方网站:http://www.dhtmlx.com/在线帮助文档:http://docs.dhtmlx.com/doku.php ...
- python raw String 获取字符串变量中的反斜杠
常用的获取raw string的方式为: >>>r'\n' \n 不能用在字符串变量中,获取字符串变量中的反斜杠如下: tab = '\n' >>>tab.enco ...
- sql查询语句
//查询表的字段名和字段类型select column_name,data_type from information_schema.columns where table_name = '表名' / ...
- golang开发环境(2016.9.16)
一.windows下安装 1.下载go1.7.3.windows-amd64.msi,建议默认安装到‘C:\Go\’ 2.环境变量 变量 值 说明 Path C:\Go\bin 安装程序默认会设置,如 ...
- securityCRT mongoDB 命令行删除(backspace/delete)无效问题
1.MongoDB Shell中退格键使用的问题. 利用SecureCRT工具访问linux的时候,在使用MongoDB的交互式shell的时候,退格键(Backspace)无法使用,导致无法修改输入 ...
- DELL_LCD错误提示代码
代码 文本 原因E1000 Failsafe voltage error. Contact support.(故障保护电压错误.请联络支持人员.) 查看系统事件记录以了解严重故障事件.E1114 Am ...
- sqlite里执行查询提示未启用约束、主键冲突之——数据竟能超字段长度存储
数据表设计如图:szflbm为主键 数据表主键数据: 以上数据在查询时,执行到该语句adapter.Fill(table); 提示主键冲突. 解决: 1.尝试修改数据,把ZC1改成ZZ,正常.说明原因 ...
- Oracle 违反协议 OALL8 处于不一致状态
http://blog.sina.com.cn/s/blog_a45aac720100yu3h.html ERROR-util.JDBCExceptionReporter>: 违反协议ERROR ...