You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
14 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostAddress.aspx.cs" Inherits="TradeManage.SysManage.PostAddress" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script type="text/javascript">
var AddrModel = null;
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
ReadData();
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdAdd").click(function () {
AddrModel = null;
ShowFancybox();
});
$("#cmdSave").click(function () {
Save();
});
$("#btn_sch").click(function () {
ReadData();
});
$("#" + datagrid1.TableID + " input[CommandName]").live("click", function () {
var index = $(this).parentsUntil("tr").parent().attr("index");
AddrModel = datagrid1.Get_Model(index);
var ColName = $(this).attr("CommandName");
if (ColName == "cmdEdit") {
ShowFancybox();
}
if (ColName == "cmdDel") {
Delete(AddrModel.Id);
}
});
});
//#region 弹出
function ShowFancybox() {
$.fancybox({
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#WindowAdd',
'onStart': function () {
if (AddrModel == null) {
Clear();
} else {
$("#txtSendName").val(AddrModel.SendName);
$("#txtSendEnglishName").val(AddrModel.SendEnglishName);
$("#txtAddress").val(AddrModel.Address);
$("#txtEnglishAddress").val(AddrModel.EnglishAddress);
$("#txtPhone").val(AddrModel.Phone);
$("#txtPostCode").val(AddrModel.PostCode);
$("#txtprovince").val(AddrModel.province);
$("#txtcity").val(AddrModel.city);
$("#txtcounty").val(AddrModel.county);
$("#txtprovincecode").val(AddrModel.provincecode);
$("#txtcitycode").val(AddrModel.citycode);
$("#txtcountycode").val(AddrModel.countycode);
}
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "中文地址";
col.CellTemplate = "<span>{Bind Address}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "英文地址";
col.CellTemplate = "<span>{Bind EnglishAddress}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "电话";
col.CellTemplate = "<span>{Bind Phone}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "200px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;<input CommandName='cmdDel' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(30);
datagrid1.SetPageIndex(1);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
//#endregion
//#region 读取数据
function ReadData() {
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetPostAddressList",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.DataBind(data.d);
}
});
}
//#endregion
//#region 清空
function Clear() {
$("#txtSendName").val("");
$("#txtSendEnglishName").val("");
$("#txtAddress").val("");
$("#txtEnglishAddress").val("");
$("#txtPhone").val("");
$("#txtPostCode").val("");
$("#txtprovince").val("");
$("#txtcounty").val("");
$("#txtcity").val("");
$("#txtprovincecode").val("");
$("#txtcitycode").val("");
$("#txtcountycode").val("");
}
//#endregion
//#region 删除
function Delete(Id) {
if (window.confirm("确定要删除吗?") == false) return;
var param = new Object();
param.Id = Id;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/DeletePostAddress",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
ReadData(); //刷新DataGrid
}
});
}
//#endregion
//#endregion
//#region 保存
function SaveAddr() {
if (AddrModel == null) {
AddrModel = new Object();
AddrModel.Id = 0;
}
AddrModel.SendName = $("#txtSendName").val();
AddrModel.SendEnglishName = $("#txtSendEnglishName").val();
AddrModel.Address = $("#txtAddress").val();
AddrModel.EnglishAddress = $("#txtEnglishAddress").val();
AddrModel.Phone = $("#txtPhone").val();
AddrModel.PostCode = $("#txtPostCode").val();
AddrModel.province = $("#txtprovince").val();
AddrModel.city = $("#txtcity").val();
AddrModel.county = $("#txtcounty").val();
// AddrModel.street = $("#txtstreet").val();
AddrModel.provincecode = $("#txtprovincecode").val();
AddrModel.citycode = $("#txtcitycode").val();
AddrModel.countycode = $("#txtcountycode").val();
//AddrModel.streetcode = $("#txtstreetcode").val();
if (AddrModel.Address == "") { alert("地址(中文)不能为空"); $("#txtAddress").focus(); return; }
if (AddrModel.EnglishAddress == "") { alert("地址(英文)不能为空"); $("#txtEnglishAddress").focus(); return; }
if (AddrModel.PostCode == "") { alert("邮编不能为空"); $("#txtPostCode").focus(); return; }
if (AddrModel.Phone == "") { alert("电话不能为空"); $("#txtPhone").focus(); return; }
if (AddrModel.SendName == "") { alert("发货人(中文)不能为空"); $("#txtSendName").focus(); return; }
if (AddrModel.SendEnglishName == "") { alert("发货人(英文)不能为空"); $("#txtSendEnglishName").focus(); return; }
var param = new Object();
param.AddrModel = AddrModel;
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/SavePostAddress",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
ReadData();
alert("保存成功");
$.fancybox.close();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
发货地址
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr style="display:none">
<td class="f1" width="18%">中文名/简称/全称:
</td> <td width="25%"> <input id="txt_Name" class="editTextbox" style="width: 120px;" type="text" />
</td> <td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr >
<td colspan="3">
<input id="cmdAdd" class="btnClass btnClassAdd" type="button" value="新增" />
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
<div style="display: none;">
<div id="WindowAdd" title="编辑" style="width: 550px; height: 300px;">
<table id="tb2" class="tableAll" style="width: 99%;">
<colgroup>
<col style="width: 80px;" />
<col style="30%" />
<col style="width: 80px;" />
<col />
</colgroup>
<tr>
<td class="f1"><span style="color: Red;">*</span>地址(中文):
</td>
<td colspan="3">
<input id="txtAddress" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1"><span style="color: Red;">*</span>地址(英文):
</td>
<td colspan="3">
<input id="txtEnglishAddress" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1"><span style="color: Red;">*</span>发货人(中文):
</td>
<td>
<input id="txtSendName" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1"><span style="color: Red;">*</span>发货人(英文):
</td>
<td>
<input id="txtSendEnglishName" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1"><span style="color: Red;">*</span>电话:
</td>
<td>
<input id="txtPhone" type="text" class="editTextbox" style="width: 99%;" />
</td>
<td class="f1"><span style="color: Red;">*</span>邮编:
</td>
<td>
<input id="txtPostCode" type="text" class="editTextbox" style="width: 99%;" />
</td>
</tr>
<tr>
<td class="f1">省/市/区:
</td>
<td colspan="3">
<input id="txtprovince" type="text" class="editTextbox" style="width: 120px;" />省 <input id="txtcity" type="text" class="editTextbox" style="width: 120px;" />市 <input id="txtcounty" type="text" class="editTextbox" style="width: 120px;" />区
</td>
</tr>
<tr>
<td class="f1">省/市/区(代码:
</td>
<td colspan="3">
<input id="txtprovincecode" type="text" class="editTextbox" style="width: 120px;" />省 <input id="txtcitycode" type="text" class="editTextbox" style="width: 120px;" />市 <input id="txtcountycode" type="text" class="editTextbox" style="width: 120px;" />区
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" class="btnClass btnClassSave" type="button" value="保存" /> &nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
</div>
</body>
</html>