移除Rules&Terminals两个示例相关类,使用Users前台展示,数据库使用BootstrapAdmin
This commit is contained in:
parent
bcf2a8d6fa
commit
6eb56183f0
|
@ -148,7 +148,7 @@
|
|||
<Content Include="Content\js\messages_zh.js" />
|
||||
<Content Include="Content\js\messages_zh.min.js" />
|
||||
<Content Include="Scripts\Login.js" />
|
||||
<Content Include="Scripts\Terminals.js" />
|
||||
<Content Include="Scripts\Users.js" />
|
||||
<Content Include="Content\js\jquery-1.10.2.js" />
|
||||
<Content Include="Content\js\jquery-1.10.2.min.js" />
|
||||
<Content Include="Content\js\sweetalert.js" />
|
||||
|
@ -172,8 +172,6 @@
|
|||
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\RulesController.cs" />
|
||||
<Compile Include="Controllers\TerminalsController.cs" />
|
||||
<Compile Include="Controllers\UsersController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
|
@ -182,15 +180,12 @@
|
|||
<Compile Include="Models\ModelBase.cs" />
|
||||
<Compile Include="Models\NavigatorBarModel.cs" />
|
||||
<Compile Include="Models\PaginationOption.cs" />
|
||||
<Compile Include="Models\TerminalsModel.cs" />
|
||||
<Compile Include="Models\UserModel.cs" />
|
||||
<Compile Include="Models\UserEntity.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\web.config" />
|
||||
<Content Include="packages.config" />
|
||||
<Content Include="Views\Home\Terminals.cshtml" />
|
||||
<Content Include="Views\Home\Rules.cshtml" />
|
||||
<Content Include="Content\fonts\fontawesome-webfont.ttf" />
|
||||
<Content Include="Content\fonts\fontawesome-webfont.woff" />
|
||||
<Content Include="Views\Shared\_Fix.cshtml" />
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/// <reference path="jquery-1.10.2.js" />
|
||||
|
||||
(function ($) {
|
||||
(function ($) {
|
||||
// 增加Array扩展
|
||||
if (!$.isFunction(Array.prototype.filter)) {
|
||||
Array.prototype.filter = function (callback, thisObject) {
|
||||
|
@ -94,6 +92,32 @@
|
|||
that.animate({ marginTop: "+=" + getHeight() });
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.extend({
|
||||
autoValidate: function (options) {
|
||||
// validate
|
||||
$("#dataForm").validate({
|
||||
ignore: "ignore",
|
||||
rules: $.extend({}, options),
|
||||
unhighlight: function (element, errorClass, validClass) {
|
||||
$.validator.defaults.unhighlight(element, errorClass, validClass);
|
||||
$(element).popover('destroy');
|
||||
},
|
||||
errorPlacement: function (label, element) {
|
||||
$(element).popover('destroy');
|
||||
$(element).popover({
|
||||
animation: true,
|
||||
delay: { "show": 100, "hide": 100 },
|
||||
container: 'form',
|
||||
trigger: 'manual',
|
||||
content: $(label).text(),
|
||||
placement: 'auto'
|
||||
});
|
||||
$(element).popover('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
$(function () {
|
||||
|
|
Binary file not shown.
|
@ -1,153 +1,153 @@
|
|||
(function ($) {
|
||||
ExtenderChecker = function (options) {
|
||||
var that = this;
|
||||
this.options = $.extend({}, ExtenderChecker.settings, options);
|
||||
|
||||
this.dataEntity = options.dataEntity;
|
||||
if (!(this.dataEntity instanceof DataEntity) && window.console) {
|
||||
window.console.log('初始化参数中没有DataEntity实例');
|
||||
}
|
||||
|
||||
// handler click event
|
||||
for (name in this.options.click) {
|
||||
var source = $("#" + this.options.click[name]);
|
||||
source.data('click', name);
|
||||
$("#" + this.options.click[name]).click(function () {
|
||||
var method = $(this).data('click');
|
||||
ExtenderChecker.prototype[method].apply(that);
|
||||
});
|
||||
}
|
||||
|
||||
// handler modal window show event
|
||||
if (this.options.modal.constructor === String) {
|
||||
$('#' + this.options.modal).on('show.bs.modal', function (e) {
|
||||
if (that.options.validateForm.constructor === String) {
|
||||
var v = $('#' + that.options.validateForm).validate();
|
||||
v.currentElements.each(function () { $(this).popover('destroy'); })
|
||||
v.resetForm();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ExtenderChecker.VERSION = "1.0";
|
||||
ExtenderChecker.Author = "Argo Zhang";
|
||||
ExtenderChecker.Email = "argo@163.com";
|
||||
|
||||
ExtenderChecker.settings = {
|
||||
url: undefined,
|
||||
bootstrapTable: 'table',
|
||||
validateForm: 'dataForm',
|
||||
modal: 'dialogNew',
|
||||
click: {}
|
||||
}
|
||||
|
||||
ExtenderChecker.idFormatter = function (value, row, index) {
|
||||
return "<a class='edit' href='javascript:void(0)'>" + value + "</a>";
|
||||
};
|
||||
|
||||
ExtenderChecker.prototype = {
|
||||
constructor: ExtenderChecker,
|
||||
|
||||
query: function () {
|
||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('refresh');
|
||||
},
|
||||
|
||||
create: function () {
|
||||
this.dataEntity.reset();
|
||||
if (this.options.modal.constructor === String) $('#' + this.options.modal).modal("show");
|
||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('uncheckAll');
|
||||
},
|
||||
|
||||
edit: function () {
|
||||
options = this.options;
|
||||
if (options.bootstrapTable.constructor !== String) return;
|
||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||
if (arrselections.length == 0) {
|
||||
swal('请选择要编辑的条目', "编辑操作", "warning");
|
||||
}
|
||||
else if (arrselections.length > 1) {
|
||||
swal('请选择一个要编辑的条目', "编辑操作", "warning");
|
||||
}
|
||||
else {
|
||||
this.dataEntity.load(arrselections[0]);
|
||||
if (options.modal.constructor === String) $('#' + options.modal).modal("show");
|
||||
}
|
||||
},
|
||||
|
||||
del: function () {
|
||||
var options = this.options;
|
||||
if (options.bootstrapTable.constructor !== String) return;
|
||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||
if (arrselections.length == 0) {
|
||||
swal('请选择要删除的条目', "删除操作", "warning");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
swal({
|
||||
title: "您确定要删除吗?",
|
||||
text: "删除操作",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
closeOnConfirm: true,
|
||||
confirmButtonText: "是的,我要删除",
|
||||
confirmButtonColor: "#d9534f",
|
||||
cancelButtonText: "取消"
|
||||
}, function () {
|
||||
var iDs = arrselections.map(function (element, index) { return element.ID }).join(",");
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: { "": iDs },
|
||||
type: 'DELETE',
|
||||
success: function (result) {
|
||||
if (result) setTimeout(function () { swal("成功!", "删除数据", "success"); $(options.bootstrapTable).bootstrapTable('refresh'); }, 100);
|
||||
else setTimeout(function () { swal("失败", "删除数据", "error"); }, 200);
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
swal("失败", "删除数据", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
save: function () {
|
||||
var options = $.extend({}, this.options, { data: this.dataEntity.get() });
|
||||
if (options.validateForm.constructor === String && !$("#" + options.validateForm).valid()) return;
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: options.data,
|
||||
type: 'POST',
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
if ($.isFunction(options.success)) options.success(options.data);
|
||||
if (options.bootstrapTable.constructor === String && options.data.ID.constructor === String) {
|
||||
// 更新表格
|
||||
if (options.data.ID > 0) {
|
||||
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
|
||||
for (index = 0; index < allTableData.length; index++) {
|
||||
var temp = allTableData[index];
|
||||
if (temp.ID == options.data.ID) {
|
||||
$(options.bootstrapTable).bootstrapTable('updateRow', { index: index, row: $.extend(temp, options.data) });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(options.bootstrapTable).bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
if (options.modal.constructor === String) $('#' + options.modal).modal("hide");
|
||||
swal("成功", "保存数据", "success");
|
||||
}
|
||||
else {
|
||||
swal("失败", "保存数据", "error");
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
swal("失败", "保存数据失败", "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
(function ($) {
|
||||
BootstrapAdmin = function (options) {
|
||||
var that = this;
|
||||
this.options = $.extend({}, BootstrapAdmin.settings, options);
|
||||
|
||||
this.dataEntity = options.dataEntity;
|
||||
if (!(this.dataEntity instanceof DataEntity) && window.console) {
|
||||
window.console.log('初始化参数中没有DataEntity实例');
|
||||
}
|
||||
|
||||
// handler click event
|
||||
for (name in this.options.click) {
|
||||
var source = $("#" + this.options.click[name]);
|
||||
source.data('click', name);
|
||||
$("#" + this.options.click[name]).click(function () {
|
||||
var method = $(this).data('click');
|
||||
BootstrapAdmin.prototype[method].apply(that);
|
||||
});
|
||||
}
|
||||
|
||||
// handler modal window show event
|
||||
if (this.options.modal.constructor === String) {
|
||||
$('#' + this.options.modal).on('show.bs.modal', function (e) {
|
||||
if (that.options.validateForm.constructor === String) {
|
||||
var v = $('#' + that.options.validateForm).validate();
|
||||
v.currentElements.each(function () { $(this).popover('destroy'); })
|
||||
v.resetForm();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapAdmin.VERSION = "1.0";
|
||||
BootstrapAdmin.Author = "Argo Zhang";
|
||||
BootstrapAdmin.Email = "argo@163.com";
|
||||
|
||||
BootstrapAdmin.settings = {
|
||||
url: undefined,
|
||||
bootstrapTable: 'table',
|
||||
validateForm: 'dataForm',
|
||||
modal: 'dialogNew',
|
||||
click: {}
|
||||
}
|
||||
|
||||
BootstrapAdmin.idFormatter = function (value, row, index) {
|
||||
return "<a class='edit' href='javascript:void(0)'>" + value + "</a>";
|
||||
};
|
||||
|
||||
BootstrapAdmin.prototype = {
|
||||
constructor: BootstrapAdmin,
|
||||
|
||||
query: function () {
|
||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('refresh');
|
||||
},
|
||||
|
||||
create: function () {
|
||||
this.dataEntity.reset();
|
||||
if (this.options.modal.constructor === String) $('#' + this.options.modal).modal("show");
|
||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('uncheckAll');
|
||||
},
|
||||
|
||||
edit: function () {
|
||||
options = this.options;
|
||||
if (options.bootstrapTable.constructor !== String) return;
|
||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||
if (arrselections.length == 0) {
|
||||
swal('请选择要编辑的条目', "编辑操作", "warning");
|
||||
}
|
||||
else if (arrselections.length > 1) {
|
||||
swal('请选择一个要编辑的条目', "编辑操作", "warning");
|
||||
}
|
||||
else {
|
||||
this.dataEntity.load(arrselections[0]);
|
||||
if (options.modal.constructor === String) $('#' + options.modal).modal("show");
|
||||
}
|
||||
},
|
||||
|
||||
del: function () {
|
||||
var options = this.options;
|
||||
if (options.bootstrapTable.constructor !== String) return;
|
||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||
if (arrselections.length == 0) {
|
||||
swal('请选择要删除的条目', "删除操作", "warning");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
swal({
|
||||
title: "您确定要删除吗?",
|
||||
text: "删除操作",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
closeOnConfirm: true,
|
||||
confirmButtonText: "是的,我要删除",
|
||||
confirmButtonColor: "#d9534f",
|
||||
cancelButtonText: "取消"
|
||||
}, function () {
|
||||
var iDs = arrselections.map(function (element, index) { return element.ID }).join(",");
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: { "": iDs },
|
||||
type: 'DELETE',
|
||||
success: function (result) {
|
||||
if (result) setTimeout(function () { swal("成功!", "删除数据", "success"); $(options.bootstrapTable).bootstrapTable('refresh'); }, 100);
|
||||
else setTimeout(function () { swal("失败", "删除数据", "error"); }, 200);
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
swal("失败", "删除数据", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
save: function () {
|
||||
var options = $.extend({}, this.options, { data: this.dataEntity.get() });
|
||||
if (options.validateForm.constructor === String && !$("#" + options.validateForm).valid()) return;
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: options.data,
|
||||
type: 'POST',
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
if ($.isFunction(options.success)) options.success(options.data);
|
||||
if (options.bootstrapTable.constructor === String && options.data.ID.constructor === String) {
|
||||
// 更新表格
|
||||
if (options.data.ID > 0) {
|
||||
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
|
||||
for (index = 0; index < allTableData.length; index++) {
|
||||
var temp = allTableData[index];
|
||||
if (temp.ID == options.data.ID) {
|
||||
$(options.bootstrapTable).bootstrapTable('updateRow', { index: index, row: $.extend(temp, options.data) });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(options.bootstrapTable).bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
if (options.modal.constructor === String) $('#' + options.modal).modal("hide");
|
||||
swal("成功", "保存数据", "success");
|
||||
}
|
||||
else {
|
||||
swal("失败", "保存数据", "error");
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
swal("失败", "保存数据失败", "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
|
@ -16,26 +16,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
public ActionResult Index()
|
||||
{
|
||||
var v = new HeaderBarModel();
|
||||
return View(v);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ActionResult Rules()
|
||||
{
|
||||
var v = new HeaderBarModel();
|
||||
v.BreadcrumbName = "规则设置";
|
||||
return View(v);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ActionResult Terminals()
|
||||
{
|
||||
var v = new HeaderBarModel();
|
||||
v.BreadcrumbName = "输入口设置";
|
||||
v.ShowMenu = "hide";
|
||||
return View(v);
|
||||
}
|
||||
/// <summary>
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
public class RulesController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public void Post([FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
using Bootstrap.Admin.Models;
|
||||
using Bootstrap.DataAccess;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
public class TerminalsController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
[HttpGet]
|
||||
public TerminalsModel Get([FromUri]TerminalsPageOption value)
|
||||
{
|
||||
var ret = new TerminalsModel();
|
||||
ret.RetrieveTerminals(value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet]
|
||||
public Terminal Get(int id)
|
||||
{
|
||||
return TerminalHelper.RetrieveTerminals(string.Empty).FirstOrDefault(t => t.ID == id);
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
public bool Post([FromBody]Terminal value)
|
||||
{
|
||||
return TerminalHelper.SaveTerminal(value);
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut]
|
||||
public bool Put(int id, [FromBody]Terminal value)
|
||||
{
|
||||
return TerminalHelper.SaveTerminal(value);
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
TerminalHelper.DeleteTerminal(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +1,55 @@
|
|||
using Bootstrap.Admin.Models;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
public class UsersController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
[HttpGet]
|
||||
public UserModel Get()
|
||||
{
|
||||
return new UserModel()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public void Post([FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
using Bootstrap.Admin.Models;
|
||||
using Bootstrap.DataAccess;
|
||||
using System.Web.Http;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class UsersController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public UserEntity Get([FromUri]TerminalsPageOption value)
|
||||
{
|
||||
var ret = new UserEntity();
|
||||
ret.RetrieveUsers(value);
|
||||
return ret;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public User Get(int id)
|
||||
{
|
||||
return UserHelper.RetrieveUsers().FirstOrDefault(t => t.ID == id);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
[HttpPost]
|
||||
public bool Post([FromBody]User value)
|
||||
{
|
||||
return UserHelper.SaveUser(value);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
[HttpDelete]
|
||||
public bool Delete([FromBody]string value)
|
||||
{
|
||||
return UserHelper.DeleteUser(value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,27 +4,23 @@ using System.Linq;
|
|||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
public class TerminalsModel
|
||||
public class UserEntity
|
||||
{
|
||||
public int total { get; private set; }
|
||||
|
||||
public IEnumerable<Terminal> rows { get; private set; }
|
||||
public IEnumerable<User> rows { get; private set; }
|
||||
|
||||
public void RetrieveTerminals(TerminalsPageOption option)
|
||||
public void RetrieveUsers(TerminalsPageOption option)
|
||||
{
|
||||
// int limit, int offset, string name, string price, string sort, string order
|
||||
var data = TerminalHelper.RetrieveTerminals(string.Empty);
|
||||
var data = UserHelper.RetrieveUsers(string.Empty);
|
||||
if (!string.IsNullOrEmpty(option.Name))
|
||||
{
|
||||
data = data.Where(t => t.Name.Contains(option.Name));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(option.Ip))
|
||||
{
|
||||
data = data.Where(t => t.ServerIP.Contains(option.Ip));
|
||||
data = data.Where(t => t.UserName.Contains(option.Name));
|
||||
}
|
||||
total = data.Count();
|
||||
// TODO: 通过option.Sort属性判断对那列进行排序,现在统一对名称列排序
|
||||
data = option.Order == "asc" ? data.OrderBy(t => t.Name) : data.OrderByDescending(t => t.Name);
|
||||
data = option.Order == "asc" ? data.OrderBy(t => t.UserName) : data.OrderByDescending(t => t.UserName);
|
||||
rows = data.Skip(option.Offset).Take(option.Limit);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +30,5 @@ namespace Bootstrap.Admin.Models
|
|||
public class TerminalsPageOption : PaginationOption
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Ip { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
public class UserModel : HeaderBarModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
$(function () {
|
||||
var dataEntity = new DataEntity({
|
||||
map: {
|
||||
ID: "terminalId",
|
||||
Name: "terminalName",
|
||||
ClientIP: "clientIP",
|
||||
ClientPort: "clientPort",
|
||||
ServerIP: "serverIP",
|
||||
ServerPort: "serverPort",
|
||||
DeviceIP: "deviceIP",
|
||||
DevicePort: "devicePort",
|
||||
DatabaseName: "databaseName",
|
||||
DatabaseUserName: "databaseUserName",
|
||||
DatabasePassword: "databasePassword"
|
||||
}
|
||||
});
|
||||
|
||||
var extender = new ExtenderChecker({
|
||||
url: '../api/Terminals',
|
||||
dataEntity: dataEntity,
|
||||
click: {
|
||||
query: 'btn_query',
|
||||
create: 'btn_add',
|
||||
edit: 'btn_edit',
|
||||
del: 'btn_delete',
|
||||
save: 'btnSubmit'
|
||||
}
|
||||
});
|
||||
|
||||
idEvents = {
|
||||
'click .edit': function (e, value, row, index) {
|
||||
dataEntity.load(row);
|
||||
$('table').bootstrapTable('uncheckAll');
|
||||
$('table').bootstrapTable('check', index);
|
||||
$("#dialogNew").modal("show");
|
||||
}
|
||||
};
|
||||
|
||||
$('table').bootstrapTable({
|
||||
url: '../api/Terminals', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: true, //是否启用排序
|
||||
sortName: 'Name',
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: function (params) { return $.extend(params, { name: $("#txt_search_name").val(), ip: $("#txt_search_ip").val() }); }, //传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 10, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: false,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: false, //是否启用点击选中行
|
||||
//height: 500, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
idField: "Id",
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
clickToSelect: false,
|
||||
columns: [{ checkbox: true },
|
||||
{ title: "Id", field: "ID", events: idEvents, formatter: ExtenderChecker.idFormatter },
|
||||
{ title: "输入口名称", field: "Name", sortable: true },
|
||||
{ title: "工控机IP", field: "ClientIP", sortable: false },
|
||||
{ title: "工控机Port", field: "ClientPort", sortable: false },
|
||||
{ title: "服务器IP", field: "ServerIP", sortable: false },
|
||||
{ title: "服务器Port", field: "ServerPort", sortable: false },
|
||||
{ title: "比对设备IP", field: "DeviceIP", sortable: false },
|
||||
{ title: "比对设备Port", field: "DevicePort", sortable: false },
|
||||
{ title: "数据库名称", field: "DatabaseName", sortable: false },
|
||||
{ title: "数据库用户名", field: "DatabaseUserName", sortable: false },
|
||||
{ title: "数据库密码", field: "DatabasePassword", sortable: false }
|
||||
]
|
||||
});
|
||||
|
||||
// validate
|
||||
$("#dataForm").validate({
|
||||
ignore: "ignore",
|
||||
rules: {
|
||||
terminalName: {
|
||||
required: true,
|
||||
maxlength: 50
|
||||
},
|
||||
clientIP: {
|
||||
required: true,
|
||||
ip: true,
|
||||
maxlength: 15
|
||||
},
|
||||
clientPort: {
|
||||
required: true,
|
||||
digits: true,
|
||||
range: [0, 65535],
|
||||
maxlength: 5
|
||||
},
|
||||
serverIP: {
|
||||
required: true,
|
||||
ip: true,
|
||||
maxlength: 15
|
||||
},
|
||||
serverPort: {
|
||||
required: true,
|
||||
digits: true,
|
||||
range: [1000, 65535],
|
||||
minlength: 4
|
||||
},
|
||||
deviceIP: {
|
||||
required: true,
|
||||
ip: true,
|
||||
maxlength: 15
|
||||
},
|
||||
devicePort: {
|
||||
required: true,
|
||||
digits: true,
|
||||
range: [1000, 65535],
|
||||
minlength: 4
|
||||
},
|
||||
databaseName: {
|
||||
maxlength: 50
|
||||
},
|
||||
databaseUserName: {
|
||||
maxlength: 50
|
||||
},
|
||||
databasePassword: {
|
||||
maxlength: 50
|
||||
}
|
||||
},
|
||||
unhighlight: function (element, errorClass, validClass) {
|
||||
$.validator.defaults.unhighlight(element, errorClass, validClass);
|
||||
$(element).popover('destroy');
|
||||
},
|
||||
errorPlacement: function (label, element) {
|
||||
$(element).popover('destroy');
|
||||
$(element).popover({
|
||||
animation: true,
|
||||
delay: { "show": 100, "hide": 100 },
|
||||
container: 'form',
|
||||
trigger: 'manual',
|
||||
content: $(label).text(),
|
||||
placement: 'auto'
|
||||
});
|
||||
$(element).popover('show');
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,80 @@
|
|||
$(function () {
|
||||
var dataEntity = new DataEntity({
|
||||
map: {
|
||||
ID: "userID",
|
||||
UserName: "userName",
|
||||
Password: "password"
|
||||
}
|
||||
});
|
||||
|
||||
var extender = new BootstrapAdmin({
|
||||
url: '../api/Users',
|
||||
dataEntity: dataEntity,
|
||||
click: {
|
||||
query: 'btn_query',
|
||||
create: 'btn_add',
|
||||
edit: 'btn_edit',
|
||||
del: 'btn_delete',
|
||||
save: 'btnSubmit'
|
||||
}
|
||||
});
|
||||
|
||||
idEvents = {
|
||||
'click .edit': function (e, value, row, index) {
|
||||
dataEntity.load(row);
|
||||
$('table').bootstrapTable('uncheckAll');
|
||||
$('table').bootstrapTable('check', index);
|
||||
$("#dialogNew").modal("show");
|
||||
}
|
||||
};
|
||||
|
||||
$('table').bootstrapTable({
|
||||
url: '../api/Users', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: true, //是否启用排序
|
||||
sortName: 'UserName',
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: function (params) { return $.extend(params, { name: $("#txt_search_name").val() }); }, //传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 10, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: false,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: false, //是否启用点击选中行
|
||||
//height: 500, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
idField: "Id",
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
clickToSelect: false,
|
||||
columns: [{ checkbox: true },
|
||||
{ title: "Id", field: "ID", events: idEvents, formatter: BootstrapAdmin.idFormatter },
|
||||
{ title: "用户名称", field: "UserName", sortable: true }
|
||||
]
|
||||
});
|
||||
|
||||
// validate
|
||||
$('#dataForm').autoValidate({
|
||||
userName: {
|
||||
required: true,
|
||||
maxlength: 50
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
maxlength: 50
|
||||
},
|
||||
confirm: {
|
||||
required: true,
|
||||
equalTo: "#password"
|
||||
}
|
||||
});
|
||||
});
|
|
@ -5,7 +5,6 @@
|
|||
}
|
||||
@section Javascript {
|
||||
<script src="~/scripts/Users.js"></script>
|
||||
<script src="~/scripts/Terminals.js"></script>
|
||||
}
|
||||
@section header {
|
||||
@Html.Partial("Header", Model)
|
||||
|
@ -16,9 +15,9 @@
|
|||
@section query {
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group terminal-form-group">
|
||||
<label class="control-label col-lg-1" for="txt_search_name">用户名</label>
|
||||
<label class="control-label col-lg-1" for="txt_search_name">用户名称</label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" class="form-control" id="txt_username" />
|
||||
<input type="text" class="form-control" id="txt_search_name" />
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
|
||||
|
@ -35,58 +34,22 @@
|
|||
<div class="modal-body">
|
||||
<form class="form-horizontal terminal-form-group" id="dataForm" name="dataForm" role="form">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="terminalName">输入口名称</label>
|
||||
<label class="control-label col-sm-2" for="userName">用户名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="terminalName" name="terminalName" size="20" maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="clientIP">工控机IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientIP" name="clientIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="clientPort">工控机Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientPort" name="clientPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="serverIP">服务器IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverIP" name="serverIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="serverPort">服务器Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverPort" name="serverPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="deviceIP">比对设备IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deviceIP" name="deviceIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="devicePort">比对设备Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="devicePort" name="devicePort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseName">数据库名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseName" name="databaseName" maxlength="50" />
|
||||
<input type="text" class="form-control" id="userName" name="userName" maxlength="50" />
|
||||
</div>
|
||||
<div class="col-sm-1" style="display:none;">
|
||||
<input type="text" class="form-control" id="terminalId" />
|
||||
<input type="text" class="form-control" id="userID" name="userID" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseUserName">数据库用户名</label>
|
||||
<label class="control-label col-sm-2" for="password">登录密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseUserName" name="databaseUserName" size="20" maxlength="50" />
|
||||
<input type="text" class="form-control" id="password" name="password" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="databasePassword">数据库密码</label>
|
||||
<label class="control-label col-sm-2" for="confirm">确认密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databasePassword" name="databasePassword" size="20" maxlength="50" />
|
||||
<input type="text" class="form-control" id="confirm" name="confirm" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
@model Bootstrap.Admin.Models.HeaderBarModel
|
||||
@{
|
||||
ViewBag.Title = "Rules";
|
||||
Layout = "~/Views/Shared/_Fix.cshtml";
|
||||
}
|
||||
@section Javascript {
|
||||
<script src="~/content/js/sweetalert.js"></script>
|
||||
<script src="~/content/js/bootstrap-table.js"></script>
|
||||
<script src="~/content/js/bootstrap-table-zh-CN.js"></script>
|
||||
<script src="~/content/js/jquery.validate.js"></script>
|
||||
<script src="~/content/js/messages_zh.js"></script>
|
||||
<script src="~/scripts/Terminals.js"></script>
|
||||
}
|
||||
@section header {
|
||||
@Html.Partial("Header", Model)
|
||||
}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">查询条件</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group terminal-form-group">
|
||||
<label class="control-label col-sm-1" for="txt_search_name">输入口名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="txt_search_name" />
|
||||
</div>
|
||||
<label class="control-label col-sm-1" for="txt_search_ip">服务器IP</label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" id="txt_search_ip" size="15" maxlength="15" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-success">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-danger">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
|
||||
</button>
|
||||
<button id="btn_edit" type="button" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>编辑
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default terminal-pannel">
|
||||
<div class="panel-heading">
|
||||
查询结果
|
||||
</div>
|
||||
<div class="panel-body table-body">
|
||||
<table></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section modal {
|
||||
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog terminal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header terminal-dialog-header">
|
||||
<button type="button" class="close terminal-close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">输入口编辑窗口</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal terminal-form-group" id="dataForm" name="dataForm" role="form">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="terminalName">输入口名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="terminalName" name="terminalName" size="20" maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="clientIP">工控机IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientIP" name="clientIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="clientPort">工控机Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientPort" name="clientPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="serverIP">服务器IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverIP" name="serverIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="serverPort">服务器Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverPort" name="serverPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="deviceIP">比对设备IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deviceIP" name="deviceIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="devicePort">比对设备Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="devicePort" name="devicePort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseName">数据库名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseName" name="databaseName" maxlength="50" />
|
||||
</div>
|
||||
<div class="col-sm-1" style="display:none;">
|
||||
<input type="text" class="form-control" id="terminalId" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseUserName">数据库用户名</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseUserName" name="databaseUserName" size="20" maxlength="50" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="databasePassword">数据库密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databasePassword" name="databasePassword" size="20" maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
关闭
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="btnSubmit">
|
||||
提交更改
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
@model Bootstrap.Admin.Models.HeaderBarModel
|
||||
@{
|
||||
ViewBag.Title = "Terminals";
|
||||
Layout = "~/Views/Shared/_Normal.cshtml";
|
||||
}
|
||||
@section Javascript {
|
||||
<script src="~/content/js/sweetalert.js"></script>
|
||||
<script src="~/content/js/bootstrap-table.js"></script>
|
||||
<script src="~/content/js/bootstrap-table-zh-CN.js"></script>
|
||||
<script src="~/content/js/jquery.validate.js"></script>
|
||||
<script src="~/content/js/messages_zh.js"></script>
|
||||
<script src="~/scripts/Terminals.js"></script>
|
||||
}
|
||||
@section header {
|
||||
@Html.Partial("Header", Model)
|
||||
}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">查询条件</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group terminal-form-group">
|
||||
<label class="control-label col-sm-1" for="txt_search_name">输入口名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="txt_search_name" />
|
||||
</div>
|
||||
<label class="control-label col-sm-1" for="txt_search_ip">服务器IP</label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" id="txt_search_ip" size="15" maxlength="15" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-success">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-danger">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
|
||||
</button>
|
||||
<button id="btn_edit" type="button" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>编辑
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default terminal-pannel">
|
||||
<div class="panel-heading">
|
||||
查询结果
|
||||
</div>
|
||||
<div class="panel-body table-body">
|
||||
<table></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section modal {
|
||||
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog terminal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header terminal-dialog-header">
|
||||
<button type="button" class="close terminal-close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">输入口编辑窗口</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal terminal-form-group" id="dataForm" name="dataForm" role="form">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="terminalName">输入口名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="terminalName" name="terminalName" size="20" maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="clientIP">工控机IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientIP" name="clientIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="clientPort">工控机Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="clientPort" name="clientPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="serverIP">服务器IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverIP" name="serverIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="serverPort">服务器Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="serverPort" name="serverPort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="deviceIP">比对设备IP</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deviceIP" name="deviceIP" size="20" maxlength="15" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="devicePort">比对设备Port</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="devicePort" name="devicePort" size="20" maxlength="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseName">数据库名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseName" name="databaseName" maxlength="50" />
|
||||
</div>
|
||||
<div class="col-sm-1" style="display:none;">
|
||||
<input type="text" class="form-control" id="terminalId" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="databaseUserName">数据库用户名</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databaseUserName" name="databaseUserName" size="20" maxlength="50" />
|
||||
</div>
|
||||
<label class="control-label col-sm-2" for="databasePassword">数据库密码</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="databasePassword" name="databasePassword" size="20" maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||
关闭
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="btnSubmit">
|
||||
提交更改
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
|
@ -1,61 +1,61 @@
|
|||
@model Bootstrap.Admin.Models.HeaderBarModel
|
||||
<!--header start-->
|
||||
<header class="header white-bg">
|
||||
<div class="sidebar-toggle-box">
|
||||
<div class="fa fa-bars tooltips" data-placement="right" data-original-title="展开/收起 导航条"></div>
|
||||
</div>
|
||||
<!--logo start-->
|
||||
<a href="#" class="logo">后台管理系统</a>
|
||||
<!--logo end-->
|
||||
<nav class="navbar lgbMenu @Model.ShowMenu">
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">参数设置 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="~/Home/Rules">规则设置</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="~/Home/Terminals">输入口设置</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</nav>
|
||||
<div class="top-nav">
|
||||
<!--search & user info start-->
|
||||
<ul class="nav pull-right top-menu">
|
||||
<li>
|
||||
<input type="text" class="form-control search" placeholder="搜索">
|
||||
</li>
|
||||
<!-- user login dropdown start-->
|
||||
<li class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<img alt="" src="../content/images/logo6.jpg">
|
||||
<span class="username">@Model.UserName</span>
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu extended logout">
|
||||
<div class="log-arrow-up"></div>
|
||||
<li><a href="#"><i class=" fa fa-suitcase"></i> 个人中心</a></li>
|
||||
<li><a href="#"><i class="fa fa-cog"></i> 设置</a></li>
|
||||
<li><a href="#"><i class="fa fa-bell-o"></i> 通知</a></li>
|
||||
<li><a href="~/Home/Logout"><i class="fa fa-key"></i> 注销</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- user login dropdown end -->
|
||||
</ul>
|
||||
<!--search & user info end-->
|
||||
</div>
|
||||
<!--breadcrumbs start -->
|
||||
<div class="lgbBreadcrumb">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="@Url.Content(Model.HomeUrl)"><i class="fa fa-home"></i>首页</a></li>
|
||||
@if (!string.IsNullOrEmpty(Model.BreadcrumbName))
|
||||
{
|
||||
<li>@Model.BreadcrumbName</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<!--breadcrumbs end -->
|
||||
</header>
|
||||
<!--header end-->
|
||||
@model Bootstrap.Admin.Models.HeaderBarModel
|
||||
<!--header start-->
|
||||
<header class="header white-bg">
|
||||
<div class="sidebar-toggle-box">
|
||||
<div class="fa fa-bars tooltips" data-placement="right" data-original-title="展开/收起 导航条"></div>
|
||||
</div>
|
||||
<!--logo start-->
|
||||
<a href="#" class="logo">后台管理系统</a>
|
||||
<!--logo end-->
|
||||
<nav class="navbar lgbMenu @Model.ShowMenu">
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">参数设置 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="~/Home/Rules">规则设置</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="~/Home/Terminals">输入口设置</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</nav>
|
||||
<div class="top-nav">
|
||||
<!--search & user info start-->
|
||||
<ul class="nav pull-right top-menu">
|
||||
<li>
|
||||
<input type="text" class="form-control search" placeholder="搜索">
|
||||
</li>
|
||||
<!-- user login dropdown start-->
|
||||
<li class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<img alt="" src="../content/images/logo6.jpg">
|
||||
<span class="username">@Model.UserName</span>
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu extended logout">
|
||||
<div class="log-arrow-up"></div>
|
||||
<li><a href="#"><i class=" fa fa-suitcase"></i> 个人中心</a></li>
|
||||
<li><a href="~/Admin"><i class="fa fa-cog"></i> 设置</a></li>
|
||||
<li><a href="#"><i class="fa fa-bell-o"></i> 通知</a></li>
|
||||
<li><a href="~/Home/Logout"><i class="fa fa-key"></i> 注销</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- user login dropdown end -->
|
||||
</ul>
|
||||
<!--search & user info end-->
|
||||
</div>
|
||||
<!--breadcrumbs start -->
|
||||
<div class="lgbBreadcrumb">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="@Url.Content(Model.HomeUrl)"><i class="fa fa-home"></i>首页</a></li>
|
||||
@if (!string.IsNullOrEmpty(Model.BreadcrumbName))
|
||||
{
|
||||
<li>@Model.BreadcrumbName</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<!--breadcrumbs end -->
|
||||
</header>
|
||||
<!--header end-->
|
||||
|
|
|
@ -18,16 +18,13 @@
|
|||
</appSettings>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="SQL" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=ExtendedChecker;User ID=sa;Password=sa"/>
|
||||
<add name="SQL" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"/>
|
||||
</connectionStrings>
|
||||
|
||||
<cacheManager>
|
||||
<add key="TerminalData-CodeTerminalHelper" interval="600" desc="输入口信息缓存" />
|
||||
|
||||
<add key="GroupData-CodeGroupHelper" interval="600" desc="群组信息缓存" />
|
||||
|
||||
<add key="UserData-CodeUserHelper" interval="600" desc="用户信息缓存" />
|
||||
|
||||
</cacheManager>
|
||||
|
||||
<cacheManagerList>
|
||||
|
|
|
@ -61,8 +61,6 @@
|
|||
<Compile Include="GroupHelper.cs" />
|
||||
<Compile Include="Menu.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Terminal.cs" />
|
||||
<Compile Include="TerminalHelper.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="UserHelper.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Terminal
|
||||
{
|
||||
/// <summary>
|
||||
/// 获得/设置 输入口主键ID
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 输入口名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 公共机IP
|
||||
/// </summary>
|
||||
public string ClientIP { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 公共机Port
|
||||
/// </summary>
|
||||
public int ClientPort { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 服务器IP
|
||||
/// </summary>
|
||||
public string ServerIP { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 服务器Port
|
||||
/// </summary>
|
||||
public int ServerPort { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 比对设备IP
|
||||
/// </summary>
|
||||
public string DeviceIP { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 比对设备Port
|
||||
/// </summary>
|
||||
public int DevicePort { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 数据库名称
|
||||
/// </summary>
|
||||
public string DatabaseName { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 数据库用户名
|
||||
/// </summary>
|
||||
public string DatabaseUserName { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 数据库密码
|
||||
/// </summary>
|
||||
public string DatabasePassword { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 输入口状态 真为开启,假为停止
|
||||
/// </summary>
|
||||
public bool Status { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 规则名称
|
||||
/// </summary>
|
||||
public string RuleName { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 规则ID
|
||||
/// </summary>
|
||||
public int RuleID { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 与其相关联的DataGridViewRowIndex
|
||||
/// </summary>
|
||||
public int RowIndex { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 错误描述信息
|
||||
/// </summary>
|
||||
public string Error { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 条码信息
|
||||
/// </summary>
|
||||
public string BarCode { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
using Longbow;
|
||||
using Longbow.Caching;
|
||||
using Longbow.Caching.Configuration;
|
||||
using Longbow.Data;
|
||||
using Longbow.ExceptionManagement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
public static class TerminalHelper
|
||||
{
|
||||
private const string TerminalDataKey = "TerminalData-CodeTerminalHelper";
|
||||
|
||||
/// <summary>
|
||||
/// 查询所有输入口
|
||||
/// </summary>
|
||||
/// <param name="pIds"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Terminal> RetrieveTerminals(string tId = null)
|
||||
{
|
||||
string sql = "select t.*, tc.RuleID, r.Name RuleName from Terminals t left join TerminalRuleConfig tc on t.ID = tc.TerminalId left join Rules r on tc.RuleId = r.Id order by t.Name";
|
||||
var ret = CacheManager.GetOrAdd(TerminalDataKey, CacheSection.RetrieveIntervalByKey(TerminalDataKey), key =>
|
||||
{
|
||||
List<Terminal> Terminals = new List<Terminal>();
|
||||
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
|
||||
try
|
||||
{
|
||||
using (DbDataReader reader = DBAccessManager.SqlDBAccess.ExecuteReader(cmd))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
Terminals.Add(new Terminal()
|
||||
{
|
||||
ID = (int)reader[0],
|
||||
Name = (string)reader[1],
|
||||
ClientIP = (string)reader[2],
|
||||
ClientPort = (int)reader[3],
|
||||
ServerIP = (string)reader[4],
|
||||
ServerPort = (int)reader[5],
|
||||
DeviceIP = (string)reader[6],
|
||||
DevicePort = (int)reader[7],
|
||||
DatabaseName = LgbConvert.ReadValue(reader[8], string.Empty),
|
||||
DatabaseUserName = LgbConvert.ReadValue(reader[9], string.Empty),
|
||||
DatabasePassword = LgbConvert.ReadValue(reader[10], string.Empty),
|
||||
Status = LgbConvert.ReadValue(reader[11], false),
|
||||
RuleID = LgbConvert.ReadValue(reader[12], 0),
|
||||
RuleName = LgbConvert.ReadValue(reader[13], string.Empty)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { ExceptionManager.Publish(ex); }
|
||||
return Terminals;
|
||||
}, CacheSection.RetrieveDescByKey(TerminalDataKey));
|
||||
return string.IsNullOrEmpty(tId) ? ret : ret.Where(t => tId.Equals(t.ID.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除输入口
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
public static void DeleteTerminal(string ids)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ids) || ids.Contains("'")) return;
|
||||
string sql = string.Format(CultureInfo.InvariantCulture, "Delete from Terminals where ID in ({0})", ids);
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
ClearCache();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存新建/更新的输入口信息
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveTerminal(Terminal p)
|
||||
{
|
||||
if (p == null) throw new ArgumentNullException("p");
|
||||
bool ret = false;
|
||||
if (p.Name.Length > 50) p.Name.Substring(0, 50);
|
||||
if (p.ClientIP.Length > 15) p.ClientIP.Substring(0, 15);
|
||||
p.ClientPort = Math.Max(0, p.ClientPort);
|
||||
if (p.ServerIP.Length > 15) p.ServerIP.Substring(0, 15);
|
||||
p.ServerPort = Math.Max(1, p.ServerPort);
|
||||
if (p.DeviceIP.Length > 15) p.DeviceIP.Substring(0, 15);
|
||||
p.DevicePort = Math.Max(1, p.DevicePort);
|
||||
if (!string.IsNullOrEmpty(p.DatabaseName) && p.DatabaseName.Length > 50) p.DatabaseName = p.DatabaseName.Substring(0, 50);
|
||||
if (!string.IsNullOrEmpty(p.DatabaseUserName) && p.DatabaseUserName.Length > 50) p.DatabaseUserName = p.DatabaseUserName.Substring(0, 50);
|
||||
if (!string.IsNullOrEmpty(p.DatabasePassword) && p.DatabasePassword.Length > 50) p.DatabasePassword = p.DatabasePassword.Substring(0, 50);
|
||||
string sql = p.ID == 0 ?
|
||||
"Insert Into Terminals (Name, ClientIP, ClientPort, ServerIP, ServerPort, DeviceIP, DevicePort, DatabaseName, DatabaseUserName, DatabasePassword) Values (@Name, @ClientIP, @ClientPort, @ServerIP, @ServerPort, @DeviceIP, @DevicePort, @DatabaseName, @DatabaseUserName, @DatabasePassword)" :
|
||||
"Update Terminals set Name = @Name, ClientIP = @ClientIP, ClientPort = @ClientPort, ServerIP = @ServerIP, ServerPort = @ServerPort, DeviceIP = @DeviceIP, DevicePort = @DevicePort, DatabaseName = @DatabaseName, DatabaseUserName = @DatabaseUserName, DatabasePassword = @DatabasePassword where ID = @ID";
|
||||
try
|
||||
{
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ID", p.ID, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Name", p.Name, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ClientIP", p.ClientIP, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ClientPort", p.ClientPort, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ServerIP", p.ServerIP, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ServerPort", p.ServerPort, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@DeviceIP", p.DeviceIP, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@DevicePort", p.DevicePort, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@DatabaseName", DBAccess.ToDBValue(p.DatabaseName), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@DatabaseUserName", DBAccess.ToDBValue(p.DatabaseUserName), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@DatabasePassword", DBAccess.ToDBValue(p.DatabasePassword), ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
ret = true;
|
||||
ClearCache();
|
||||
}
|
||||
catch (DbException ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 更新缓存
|
||||
private static void ClearCache()
|
||||
{
|
||||
CacheManager.Clear(key => key.Contains("TerminalData-"));
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="terminalId"></param>
|
||||
/// <param name="ruleId"></param>
|
||||
public static void StartTerminal(int terminalId, int ruleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_StartTerminal"))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@tId", terminalId, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@rId", ruleId, ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
catch (DbException ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="terminalId"></param>
|
||||
public static void StopTerminal(int terminalId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_StopTerminal"))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@tId", terminalId, ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
catch (DbException ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,9 +38,7 @@ namespace Bootstrap.DataAccess
|
|||
Users.Add(new User()
|
||||
{
|
||||
ID = (int)reader[0],
|
||||
UserName = (string)reader[1],
|
||||
Password = (string)reader[2],
|
||||
PassSalt = (string)reader[3],
|
||||
UserName = (string)reader[1]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -54,15 +52,25 @@ namespace Bootstrap.DataAccess
|
|||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
public static void DeleteUser(string ids)
|
||||
public static bool DeleteUser(string ids)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ids) || ids.Contains("'")) return;
|
||||
string sql = string.Format(CultureInfo.InvariantCulture, "Delete from Users where ID in ({0})", ids);
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
bool ret = false;
|
||||
if (string.IsNullOrEmpty(ids) || ids.Contains("'")) return ret;
|
||||
try
|
||||
{
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
string sql = string.Format(CultureInfo.InvariantCulture, "Delete from Users where ID in ({0})", ids);
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
ClearCache();
|
||||
ret = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存新建/更新的用户信息
|
||||
|
@ -71,11 +79,11 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static bool SaveUser(User p)
|
||||
{
|
||||
//TODO: 这里这样处理明显不行,需要用非对称加密算法进行混淆加密后存储到数据库中
|
||||
if (p == null) throw new ArgumentNullException("p");
|
||||
bool ret = false;
|
||||
if (p.UserName.Length > 50) p.UserName.Substring(0, 50);
|
||||
if (p.Password.Length > 50) p.Password.Substring(0, 50);
|
||||
if (p.PassSalt.Length > 50) p.PassSalt.Substring(0, 50);
|
||||
string sql = p.ID == 0 ?
|
||||
"Insert Into Users (UserName, Password, PassSalt) Values (@UserName, @Password, @PassSalt)" :
|
||||
"Update Users set UserName = @UserName, Password = @Password, PassSalt = @PassSalt where ID = @ID";
|
||||
|
@ -86,7 +94,7 @@ namespace Bootstrap.DataAccess
|
|||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ID", p.ID, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserName", p.UserName, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Password", p.Password, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@PassSalt", p.PassSalt, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@PassSalt", DBNull.Value, ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
ret = true;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</configSections>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="SQL" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=ExtendedChecker;User ID=sa;Password=sa"/>
|
||||
<add name="SQL" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"/>
|
||||
</connectionStrings>
|
||||
|
||||
<cacheManager>
|
||||
|
|
|
@ -52,13 +52,9 @@
|
|||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="TerminalHelperTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
<Compile Include="GroupHelperTests.cs" />
|
||||
|
||||
<Compile Include="UserHelperTests.cs" />
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bootstrap.DataAccess\Bootstrap.DataAccess.csproj">
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class MenuTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void RetrieveMenusTest()
|
||||
{
|
||||
var result = TerminalHelper.RetrieveTerminals("1");
|
||||
Assert.IsTrue((result.Count() == 0 || result.Count() == 1), "带有参数的TerminalHelper.RetrieveTerminals方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
result = TerminalHelper.RetrieveTerminals();
|
||||
Assert.IsTrue(result.Count() >= 0, "不带参数的TerminalHelper.RetrieveTerminals方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +1,47 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class UserHelperTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void RetrieveUsersTest()
|
||||
{
|
||||
var result = UserHelper.RetrieveUsers("1");
|
||||
Assert.IsTrue((result.Count() == 0 || result.Count() == 1), "带有参数的UserHelper.RetrieveUsers方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
result = UserHelper.RetrieveUsers();
|
||||
Assert.IsTrue(result.Count() >= 0, "不带参数的UserHelper.RetrieveUsers方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeleteUserTest()
|
||||
{
|
||||
string ids = "2";
|
||||
try
|
||||
{
|
||||
UserHelper.DeleteUser(ids);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Assert.IsTrue(false,"带有参数的UserHelper.DeleteUserTest方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SaveUserTest()
|
||||
{
|
||||
User users = new User();
|
||||
users.ID = 0;
|
||||
users.UserName = "liqi";
|
||||
users.Password = "123";
|
||||
users.PassSalt = "123";
|
||||
var result = UserHelper.SaveUser(users);
|
||||
Assert.IsTrue(result == true, "带有参数的UserHelper.SaveUser方法中新建用户信息失败,请检查数据库连接或者数据库SQL语句");
|
||||
|
||||
User users1 = new User();
|
||||
users1.ID = 1;
|
||||
users1.UserName = "Lily";
|
||||
users1.Password = "123456";
|
||||
users1.PassSalt = "123456";
|
||||
result = UserHelper.SaveUser(users1);
|
||||
Assert.IsTrue(result == true, "带有参数的UserHelper.SaveUser方法中更新用户信息失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.DataAccess.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class UserHelperTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void RetrieveUsersTest()
|
||||
{
|
||||
var result = UserHelper.RetrieveUsers("1");
|
||||
Assert.IsTrue((result.Count() == 0 || result.Count() == 1), "带有参数的UserHelper.RetrieveUsers方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
result = UserHelper.RetrieveUsers();
|
||||
Assert.IsTrue(result.Count() >= 0, "不带参数的UserHelper.RetrieveUsers方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeleteUserTest()
|
||||
{
|
||||
//TODO: Delete方法没有返回值,自己想想做一个返回值即可
|
||||
Assert.IsTrue(UserHelper.DeleteUser("1,2"), "带有参数的UserHelper.DeleteUserTest方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
Assert.IsFalse(UserHelper.DeleteUser(string.Empty), "参数为空字符串的UserHelper.DeleteUserTest方法调用失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SaveUserTest()
|
||||
{
|
||||
//TODO: 两个提示一模一样完全不知道哪里出了问题,本单元测试未通过
|
||||
User users = new User();
|
||||
users.ID = 0;
|
||||
users.UserName = "liqi";
|
||||
users.Password = "123";
|
||||
users.PassSalt = "123";
|
||||
var result = UserHelper.SaveUser(users);
|
||||
Assert.IsTrue(result == true, "带有参数的UserHelper.SaveUser方法中新建用户信息失败,请检查数据库连接或者数据库SQL语句");
|
||||
|
||||
User users1 = new User();
|
||||
users1.ID = 1;
|
||||
users1.UserName = "Lily";
|
||||
users1.Password = "123456";
|
||||
users1.PassSalt = "123456";
|
||||
result = UserHelper.SaveUser(users1);
|
||||
Assert.IsTrue(result == true, "带有参数的UserHelper.SaveUser方法中更新用户信息失败,请检查数据库连接或者数据库SQL语句");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bootstrap.DataAccess", "Boo
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{87319AF5-7C40-4362-B67C-35F9DD737DB4}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
DatabaseScripts\ExtendedChecker.sql = DatabaseScripts\ExtendedChecker.sql
|
||||
DatabaseScripts\Install.sql = DatabaseScripts\Install.sql
|
||||
DatabaseScripts\Proc_StartTerminal.sql = DatabaseScripts\Proc_StartTerminal.sql
|
||||
DatabaseScripts\Proc_StopTerminal.sql = DatabaseScripts\Proc_StopTerminal.sql
|
||||
DatabaseScripts\Readme.txt = DatabaseScripts\Readme.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -1,147 +1,144 @@
|
|||
USE [master]
|
||||
GO
|
||||
|
||||
Create database [ExtendedChecker]
|
||||
Create database [BootstrapAdmin]
|
||||
GO
|
||||
|
||||
ALTER DATABASE [ExtendedChecker] SET RECOVERY SIMPLE
|
||||
ALTER DATABASE [BootstrapAdmin] SET RECOVERY SIMPLE
|
||||
GO
|
||||
|
||||
ALTER DATABASE [ExtendedChecker] SET AUTO_SHRINK ON
|
||||
ALTER DATABASE [BootstrapAdmin] SET AUTO_SHRINK ON
|
||||
GO
|
||||
|
||||
USE [ExtendedChecker]
|
||||
USE [BootstrapAdmin]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Rules] Script Date: 9/1/2016 7:44:10 PM ******/
|
||||
/****** Object: Table [dbo].[Users] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Terminals](
|
||||
CREATE TABLE [dbo].[Users](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [nvarchar](50) NOT NULL,
|
||||
[ClientIP] [varchar](15) NOT NULL,
|
||||
[ClientPort] [int] NOT NULL,
|
||||
[ServerIP] [varchar](15) NOT NULL,
|
||||
[ServerPort] [int] NOT NULL,
|
||||
[DeviceIP] [varchar](15) NOT NULL,
|
||||
[DevicePort] [int] NOT NULL,
|
||||
[DatabaseName] [varchar](50) NULL,
|
||||
[DatabaseUserName] [varchar](50) NULL,
|
||||
[DatabasePassword] [varchar](50) NULL,
|
||||
[Status] [bit] NOT NULL,
|
||||
CONSTRAINT [PK_Terminal] PRIMARY KEY CLUSTERED
|
||||
[UserName] [nvarchar](50) NULL,
|
||||
[Password] [nvarchar](50) NULL,
|
||||
[PassSalt] [nvarchar](50) NULL,
|
||||
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
SET ANSI_PADDING OFF
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[TerminalRuleConfig] Script Date: 09/06/2016 14:31:10 ******/
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UserName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Password'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'验证' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'PassSalt'
|
||||
GO
|
||||
/****** Object: Table [dbo].[UserRole] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[TerminalRuleConfig](
|
||||
[TerminalID] [int] NOT NULL,
|
||||
[RuleID] [int] NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
/****** Object: Table [dbo].[ScanInventory] Script Date: 09/06/2016 14:31:10 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
SET ANSI_PADDING ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[ScanInventory](
|
||||
CREATE TABLE [dbo].[UserRole](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[BarCode] [varchar](32) NOT NULL,
|
||||
[TerminalID] [int] NOT NULL,
|
||||
[ScanTime] [datetime] NOT NULL,
|
||||
[BarCodeType] [int] NOT NULL,
|
||||
CONSTRAINT [PK_ScanInventory] PRIMARY KEY CLUSTERED
|
||||
[UserID] [int] NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_UserRole] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
SET ANSI_PADDING OFF
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserRole', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Rules] Script Date: 09/06/2016 14:31:10 ******/
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserRole', @level2type=N'COLUMN',@level2name=N'UserID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserRole', @level2type=N'COLUMN',@level2name=N'RoleID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[UserGroup] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Rules](
|
||||
CREATE TABLE [dbo].[UserGroup](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [nvarchar](200) NOT NULL,
|
||||
[Memo] [nvarchar](2000) NULL,
|
||||
[Interval] [int] NOT NULL,
|
||||
[Enabled] [bit] NOT NULL,
|
||||
CONSTRAINT [PK_Rules] PRIMARY KEY CLUSTERED
|
||||
[UserID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_UserGroup] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
/****** Object: Default [DF_Rules_Enabled] Script Date: 09/06/2016 14:31:10 ******/
|
||||
ALTER TABLE [dbo].[Rules] ADD CONSTRAINT [DF_Rules_Enabled] DEFAULT ((1)) FOR [Enabled]
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
/****** Object: Default [DF_Terminals_Satus] Script Date: 09/06/2016 14:31:10 ******/
|
||||
ALTER TABLE [dbo].[Terminals] ADD CONSTRAINT [DF_Terminals_Satus] DEFAULT ((0)) FOR [Status]
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'UserID'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'GroupID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Roles] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: Argo Zhang
|
||||
-- Create date: 2016-09-06
|
||||
-- Description:
|
||||
-- =============================================
|
||||
CREATE PROCEDURE Proc_StartTerminal
|
||||
-- Add the parameters for the stored procedure here
|
||||
@tId int,
|
||||
@rId int
|
||||
WITH ENCRYPTION
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
-- Insert statements for procedure here
|
||||
delete from TerminalRuleConfig where TerminalID = @tId;
|
||||
insert into TerminalRuleConfig (TerminalID, RuleID) values (@tId, @rId);
|
||||
update Terminals set Status = 1 where Id = @tId;
|
||||
END
|
||||
CREATE TABLE [dbo].[Roles](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Roles] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'RoleName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
/****** Object: Table [dbo].[RoleGroup] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: Argo Zhang
|
||||
-- Create date: 2016-09-06
|
||||
-- Description:
|
||||
-- =============================================
|
||||
CREATE PROCEDURE Proc_StopTerminal
|
||||
-- Add the parameters for the stored procedure here
|
||||
@tId int
|
||||
WITH ENCRYPTION
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
-- Insert statements for procedure here
|
||||
delete from TerminalRuleConfig where TerminalID = @tId;
|
||||
update Terminals set Status = 0 where Id = @tId;
|
||||
END
|
||||
CREATE TABLE [dbo].[RoleGroup](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_RoleGroup] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'RoleGroup', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'RoleGroup', @level2type=N'COLUMN',@level2name=N'RoleID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'RoleGroup', @level2type=N'COLUMN',@level2name=N'GroupID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Groups] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Groups](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[GroupName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Groups] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'GroupName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
|
|
Loading…
Reference in New Issue