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,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...
随机推荐
- MySQL数据库之------DOS命令行的基本操作
1. 进入D盘的如下路径: 按住 ctrl+shift ,右键,选择在此处打开命令行窗口.出现图2. 图 1 图 2 2. . 3. 图 3 4. 图 4 ...
- Telnet弱口令猜解【Python脚本】
telnet 弱口令猜解脚本 测试环境:window2003.centos7 #! /usr/bin/env python # _*_ coding:utf-8 _*_ import telnetli ...
- Spark2.0自定义累加器
Spark2.0 自定义累加器 在2.0中使用自定义累加器需要继承AccumulatorV2这个抽象类,同时必须对以下6个方法进行实现: 1.reset 方法: 将累加器进行重置; abstract ...
- 配置DNS服务器,实现局域网内的地址正反向解析
这里会用到BIND(Berkeley Internet Name Domain) 首先查询下本地bind有没有安装 yum list all | grep "^bind" 如果没有 ...
- Linear Algebra Lecture5 note
Section 2.7 PA=LU and Section 3.1 Vector Spaces and Subspaces Transpose(转置) example: 特殊情况,对称 ...
- [NOIP2011] 聪明的质检员(二分答案)
题目描述 小T 是一名质量监督员,最近负责检验一批矿产的质量.这批矿产共有 n 个矿石,从 1到n 逐一编号,每个矿石都有自己的重量 wi 以及价值vi .检验矿产的流程是: 1 .给定m 个区间[L ...
- DFS序详解
dfs序就是一棵树在dfs遍历时组成的节点序列. 它有这样一个特点:一棵子树的dfs序是一个区间. 下面是dfs序的基本代码: void dfs(int x,int pre,int d){//L,R表 ...
- bzoj2441 小W的问题
bzoj2441 按照纵坐标排序,从小到大插入数列中,每个点i维护一个data[i]表示未插入序列中横坐标小于i的数的个数(用线段树)其实点i就是“W”中第一个极小点,那么f[j]就等于1到j-1中所 ...
- Linux软raid创建
RAID: HBA:基于主机的适配器 RAID:Redundent Array of Inexpensive Disks 廉价磁盘阵列 Independent 独立磁盘阵列 Level:仅 ...
- 如何提高Linux操作系统的安全性 转自https://yq.aliyun.com/articles/24251?spm=5176.100239.blogcont24250.7.CfBYE9
摘要: Linux系统不论在功能上.价格上或性能上都有很多优点,但作为开放式操作系统,它不可避免地存在一些安全隐患.关于如何解决这些隐患,为应用提供一个安全的操作平台,本文会告诉你一些最基本.最常用, ...