15 changed files with 1184 additions and 23 deletions
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
<%@ WebHandler Language="C#" CodeBehind="ConfigHandler.ashx.cs" Class="MESWebSite.HttpHandlers.ConfigHandler" %> |
@ -0,0 +1,132 @@ |
|||||
|
using MESClassLibrary.BLL.BasicInfo; |
||||
|
using MESClassLibrary.EFModel; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Web; |
||||
|
|
||||
|
namespace MESWebSite.HttpHandlers |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// ConfigHandler 的摘要说明
|
||||
|
/// </summary>
|
||||
|
public class ConfigHandler : IHttpHandler |
||||
|
{ |
||||
|
|
||||
|
HttpRequest Request = null; |
||||
|
HttpResponse Response = null; |
||||
|
|
||||
|
public void ProcessRequest(HttpContext context) |
||||
|
{ |
||||
|
context.Response.ContentType = "text/plain"; |
||||
|
Request = context.Request; |
||||
|
Response = context.Response; |
||||
|
|
||||
|
string method = Request.Params["method"]; |
||||
|
switch (method) |
||||
|
{ |
||||
|
|
||||
|
case "QueryList": |
||||
|
QueryList(); |
||||
|
break; |
||||
|
case "SaveInfo": |
||||
|
SaveInfo(); |
||||
|
break; |
||||
|
case "DelInfo": |
||||
|
DelInfo(); |
||||
|
break; |
||||
|
case "QueryForCombobox": |
||||
|
QueryForCombobox(); |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
public bool IsReusable |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void QueryList() |
||||
|
{ |
||||
|
string page = Request.Params["page"]; |
||||
|
string pagesize = Request.Params["rows"]; |
||||
|
string name = Request.Params["name"]; |
||||
|
|
||||
|
if (string.IsNullOrEmpty(page)) |
||||
|
{ |
||||
|
page = "0"; |
||||
|
} |
||||
|
if (string.IsNullOrEmpty(pagesize)) |
||||
|
{ |
||||
|
pagesize = "15"; |
||||
|
} |
||||
|
ConfigBLL bll = new ConfigBLL(); |
||||
|
Response.Write(bll.SearchInfo(page, pagesize, name)); |
||||
|
Response.End(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
void SaveInfo() |
||||
|
{ |
||||
|
string ID = Request.Params["ID"]; |
||||
|
string name = Request.Params["name"]; |
||||
|
string value = Request.Params["value"]; |
||||
|
string des = Request.Params["des"]; |
||||
|
|
||||
|
ConfigBLL bll = new ConfigBLL(); |
||||
|
tb_Config md = new tb_Config(); |
||||
|
|
||||
|
//md.name = name;
|
||||
|
if(value != "true" && value != "false") |
||||
|
{ |
||||
|
Response.Write("false"); |
||||
|
Response.End(); |
||||
|
return; |
||||
|
} |
||||
|
md.value = value; |
||||
|
//md.des = des;
|
||||
|
|
||||
|
|
||||
|
|
||||
|
if (ID == "0") |
||||
|
{ |
||||
|
//新增
|
||||
|
md.ID = Guid.NewGuid().ToString(); |
||||
|
Response.Write(bll.AddInfo(md) == true ? "true" : "false"); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
//修改
|
||||
|
md.ID = ID; |
||||
|
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); |
||||
|
} |
||||
|
Response.End(); |
||||
|
} |
||||
|
void DelInfo() |
||||
|
{ |
||||
|
string ID = Request.Params["ID"]; |
||||
|
|
||||
|
ConfigBLL bll = new ConfigBLL(); |
||||
|
tb_Config md = new tb_Config(); |
||||
|
|
||||
|
md.ID = ID; |
||||
|
//Response.Write(bll.DelInfo(md) == true ? "true" : "false");
|
||||
|
Response.Write("false"); |
||||
|
Response.End(); |
||||
|
|
||||
|
} |
||||
|
void QueryForCombobox() |
||||
|
{ |
||||
|
PlaceBLL bll = new PlaceBLL(); |
||||
|
Response.Write(bll.GetComboboxData()); |
||||
|
Response.End(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,354 @@ |
|||||
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Config.aspx.cs" Inherits="MESWebSite.Manage.Config" %> |
||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
|
||||
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
<head runat="server"> |
||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
||||
|
<link href="/CSS/Basics.css" rel="stylesheet" /> |
||||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" /> |
||||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" /> |
||||
|
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" /> |
||||
|
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script> |
||||
|
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script> |
||||
|
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script> |
||||
|
<script src="/Scripts/MyJs.js" type="text/javascript"></script> |
||||
|
<style> |
||||
|
#w td { |
||||
|
padding: 5px 5px; |
||||
|
text-align: left; |
||||
|
vertical-align: middle; |
||||
|
} |
||||
|
|
||||
|
#w .title { |
||||
|
vertical-align: middle; |
||||
|
text-align: right; |
||||
|
width: 80px; |
||||
|
height: 40px; |
||||
|
} |
||||
|
|
||||
|
p { |
||||
|
padding: 5px; |
||||
|
font-size: small; |
||||
|
font-family: 微软雅黑; |
||||
|
} |
||||
|
|
||||
|
.datagrid { |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.search_first{ |
||||
|
margin-left: 33% |
||||
|
} |
||||
|
|
||||
|
/* 中等屏幕 桌面显示器 992至1400 */ |
||||
|
@media screen and (min-width:992px) and (max-width:1400px) { |
||||
|
.search_first { margin-left: 1%; } |
||||
|
} |
||||
|
</style> |
||||
|
<title>配置信息</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<form id="form1" runat="server"> |
||||
|
<div class="top"> |
||||
|
<table style="width: 100%"> |
||||
|
<tr style="display: flex;flex-direction: row; flex-wrap: wrap;"> |
||||
|
|
||||
|
<td><span class="title" style="width: 100px">配置信息</span> |
||||
|
</td> |
||||
|
<td style="width: 235px;"></td> |
||||
|
<td style="width: 235px;">配置项: |
||||
|
<input type="text" id="name_s" style="width: 140px;" /></td> |
||||
|
<td style="width: 80px" ><a class="topsearchBtn">查询</a></td> |
||||
|
|
||||
|
<td style="width: 80px"> |
||||
|
<a class="topaddBtn">新增</a> |
||||
|
</td> |
||||
|
<td style="width: 80px"> |
||||
|
<a class="toppenBtn">编辑</a> |
||||
|
</td> |
||||
|
<td style="width: 80px"> |
||||
|
<a class="topdelBtn">删除</a> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
<table id="tb" title="配置列表" style="width: 99%;"> |
||||
|
</table> |
||||
|
<!-- 编辑窗口 --> |
||||
|
<div id="w" style="padding: 10px; visibility: hidden" title="编辑"> |
||||
|
<table cellpadding="0" cellspacing="0"> |
||||
|
<tr> |
||||
|
<td class="title" style="width: 110px;"> |
||||
|
<p> |
||||
|
配置项: |
||||
|
</p> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input id="name" type="text" class="text" style="width: 230px; height: 30px;" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td class="title" style="width: 110px;"> |
||||
|
<p> |
||||
|
值: |
||||
|
</p> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input id="value" type="text" class="text" style="width: 230px; height: 30px;" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td class="title" style="width: 110px;"> |
||||
|
<p> |
||||
|
描述: |
||||
|
</p> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input id="des" type="text" class="text" style="width: 230px; height: 30px;" /> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
<!-- 编辑窗口 - footer --> |
||||
|
<div id="ft" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden"> |
||||
|
<a class="saveBtn" id="saveBtn">保存</a> |
||||
|
</div> |
||||
|
|
||||
|
<div hidden="hidden"> |
||||
|
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label> |
||||
|
</div> |
||||
|
<input id="UserID" type="text" hidden="hidden" runat="server" /> |
||||
|
<script> |
||||
|
|
||||
|
/**************** 全局变量 ***************/ |
||||
|
var PrimaryID; //要编辑的id |
||||
|
var dg = $('#tb'); //表格 |
||||
|
var isEdit = false; //是否为编辑状态 |
||||
|
|
||||
|
/**************** DOM加载 ***************/ |
||||
|
$(function () { |
||||
|
$.ajaxSetup({ |
||||
|
cache: false //关闭AJAX缓存 |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
//新增按钮点击 |
||||
|
$('.topaddBtn').first().click(function () { |
||||
|
isEdit = false; |
||||
|
$('#w').window('open'); |
||||
|
}); |
||||
|
|
||||
|
//编辑按钮点击 |
||||
|
$('.toppenBtn').first().click(function () { |
||||
|
isEdit = true; |
||||
|
initEidtWidget(); |
||||
|
}); |
||||
|
|
||||
|
//删除按钮 |
||||
|
$('.topdelBtn').first().click(function () { |
||||
|
$.messager.confirm('提示框', '你确定要删除吗?', function (r) { |
||||
|
if (r) { |
||||
|
deleteInfos(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
//搜索按钮 |
||||
|
$('.topsearchBtn').first().click(function () { |
||||
|
SearchInfo(); |
||||
|
}); |
||||
|
|
||||
|
//保存按钮 |
||||
|
$('#saveBtn').bind('click', function () { |
||||
|
SaveInfo(isEdit); |
||||
|
}); |
||||
|
|
||||
|
//编辑窗口加载 |
||||
|
$('#w').window({ |
||||
|
modal: true, |
||||
|
closed: true, |
||||
|
minimizable: false, |
||||
|
maximizable: false, |
||||
|
collapsible: false, |
||||
|
width: 460, |
||||
|
height: 520, |
||||
|
footer: '#ft', |
||||
|
top: 20, |
||||
|
onBeforeClose: function () { clearw(); }, |
||||
|
onBeforeOpen: function () { |
||||
|
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible'); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
dg = $('#tb').datagrid({ |
||||
|
fitColumns: true, |
||||
|
nowrap: false, |
||||
|
striped: true, |
||||
|
collapsible: false, |
||||
|
url: "/HttpHandlers/ConfigHandler.ashx?method=QueryList", |
||||
|
//sortName: 'sortNumber', |
||||
|
//sortOrder: 'asc', |
||||
|
remoteSort: false, |
||||
|
columns: [[ |
||||
|
{ field: 'ID', title: 'ID', hidden: true }, |
||||
|
{ field: 'name', title: '项目', sortable: 'true', width: 10 }, |
||||
|
{ field: 'value', title: '值', sortable: 'true', width: 10 }, |
||||
|
{ field: 'des', title: '描述', sortable: 'true', width: 10 } |
||||
|
]], |
||||
|
|
||||
|
pagination: true,//表示在datagrid设置分页 |
||||
|
rownumbers: true, |
||||
|
singleSelect: true |
||||
|
}); |
||||
|
|
||||
|
dg.datagrid('getPager').pagination({ |
||||
|
pageSize: 10, |
||||
|
pageNumber: 1, |
||||
|
pageList: [10, 20, 30, 40, 50], |
||||
|
beforePageText: '第',//页数文本框前显示的汉字 |
||||
|
afterPageText: '页 共 {pages} 页', |
||||
|
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录', |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
/**************** 主要业务程序 ***************/ |
||||
|
//新增 / 编辑 |
||||
|
function SaveInfo(isEdit) { |
||||
|
|
||||
|
var ID = isEdit == true ? PrimaryID : 0; |
||||
|
var name = $('#name').val(); |
||||
|
var value = $('#value').val(); |
||||
|
var des = $('#des').val(); |
||||
|
|
||||
|
if (name == "") { |
||||
|
$.messager.alert('提示', '配置项不能为空,请重新输入', 'warning'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (value == "") { |
||||
|
$.messager.alert('提示', '值不能为空,请重新输入', 'warning'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var model = { |
||||
|
ID: ID, |
||||
|
name: name, |
||||
|
value: value, |
||||
|
des: des, |
||||
|
method: 'SaveInfo' |
||||
|
}; |
||||
|
SaveModel(model); |
||||
|
} |
||||
|
function SaveModel(model) { |
||||
|
$.ajax({ |
||||
|
type: "POST", |
||||
|
async: false, |
||||
|
url: "/HttpHandlers/ConfigHandler.ashx", |
||||
|
data: model, |
||||
|
success: function (data) { |
||||
|
if (data == 'true') { |
||||
|
$.messager.alert('提示', '已保存', 'info'); |
||||
|
dg.datagrid('reload'); |
||||
|
$('#w').window('close'); |
||||
|
} |
||||
|
else { |
||||
|
$.messager.alert('提示', '保存失败,值只能是true或者false', 'warning'); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
error: function () { |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
//查询方法 |
||||
|
function SearchInfo() { |
||||
|
|
||||
|
var name = $('#name_s').val(); |
||||
|
|
||||
|
var queryParams = { |
||||
|
name: name |
||||
|
}; |
||||
|
dg.datagrid({ |
||||
|
queryParams: queryParams |
||||
|
}); |
||||
|
dg.datagrid('reload'); |
||||
|
|
||||
|
} |
||||
|
//编辑时加载窗体数据 |
||||
|
function initEidtWidget() { |
||||
|
var selRows = dg.datagrid('getSelections'); |
||||
|
if (selRows.length > 1) { |
||||
|
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning'); |
||||
|
return; |
||||
|
} else if (selRows.length == 0) { |
||||
|
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//窗体数据初始化 |
||||
|
var row = selRows[0]; |
||||
|
PrimaryID = row.ID; |
||||
|
$('#name').val(row.name); |
||||
|
$('#value').val(row.value); |
||||
|
$('#des').val(row.des); |
||||
|
$('#w').window('open'); |
||||
|
|
||||
|
} |
||||
|
//删除方法 |
||||
|
function deleteInfos() { |
||||
|
var selRows = dg.datagrid('getSelections'); |
||||
|
if (selRows.length > 1) { |
||||
|
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning'); |
||||
|
return; |
||||
|
} else if (selRows.length == 0) { |
||||
|
$.messager.alert('提示', '请选择一条记录进行删除', 'warning'); |
||||
|
return; |
||||
|
} |
||||
|
var row = selRows[0]; |
||||
|
|
||||
|
var model = { |
||||
|
ID: row.ID, |
||||
|
method: 'DelInfo' |
||||
|
}; |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/HttpHandlers/ConfigHandler.ashx", |
||||
|
data: model, |
||||
|
async: false, |
||||
|
success: function (data) { |
||||
|
if (data == 'true') { |
||||
|
$.messager.alert('提示', '已删除', 'info'); |
||||
|
dg.datagrid('reload'); |
||||
|
} |
||||
|
else { |
||||
|
$.messager.alert('提示', '配置项删除失败', 'warning'); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/**************** 辅助业务程序 ***************/ |
||||
|
/**********************************************/ |
||||
|
/***************** 窗体程序 *******************/ |
||||
|
/**********************************************/ |
||||
|
//编辑窗口关闭清空数据 |
||||
|
function clearw() { |
||||
|
|
||||
|
$('#name').val(''); |
||||
|
$('#value').val(''); |
||||
|
$('#des').val(''); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</form> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Web; |
||||
|
using System.Web.UI; |
||||
|
using System.Web.UI.WebControls; |
||||
|
|
||||
|
namespace MESWebSite.Manage |
||||
|
{ |
||||
|
public partial class Config : System.Web.UI.Page |
||||
|
{ |
||||
|
protected void Page_Load(object sender, EventArgs e) |
||||
|
{ |
||||
|
if (Request.Cookies["LoginUserInfo"] == null) |
||||
|
{ |
||||
|
Response.Write("<script language=javascript>alert('您的登录信息已过期,请重新登录!');top.location.href='../Login.aspx';</script>"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <自动生成>
|
||||
|
// 此代码由工具生成。
|
||||
|
//
|
||||
|
// 对此文件的更改可能导致不正确的行为,如果
|
||||
|
// 重新生成代码,则所做更改将丢失。
|
||||
|
// </自动生成>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace MESWebSite.Manage |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public partial class Config |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// form1 控件。
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 自动生成的字段。
|
||||
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
|
/// </remarks>
|
||||
|
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// lblMessage 控件。
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 自动生成的字段。
|
||||
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
|
/// </remarks>
|
||||
|
protected global::System.Web.UI.WebControls.Label lblMessage; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// UserID 控件。
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// 自动生成的字段。
|
||||
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
|
/// </remarks>
|
||||
|
protected global::System.Web.UI.HtmlControls.HtmlInputText UserID; |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- |
||||
|
https://go.microsoft.com/fwlink/?LinkID=208121. |
||||
|
--> |
||||
|
<Project> |
||||
|
<PropertyGroup> |
||||
|
<DeleteExistingFiles>false</DeleteExistingFiles> |
||||
|
<ExcludeApp_Data>false</ExcludeApp_Data> |
||||
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish> |
||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> |
||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform> |
||||
|
<PublishProvider>FileSystem</PublishProvider> |
||||
|
<PublishUrl>D:\发布\Mes</PublishUrl> |
||||
|
<WebPublishMethod>FileSystem</WebPublishMethod> |
||||
|
<_TargetId>Folder</_TargetId> |
||||
|
</PropertyGroup> |
||||
|
</Project> |
Loading…
Reference in new issue