700 lines
35 KiB
Plaintext
700 lines
35 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="../FIBasePage.master" AutoEventWireup="true" CodeFile="VariableManage.aspx.cs" Inherits="fic_Management_VariableManage" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" Runat="Server">
|
|
<link href="<%=Common.GenerateUrl("fic/css/Grid.css") %>" rel="stylesheet" />
|
|
<link href="<%=Common.GenerateUrl("fic/css/form.css") %>" rel="stylesheet" />
|
|
<link href="<%=Common.GenerateUrl("fic/css/theme.css") %>" rel="stylesheet" />
|
|
<style>
|
|
body {
|
|
min-width: 628px;
|
|
-moz-min-width: 628px;
|
|
-ms-min-width: 628px;
|
|
-o-min-width: 628px;
|
|
-webkit-min-width: 628px;
|
|
}
|
|
</style>
|
|
|
|
<script src="<%=Common.GenerateUrl("fic/js/controls/gridctrl.js") %>"></script>
|
|
<script src="<%=Common.GenerateUrl("fic/js/chart.js") %>"></script>
|
|
<script src="<%=Common.GenerateUrl("fic/js/controls/form.js") %>"></script>
|
|
<script type="text/javascript">
|
|
|
|
var gridCtrl;
|
|
var selectIID;
|
|
var rowdata;
|
|
var globalName;
|
|
var arrName = [];
|
|
var FilterTypes = [];
|
|
|
|
function initDatatable() {
|
|
gridCtrl = new GridView('#GlobalVariable_list');
|
|
gridCtrl.rowdblclick = function (e) {
|
|
if ($("#<%=btnEdit.ClientID %>").attr("disabled") == undefined) {
|
|
showEdit();
|
|
}
|
|
}
|
|
|
|
gridCtrl.cellclick = function (rowindex) {
|
|
//console.log(rowindex);
|
|
//console.log(gridCtrl.rows[rowindex]);
|
|
var editClientID = '<%=btnEdit.ClientID %>';
|
|
var delClientID = '<%=btnDel.ClientID %>';
|
|
$("#" + editClientID).attr("disabled", "disabled");
|
|
$("#" + delClientID).attr("disabled", "disabled");
|
|
rowdata = gridCtrl.source[rowindex];
|
|
if (rowdata) {
|
|
selectIID = rowdata.Values.DcIID;
|
|
if (selectIID !== _utility.GuidEmpty) {
|
|
if (FilterTypes && FilterTypes.length > 0) {
|
|
for (var i = 0; i < FilterTypes.length; i++) {
|
|
if (FilterTypes[i].IID === selectIID) {
|
|
$("#" + editClientID).removeAttr("disabled");
|
|
$("#" + delClientID).removeAttr("disabled");
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$("#" + editClientID).removeAttr("disabled");
|
|
$("#" + delClientID).removeAttr("disabled");
|
|
}
|
|
}
|
|
}
|
|
gridCtrl.selectedrowchanged= function(rowindex) {
|
|
var editClientID = '<%=btnEdit.ClientID %>';
|
|
var delClientID = '<%=btnDel.ClientID %>';
|
|
$("#" + editClientID).attr("disabled", "disabled");
|
|
$("#" + delClientID).attr("disabled", "disabled");
|
|
rowdata = gridCtrl.source[rowindex];
|
|
if (rowdata) {
|
|
selectIID = rowdata.Values.DcIID; if (selectIID !== _utility.GuidEmpty) {
|
|
if (FilterTypes && FilterTypes.length > 0) {
|
|
for (var i = 0; i < FilterTypes.length; i++) {
|
|
if (FilterTypes[i].IID === selectIID) {
|
|
$("#" + editClientID).removeAttr("disabled");
|
|
$("#" + delClientID).removeAttr("disabled");
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$("#" + editClientID).removeAttr("disabled");
|
|
$("#" + delClientID).removeAttr("disabled");
|
|
}
|
|
}
|
|
}
|
|
|
|
gridCtrl.columnchanged = GridView.saveColumnInfo('ManagementGlobalVariableGrid');
|
|
}
|
|
|
|
function initList() {
|
|
var lastIndex = gridCtrl.selectedIndex;
|
|
var top = gridCtrl.scrollTop();
|
|
|
|
ShowLoadingMask();
|
|
|
|
_network.management("GetGlobalVariableList", [], function (e) {
|
|
//console.log(e);
|
|
var rows = e.Result;
|
|
if (arrName.length !== "") {
|
|
arrName = [];
|
|
}
|
|
var FilterRows = [];
|
|
for (var i = 0; i < rows.length; i++) {
|
|
|
|
var r = rows[i];
|
|
arrName.push(r.Name);
|
|
if (r.ConnectionName === "") {
|
|
r.Type = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A025", "Fixed");
|
|
} else {
|
|
r.Type = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A026", "SQL Variable");
|
|
}
|
|
var fr = { Values: r };
|
|
FilterRows.push(fr);
|
|
}
|
|
gridCtrl.setData(FilterRows);
|
|
gridCtrl.selectedIndexes = [lastIndex];
|
|
gridCtrl.scrollTop(top);
|
|
HiddenLoadingMask();
|
|
});
|
|
|
|
|
|
}
|
|
|
|
function RefreshVariable() {
|
|
var editClientID = '<%=btnEdit.ClientID %>';
|
|
var delClientID = '<%=btnDel.ClientID %>';
|
|
$("#" + editClientID).attr("disabled", "disabled");
|
|
$("#" + delClientID).attr("disabled", "disabled");
|
|
gridCtrl.selectedIndexes=[-1];
|
|
initGridLayOut();
|
|
}
|
|
|
|
|
|
function initGridLayOut() {
|
|
//selectIID = undefined;
|
|
//rowdata = undefined;
|
|
var list_columns = [
|
|
{
|
|
name: 'Name',
|
|
caption: GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A110', 'Name'),
|
|
key: 'Name',
|
|
width: 100,
|
|
align: 'left'
|
|
},
|
|
{
|
|
name: 'Type',
|
|
caption: GetLanguageByKey('FI_FRS_DD017', 'Type'),
|
|
key: 'Type',
|
|
width: 100,
|
|
align: 'left'
|
|
},
|
|
{
|
|
name: 'SqlStatement',
|
|
caption: GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A109', 'SQL Statement'),
|
|
key: 'SqlStatement',
|
|
//styleFilter: function(item) {
|
|
// return { whiteSpace: 'nowrap' }
|
|
//},
|
|
filter: function(item) {
|
|
var a = item.SqlStatement;
|
|
var res = "";
|
|
a = a.replace(/[\r\n]/g, " ");
|
|
//var arr = a.split('\r');
|
|
|
|
//if (arr.length > 0) {
|
|
// for (var i = 0; i < arr.length; i++) {
|
|
// if (arr[i].length > 0) {
|
|
// res += arr[i];
|
|
// }
|
|
// else {
|
|
// res += " ";
|
|
// }
|
|
// }
|
|
//}
|
|
return a;
|
|
},
|
|
width: 400,
|
|
align: 'left'
|
|
},
|
|
{
|
|
name: 'DCName',
|
|
caption: GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_VARIABLES_A007', 'DC Name'),
|
|
key: 'ConnectionName',
|
|
width: 100,
|
|
align: 'left'
|
|
},
|
|
{
|
|
name: 'DefaultValue',
|
|
caption: GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_VARIABLES_A008', 'Value'),
|
|
key: 'DefaultValue',
|
|
width:100,
|
|
align: 'left'
|
|
}
|
|
];
|
|
|
|
GridView.applyGridWidth('ManagementGlobalVariableGrid', list_columns, gridCtrl, initList);
|
|
}
|
|
function ClearGridLayOut() {
|
|
$alertdialog.showConfirm(DEFAULT_LANG.FICManagement, GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A050", "Are you sure you want to reset the layout?"),
|
|
[[DEFAULT_LANG.no],
|
|
[DEFAULT_LANG.yes, function () {
|
|
_network.query("DeleteManagementGridWidth", ["ManagementGlobalVariableGrid"], initGridLayOut, function (e) { });
|
|
}]
|
|
], undefined);
|
|
}
|
|
|
|
$(function () {
|
|
$(window).resize(function () {
|
|
var div = $("#GlobalVariable_list");
|
|
div.css("height", $(window).height() - 38);
|
|
gridCtrl && gridCtrl.resize();
|
|
}).resize();
|
|
initFilterTypes();
|
|
initDatatable();
|
|
initGridLayOut();
|
|
});
|
|
|
|
function CheckDel() {
|
|
if (gridCtrl.selectedIndex < 0) {
|
|
return false;
|
|
}
|
|
var rowdata = gridCtrl.source[gridCtrl.selectedIndex];
|
|
if (rowdata) {
|
|
globalName = rowdata.Values.Name;
|
|
} else {
|
|
return false;
|
|
}
|
|
|
|
$alertdialog.showConfirm(DEFAULT_LANG.FICManagement, GetLanguageByKey("LHBIS_FIC_Client_Modules_DataTableWizard_A021", "Are you sure you want to delete this?"),
|
|
[[DEFAULT_LANG.no],
|
|
[DEFAULT_LANG.yes, function () {
|
|
ShowLoadingMask();
|
|
_network.management("DeleteGlobalVariable", [globalName], function (e) {
|
|
if (e.ErrorCode > 0) {
|
|
$alertdialog.showError(DEFAULT_LANG.FICManagement, e.ErrorMessage, initList, 'info', 500);
|
|
} else {
|
|
$alertdialog.showMesage(500, DEFAULT_LANG.FICManagement, GetLanguageByKey("LHBIS_FIC_Client_Modules_DataTableWizard_A020", "Deletion successful."), initList);
|
|
selectIID = undefined;
|
|
rowdata = undefined;
|
|
gridCtrl.selectedIndexes = [-1];
|
|
var editClientID = '<%=btnEdit.ClientID %>';
|
|
var delClientID = '<%=btnDel.ClientID %>';
|
|
$("#" + editClientID).attr("disabled", "disabled");
|
|
$("#" + delClientID).attr("disabled", "disabled");
|
|
gridCtrl.refresh();
|
|
HiddenLoadingMask();
|
|
}
|
|
});
|
|
}]
|
|
], undefined);
|
|
return false;
|
|
}
|
|
|
|
function childPageInitLanguage() {
|
|
$('#<%=btnAdd.ClientID %>').val(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DRILLDOWNURLPROVIDER_A001", "Add"));
|
|
$('#<%=btnEdit.ClientID %>').val(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DATATABLEGROUPSCTRL_A003", "Edit"));
|
|
$('#<%=btnDel.ClientID %>').val(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DRILLDOWNURLPROVIDER_A002", "Delete"));
|
|
$('#<%=btnRefresh.ClientID %>').val(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DRILLDOWNURLPROVIDER_A003", "Refresh"));
|
|
$('#<%=btnResetlayout.ClientID %>').val(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DRILLDOWNURLPROVIDER_A004", "Reset Layout"));
|
|
}
|
|
|
|
|
|
|
|
function showAdd() {
|
|
var frm = new $GlobalFilterEdit();
|
|
frm.showOpen($("body"), FilterTypes, undefined, arrName, initGridLayOut);
|
|
frm.formCtrl.css({ "min-width": "400px", "min-height": "400px" });
|
|
frm.bodyCtrl.css({ "min-width": "400px", "min-height": "400px" });
|
|
}
|
|
|
|
function showEdit() {
|
|
if (gridCtrl.selectedIndex < 0) {
|
|
return false;
|
|
}
|
|
var rowdata = gridCtrl.source[gridCtrl.selectedIndex];
|
|
if (rowdata) {
|
|
selectIID = rowdata.Values.DcIID;
|
|
} else {
|
|
return false;
|
|
}
|
|
var frm = new $GlobalFilterEdit();
|
|
frm.showOpen($("body"), FilterTypes, rowdata, arrName, initGridLayOut);
|
|
frm.formCtrl.css({ "min-width": "400px", "min-height": "400px" });
|
|
frm.bodyCtrl.css({ "min-width": "400px", "min-height": "400px" });
|
|
}
|
|
|
|
function initFilterTypes() {
|
|
_network.management("GetDataConnectionsInDTM", [], function (e) {
|
|
if (e.Result && e.Result.length > 0) {
|
|
for (var i = 0; i < e.Result.length; i++) {
|
|
FilterTypes.push({ PluginName: e.Result[i].ConnectionName, IID: e.Result[i].IID });
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
<script type="text/javascript">
|
|
if (typeof $GlobalFilterEdit !== 'object') {
|
|
|
|
$GlobalFilterEdit = $form.extend({
|
|
});
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
$GlobalFilterEdit.prototype.showOpen = function (_ParentDom, FilterTypes, globalFilterData,arrName, callBack) {
|
|
|
|
var title = GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_VARIABLES_A010', 'Add Variable');;
|
|
if (globalFilterData) {
|
|
title = GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_VARIABLES_A009', 'Edit Variable');
|
|
}
|
|
var width = 610;
|
|
var height = 400;
|
|
if (_utility.NeedModifyUI()) {
|
|
width = 705;
|
|
height = 450;
|
|
}
|
|
//创建基础窗体
|
|
this.createForm(title, _ParentDom, width, height);
|
|
//填充内容
|
|
var _content = $("<div></div>").css({ "margin-top": "10px", "margin-left": "10px", "margin-right": "10px" });
|
|
var tbDom = $("<table border='0' cellspacing='0' cellpadding='0' style='margin-top:15px; width:100%;'></table>").appendTo(_content);
|
|
var trDom = $("<tr class='topTools' style='height:30px'></tr>").appendTo(tbDom);
|
|
|
|
var td = $("<td style='width:40px;padding-left:10px;padding-right:20px;'></td>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_FICCONTROLS_CHARTSELECTCTRL_A023", "Name:")).appendTo(trDom);
|
|
|
|
td = $("<td></td>").appendTo(trDom);
|
|
//变量名称
|
|
var txtFilterName = $('<input type="text" tabindex="2" style="width:100%; ime-mode:disabled; min-width:120px; height:15px;" MaxLength="100"/>')
|
|
.appendTo(td)
|
|
.keydown(function(e) {
|
|
var code = e.keyCode;
|
|
if (!e.shiftKey) {
|
|
if (!((code > 47 && code < 58) || (code > 95 && code < 106) || (code > 64 && code < 91) || (code === 8 || code===39||code===9)||( code>32&&code<38))) {
|
|
if (e.preventDefault != null) {
|
|
e.preventDefault();
|
|
} else {
|
|
e.returnValue = false;
|
|
}
|
|
}
|
|
} else {
|
|
if (code !== 50) {
|
|
if (e.preventDefault != null) {
|
|
e.preventDefault();
|
|
} else {
|
|
e.returnValue = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
trDom = $("<tr style='height:80px;text-algin:center;'></tr>").appendTo(tbDom);
|
|
td = $("<td colspan='2'></td>").appendTo(trDom);
|
|
var fieldset = $("<fieldset></fieldset>").appendTo(td);
|
|
var legend = $("<legend></legend>").appendTo(fieldset);
|
|
var radioEdit = $("<input type='radio' tabindex='3' id='radioFixd' Name='legend'/>").appendTo(legend);
|
|
var span = $("<span><span>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A027", "Fixed Variable")).appendTo(legend);
|
|
var table1 = $("<table border='0' cellspacing='0' cellpadding='0' style='width:98%; height:40px;'></table>").appendTo(fieldset);
|
|
var table1Tr = $("<tr></tr>").appendTo(table1);
|
|
var table1Td = $("<td style='width:30px;'></td>").appendTo(table1Tr);
|
|
span = $("<span style='float:left; white-space:nowrap;' ><span>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A019", "Value:")).appendTo(table1Td);
|
|
table1Td = $("<td style='width:30px;'></td>").appendTo(table1Tr);
|
|
var tableTda = $("<td></td>").appendTo(table1Tr);
|
|
//固定变量值
|
|
var txtvariable = $("<input type='text' tabindex='4' style='min-width:120px;width:100%; height:15px;' MaxLength='100' >").appendTo(tableTda);
|
|
|
|
|
|
|
|
|
|
trDom = $("<tr style='height:80px;'></tr>").appendTo(tbDom);
|
|
td = $("<td colspan='2'></td>").appendTo(trDom);
|
|
fieldset = $("<fieldset style='overflow:auto;display:block;'></fieldset>").appendTo(td);
|
|
legend = $("<legend></legend>").appendTo(fieldset);
|
|
var radioAdd = $("<input id='radioSql' tabindex='5' type='radio' Name='legend'/>").appendTo(legend);
|
|
|
|
span = $("<span><span>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A015", "SQL Variable")).appendTo(legend);
|
|
var tableb = $("<table border='0' cellspacing='0' cellpadding='0' style='width:98%;'></table>").appendTo(fieldset);
|
|
var tablebtr = $("<tr></tr>").appendTo(tableb);
|
|
td = $("<td style='white-space:nowrap;width:40px;'></td>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A018", "Data Connection:")).appendTo(tablebtr);
|
|
var tabletrb = $("<td></td>").appendTo(tablebtr);
|
|
|
|
|
|
//DC选择
|
|
var selectFilterType = $("<select tabindex='6' id='search_status' style='width:100%; min-width:120px;margin-left:3px;' />").appendTo(tabletrb);
|
|
for (var i = 0; i < FilterTypes.length; i++) {
|
|
var option = $("<option></option>").text(FilterTypes[i].PluginName)
|
|
.attr("value", FilterTypes[i].IID);
|
|
selectFilterType.append(option);
|
|
}
|
|
|
|
var tabletrbs = $("<tr></tr>").appendTo(tableb);
|
|
td = $("<td style='white-space:nowrap;width:40px;display:flex;margin-top:20px;'></td>").text(GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A017", "SQL Statement:")).appendTo(tabletrbs);
|
|
var tabletrbstd = $("<td></td>").appendTo(tabletrbs);
|
|
var div1 = $("<div style='width:100%;'></div>").appendTo(tabletrbstd);
|
|
//文本SQL
|
|
var textare = $("<textarea tabindex='7' id='textareins' style='resize:none; min-width: 120px;min-height:120px; margin-top:20px;margin-left:3px;width:99%;' ></textarea>").appendTo(div1);
|
|
|
|
|
|
var buttonDiv = $("<div style='margin-top: 15px; min-width:230px;'></div>").appendTo(_content);
|
|
|
|
$("<input type='button' tabindex='10' id='dtCopy_btCancel' />")
|
|
.val(GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_DATATABLECOPYDIALOG_A003', 'Cancel'))
|
|
.css({ "float": "right","margin":"0 8px 0 0" })
|
|
.appendTo(buttonDiv)
|
|
.click(this, function(e) {
|
|
e.data.close();
|
|
});
|
|
|
|
var showMessagef = function (m,_this) {
|
|
_this.HideProgressBar();
|
|
var msg = new $msgdialog();
|
|
msg.title = DEFAULT_LANG.FICManagement;
|
|
msg.parentDom = _ParentDom;
|
|
msg.message = m;
|
|
msg.showMessage(500, 175, 700);
|
|
}
|
|
|
|
|
|
var vacheck = true;
|
|
$("<input type='button' tabindex='9' id='dtCopy_btSave' />")
|
|
.val(GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_DATATABLECOPYDIALOG_A006', 'Save'))
|
|
.css({ "float": "right","margin": "0 10px" })
|
|
.appendTo(buttonDiv)
|
|
.click(this, function (e) {
|
|
var _this = e.data;
|
|
_this.ShowProgressBar();
|
|
if (strIsNullorEmpty(txtFilterName.val())) {
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A023", "The Name field cannot be null.");
|
|
showMessagef(m,_this);
|
|
return;
|
|
}
|
|
//验证变量名
|
|
if (!globalFilterData)
|
|
{
|
|
var testz = /^[A-Za-z0-9_@]+$/;
|
|
var namea = txtFilterName.val();
|
|
var nameb = "";
|
|
if (testz.test(namea)) {
|
|
if (arrName && arrName.length > 0) {
|
|
for (var i = 0; i < arrName.length; i++) {
|
|
if (arrName[i].toLowerCase().indexOf(namea.toLowerCase()) >= 0 || namea.toLowerCase().indexOf(arrName[i].toLowerCase()) >= 0) {
|
|
nameb = arrName[i];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (nameb !== "") {
|
|
var m = "";
|
|
if (nameb === namea) {
|
|
m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A030", "{0} already exists.");
|
|
m = m.replace('{0}', namea);
|
|
} else {
|
|
m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A021", "The name cannot include other names or be included by other names. '{0}' and '{1}'");
|
|
m = m.replace('{0}', namea);
|
|
m = m.replace('{1}', nameb);
|
|
}
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
} else {
|
|
var m= GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A020", "The Name field can only include the characters [A-Z], digits [0-9], _ or the @ symbol.");
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if ($("#radioFixd").prop("checked")) {
|
|
if (strIsNullorEmpty(txtvariable.val())) {
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A031", "Please complete the form.");
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
}
|
|
if ($("#radioSql").prop("checked")) {
|
|
if (strIsNullorEmpty(textare.val()) || selectFilterType.val() === "00000000-0000-0000-0000-000000000000") {
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_VARIABLES_A031", "Please complete the form.");
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
//else {
|
|
// var sql = textare.val();
|
|
// var selectiid = selectFilterType.val();
|
|
|
|
|
|
//}
|
|
}
|
|
|
|
var checkSql = function (selectiid, sql, callback) {
|
|
if (selectiid !== _utility.GuidEmpty) {
|
|
_network.management("ValidateSqlOnly", [selectiid, sql], function(e) {
|
|
if (e.Result !== "") {
|
|
// _this.HideProgressBar();
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A033", "Validation failed:") + "<br>";
|
|
m = m + GetLanguageByKey("LHBIS_EXCEPTION_E0X65027083", "Failed to validate the database SQL statement.");
|
|
vacheck = false;
|
|
showMessagef(m, _this);
|
|
callback(false);
|
|
} else {
|
|
callback(true);
|
|
}
|
|
});
|
|
} else {
|
|
callback(true);
|
|
}
|
|
}
|
|
|
|
|
|
var globalVariable = {
|
|
$type: "FI.FIC.Contracts.DataObjects.BaseObject.GlobalVariable, FICIntfAdv",
|
|
ConnectionName: selectFilterType.find("option:selected").text(),
|
|
DcIID: selectFilterType.val(),
|
|
DefaultValue: txtvariable.val(),
|
|
Name: txtFilterName.val(),
|
|
OrderIndex:0,
|
|
SqlStatement: textare.val()
|
|
};
|
|
|
|
if ($("#radioFixd").prop("checked")) {
|
|
globalVariable.SqlStatement = "";
|
|
globalVariable.DcIID = _utility.GuidEmpty;
|
|
globalVariable.ConnectionName = "";
|
|
} else {
|
|
globalVariable.DefaultValue = "";
|
|
}
|
|
// var res = JSON.stringify(globalVariable);
|
|
var saveGlobalVariable= function(_this,globa) {
|
|
_network.management("AddGlobalVariable", [globa], function (e) {
|
|
if (e.ErrorCode !== 0) {
|
|
// _this.HideProgressBar();
|
|
var m = e.ErrorMessage;
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
_this.HideProgressBar();
|
|
if (typeof callBack === 'function')
|
|
callBack();
|
|
_this.close();
|
|
});
|
|
}
|
|
var edutGlobalVariable= function(_this, globa) {
|
|
_network.management("EditGlobalVariable", [globa], function (e) {
|
|
if (e.ErrorCode !== 0) {
|
|
// _this.HideProgressBar();
|
|
var m = e.ErrorMessage;
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
_this.HideProgressBar();
|
|
if (typeof callBack === 'function')
|
|
callBack();
|
|
_this.close();
|
|
});
|
|
}
|
|
|
|
if (globalFilterData) {
|
|
checkSql(globalVariable.DcIID, globalVariable.SqlStatement, function (res) {
|
|
if (res) {
|
|
edutGlobalVariable(_this, globalVariable);
|
|
} else {
|
|
return;
|
|
}
|
|
});
|
|
} else {
|
|
checkSql(globalVariable.DcIID, globalVariable.SqlStatement, function (res) {
|
|
if (res) {
|
|
saveGlobalVariable(_this, globalVariable);
|
|
} else {
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
|
|
var validate = $("<input tabindex='8' type='button' id='dtCopy_btValidate' />")
|
|
.val(GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_CONNECTIONTYPEMANAGEMENT_A018', 'Validate'))
|
|
.css({ "float": "right" })
|
|
.attr("disabled", "disabled")
|
|
.appendTo(buttonDiv)
|
|
.click(this, function(e) {
|
|
var _this = e.data;
|
|
var sql = textare.val();
|
|
var selectiid = selectFilterType.val();
|
|
if (selectiid === _utility.GuidEmpty) {
|
|
return;
|
|
} else if (strIsNullorEmpty(sql)) {
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A033", "Validation failed:") + "<br>";
|
|
m = m + GetLanguageByKey("LHBIS_EXCEPTION_E0X65027083", "Failed to validate the database SQL statement.");
|
|
showMessagef(m, _this);
|
|
return;
|
|
} else {
|
|
_this.ShowProgressBar();
|
|
_network.management("ValidateSqlOnly", [selectiid, sql], function(e) {
|
|
if (e.Result !== "") {
|
|
_this.HideProgressBar();
|
|
var m = GetLanguageByKey("LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A033", "Validation failed:") + "<br>";
|
|
m = m + GetLanguageByKey("LHBIS_EXCEPTION_E0X65027083", "Failed to validate the database SQL statement.");
|
|
|
|
showMessagef(m, _this);
|
|
return;
|
|
} else {
|
|
_this.HideProgressBar();
|
|
var m = GetLanguageByKey('LHBIS_FIC_CLIENT_MODULES_DATATABLEWIZARD_A032', 'Validation is successful.');
|
|
showMessagef(m, _this);
|
|
return;
|
|
}
|
|
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
if (globalFilterData) {
|
|
txtFilterName.val(globalFilterData.Values.Name);
|
|
txtFilterName.prop("disabled", "disabled");
|
|
selectFilterType.val(globalFilterData.Values.DcIID);
|
|
if (globalFilterData.Values.SqlStatement !== "") {
|
|
radioAdd.prop("checked", "checked");
|
|
validate.removeAttr("disabled");
|
|
txtvariable.prop("disabled", "disabled");
|
|
textare.val(globalFilterData.Values.SqlStatement);
|
|
} else {
|
|
txtvariable.val(globalFilterData.Values.DefaultValue);
|
|
radioEdit.prop("checked", "checked")
|
|
|
|
textare.prop("disabled", "disabled");
|
|
txtvariable.removeAttr("disabled", "disabled");
|
|
selectFilterType.prop("disabled", "disabled");
|
|
}
|
|
} else {
|
|
txtFilterName.val("@@");
|
|
radioEdit.prop("checked", "checked");
|
|
textare.prop("disabled", "disabled");
|
|
selectFilterType.prop("disabled", "disabled");
|
|
}
|
|
|
|
|
|
radioAdd.click(this, function (e) {
|
|
selectFilterType.removeAttr("disabled");
|
|
textare.removeAttr("disabled");
|
|
validate.removeAttr("disabled");
|
|
txtvariable.prop("disabled", "disabled");
|
|
});
|
|
radioEdit.click(this, function (e) {
|
|
selectFilterType.prop("disabled", "disabled");
|
|
validate.prop("disabled", "disabled");
|
|
textare.prop("disabled", "disabled");
|
|
txtvariable.removeAttr("disabled");
|
|
});
|
|
|
|
this.bodyCtrlAppend(_content);
|
|
//显示
|
|
this.show();
|
|
};
|
|
|
|
//窗体大小发生改变时的回调函数
|
|
$GlobalFilterEdit.prototype.onSizeChange = function (left, top, width, height) {
|
|
var res = parseFloat(height) - 400;
|
|
if (res >= 0) {
|
|
var textareheight = 120;
|
|
$("#textareins").css("height", textareheight + res);
|
|
} else {
|
|
$("#textareins").css('height', '120px');
|
|
|
|
}
|
|
};
|
|
|
|
|
|
}());
|
|
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" Runat="Server">
|
|
|
|
<form id="form1" runat="server">
|
|
<div class="topTools">
|
|
<span class="helpiconspan">
|
|
<span class="helpicon" PageName="GlobalVariable"></span>
|
|
</span>
|
|
<asp:Button ID="btnResetlayout" Text="Reset Layout" runat="server" OnClientClick="ClearGridLayOut(); return false;" />
|
|
<asp:Button ID="btnRefresh" Text="Refresh" OnClientClick="RefreshVariable(); return false;" runat="server" />
|
|
<asp:Button ID="btnDel" Text="Delete" runat="server" disabled="disabled" OnClientClick="return CheckDel();" />
|
|
<asp:Button ID="btnEdit" Text="Edit" runat="server" disabled="disabled" OnClientClick="showEdit(); return false;" />
|
|
<asp:Button ID="btnAdd" Text="Add" runat="server" OnClientClick="showAdd(); return false;" />
|
|
<div style="clear: both"></div>
|
|
</div>
|
|
<div id="GlobalVariable_list" class="margin-top-s">
|
|
</div>
|
|
</form>
|
|
</asp:Content>
|
|
|