<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<com.nowdocs.nowsource.Admin.ViewModels.SiteConfiguration.EntityTypeAttributeViewModel>" %>
<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>"
type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.tablednd_0_5.js") %>" type="text/javascript"></script>
<script type="text/javascript">
function resetValidation() {
$(".field-validation-error").empty();
}
$(function () {
$(document).ready(function () {
var opt = $("#strControlTypeCode").val();
SetShoworHide(opt);
setCssRules();
$("#myTable").tableDnD();
$(".up,.down").live('click', function () {
var row = $(this).parents("tr:first");
if ($(this).is(".up")) {
row.insertBefore(row.prev());
} else {
row.insertAfter(row.next());
}
});
$(".add").click(function () {
$('#myTable tr:last').after('<tr><td><a href="#" class="up">Up</a><a href="#" class="down">Down</a></td><td>New</td></tr>');
setCssRules();
$("#myTable").tableDnD();
});
});
function setCssRules() {
// this would be better implemented in a CSS file
jQuery('#myTable tr:not(\'#rowHeader\')')
.css('cursor', 'pointer')
.mouseover(function () {
jQuery(this).css('background-color', '#c0c0c0');
})
.mouseout(function () {
jQuery(this).css('background-color', '#ffffff');
});
}
function SetShoworHide(opt) {
if (opt != "") {
if (opt == "text") {
$("#comm").slideDown();
$("#typeAttributeDiv").slideUp();
$("#trHeight").slideUp();
}
if (opt == "textarea") {
$("#comm").slideDown();
$("#typeAttributeDiv").slideUp();
$("#trHeight").slideDown();
}
if (opt == "checkbox" || opt == "multiselect" || opt == "radio" || opt == "select") {
$("#comm").slideUp();
$("#typeAttributeDiv").slideDown();
}
}
}
$('#strControlTypeCode').change(function () {
var opt = $(this).val();
SetShoworHide(opt);
});
$('#myTable td').live('click', function () {
var tr = $(this).parent();
for (var i = 0; i < tr.children().length; i++) {
if (tr.children().get(i) == this) {
var column = i;
break;
}
}
var tbody = tr.parent();
for (var j = 0; j < tbody.children().length; j++) {
if (tbody.children().get(j) == tr.get(0)) {
var row = j;
break;
}
}
for (var i = 0; i < tr.children().length; i++) {
for (var j = 0; j < tbody.children().length; j++) {
var tempcell = $('#myTable tr:eq(' + j + ') td:eq(' + i + ')');
$(tempcell).css('background-color', '#ffffff');
}
}
var cell = $('#myTable tr:eq(' + row + ') td:eq(' + column + ')');
if (cell.length == 0) {
//alert('Undefined');
}
else if (column == 1 || column == 2) {
//alert(row+' '+column+' '+cell.text());
column = 1;
$('#row').val(row);
$('#column').val(column);
$('#SelectValue').val(cell.text());
$(cell).css('background-color', '#c0c0c0');
}
});
var flag_UpdateOrAdd = "0";
$('#ViewEdit').change(function () {
var opt = $(this).val();
var selectValue = $('#SelectValue').val().toString().trim();
if (opt != "0") {
//add
if (opt == "1") {
flag_UpdateOrAdd = "1";
openAddDialog(flag_UpdateOrAdd);
//$("#dialog-add-form").dialog("open");
}
//edit
if (opt == "2") {
if (selectValue != '') {
flag_UpdateOrAdd = "2";
$('#name').val(selectValue);
openAddDialog(flag_UpdateOrAdd);
//$("#dialog-add-form").dialog("open");
}
}
//delete
if (opt == "3") {
if (selectValue != '') {
$("#dialog-delete-confirm").dialog("open");
//var row = $('#row').val().toString().trim();
//$("#myTable").find("tr:eq(" + row + ")").remove();
// var column = $('#column').val().toString().trim();
// var cell = $('#myTable tr:eq(' + row + ') td:eq(' + column + ')');
// cell.remove();
// var column1 = parseInt($('#column').val()) + 1;
// cell1 = $('#myTable tr:eq(' + row + ') td:eq(' + column1 + ')');
// cell1.remove();
}
}
//set default
if (opt == "4") {
if (selectValue != '') {
//alert(selectValue);
$("#myTable tr").each(function () {
$(this).find("td:eq(2)").css('display', 'none');
if ($(this).find("td:eq(1)").text().trim() == selectValue) {
$(this).find("td:eq(2)").css('display', 'block');
}
});
}
}
}
$(this).val("0");
});
var name = $("#name"),
allFields = $([]).add(name),
tips = $(".validateTips");
function updateTips(t) {
tips
.text(t)
.addClass("ui-state-highlight");
setTimeout(function () {
tips.removeClass("ui-state-highlight", 1500);
}, 500);
}
function checkLength(o, n, min, max) {
if (o.val().length > max || o.val().length < min) {
o.addClass("ui-state-error");
updateTips("Length of " + n + " must be between " +
min + " and " + max + ".");
return false;
} else {
return true;
}
}
function checkRegexp(o, regexp, n) {
if (!(regexp.test(o.val()))) {
o.addClass("ui-state-error");
updateTips(n);
return false;
} else {
return true;
}
}
var title_var = '';
function openAddDialog(flag_UpdateOrAdd) {
if (flag_UpdateOrAdd == '1') {
title_var = "<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.AddAnAttributeValueTitle %>";
}
else if (flag_UpdateOrAdd == '2') {
title_var = "<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.EditAnAttributeValueTitle %>";
}
$("#dialog-add-form").dialog("open");
$("#dialog-add-form").dialog("option", "title", title_var);
}
$("#dialog:ui-dialog").dialog("destroy");
$("#dialog-add-form").dialog({
title: title_var,
autoOpen: false,
height: 150,
width: 350,
modal: true,
buttons: {
"<%: com.nowdocs.nowsource.Admin.Resources.Common.Save %>": function () {
var bValid = true;
allFields.removeClass("ui-state-error");
bValid = bValid && checkLength(name, "username", 1, 100);
if (bValid) {
if (flag_UpdateOrAdd == "1") {
$("#myTable tbody").append("<tr><td style='display: none'>" +
'<a href="#" class="up">Up</a><a href="#" class="down">Down</a></td>' +
"<td>" + name.val() + "</td>" +
"<td style='display: none'><span>*</span></td>" +
"</tr>");
} else if (flag_UpdateOrAdd == "2") {
var row = $('#row').val().toString().trim();
var column = $('#column').val().toString().trim();
var cell = $('#myTable tr:eq(' + row + ') td:eq(' + column + ')');
cell.text(name.val());
$('#row').val(row);
$('#column').val(column);
$('#SelectValue').val(cell.text());
}
setCssRules();
$("#myTable").tableDnD();
$(this).dialog("close");
flag_UpdateOrAdd = "0";
}
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
allFields.val("").removeClass("ui-state-error");
}
});
$("#dialog-delete-confirm").dialog({
autoOpen: false,
resizable: false,
height: 140,
modal: true,
buttons: {
"<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.Okbtn %>": function () {
var row = $('#row').val().toString().trim();
$("#myTable").find("tr:eq(" + row + ")").remove();
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
</script>
<div id="dialog-delete-confirm" title="<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.DeleteEntityAttributeTitle %>">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.DeleteEntityAttributeContent%></p>
</div>
<div id="dialog-add-form" title="<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.EditAnAttributeValueTitle%>">
<p class="validateTips">
</p>
<table cellpadding="4" cellspacing="4" width="100%" class="admin-form">
<tr>
<th style="width: 350px">
<label for="name">
<span class="error">*</span><%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.ValuePopUp%>:</label>
</th>
<td class="TdWidth">
<input type="text" name="name" id="name" style="width: 180px" maxlength="98" />
</td>
</tr>
</table>
</div>
<div id="group-edit" class="admin-panel main-panel" style="width: 540px;">
<div class="title" style="text-align: left">
<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.EditCustomeAttributeTitle %>
</div>
<div class="title">
<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.TypeAttributeDetailTitle %>
</div>
<%using (Html.BeginForm())
{ %>
<div>
<div class="wrap">
<% Html.EnableClientValidation(true); %>
<table cellpadding="4" cellspacing="4" width="100%" class="admin-form">
<tr>
<td colspan="2" align="center">
<div class="error">
<%: Html.ValidationMessage("sameTypeAttributeName")%>
</div>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.intEntityTypeID)%>:
</th>
<td class="TdWidth">
<%: Html.DropDownList("intEntityTypeID")%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strEntityTypeAttributeName)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.strEntityTypeAttributeName, new { maxlength = 250, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.strEntityTypeAttributeName)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strEntityTypeAttributeDisplayLabel)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.strEntityTypeAttributeDisplayLabel, new { maxlength = 250, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.strEntityTypeAttributeDisplayLabel)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strEntityTypeAttributeReportLabel)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.strEntityTypeAttributeReportLabel, new { maxlength = 250, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.strEntityTypeAttributeReportLabel)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strControlTypeCode)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.DropDownList("strControlTypeCode")%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.blnEntityTypeAttributeRequired)%>:
</th>
<td class="TdWidth">
<%: Html.CheckBoxFor(model => model.blnEntityTypeAttributeRequired, new { @class = "CheckBox" })%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.blnEntityTypeAttributeSearchCriteria)%>:
</th>
<td class="TdWidth">
<%: Html.CheckBoxFor(model => model.blnEntityTypeAttributeSearchCriteria, new { @class = "CheckBox" })%>
</td>
</tr>
<tr style="display: none;">
<th>
</th>
<td>
<%: Html.EditorFor(model => model.blnEntityTypeAttributeActive)%>
</td>
</tr>
</table>
<div id="comm">
<table cellpadding="4" cellspacing="4" width="100%" class="admin-form">
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.intValidationTypeID)%>:
</th>
<td class="TdWidth">
<%: Html.DropDownList("intValidationTypeID")%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.shoEntityTypeAttributeMinimumLength)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.shoEntityTypeAttributeMinimumLength, new { maxlength = 2, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.shoEntityTypeAttributeMinimumLength)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.shoEntityTypeAttributeMaximumLength)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.shoEntityTypeAttributeMaximumLength, new { maxlength = 2, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.shoEntityTypeAttributeMaximumLength)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strEntityTypeAttributeMinimumValue)%>:
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.strEntityTypeAttributeMinimumValue, new { maxlength = 19, @class = "TextBoxWidth" })%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.strEntityTypeAttributeMaximumValue)%>:
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.strEntityTypeAttributeMaximumValue, new { maxlength = 19, @class = "TextBoxWidth" })%>
</td>
</tr>
<tr id="trHeight">
<th style="width: 350px">
<%: Html.LabelFor(model => model.bytEntityTypeAttributeHeight)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.bytEntityTypeAttributeHeight, new { maxlength = 1, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.bytEntityTypeAttributeHeight)%></span>
</p>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.bytEntityTypeAttributeWidth)%>:<span class="error">*</span>
</th>
<td class="TdWidth">
<%: Html.TextBoxFor(model => model.bytEntityTypeAttributeWidth, new { maxlength = 1, @class = "TextBoxWidth" })%>
<p>
<span class="error">
<%: Html.ValidationMessageFor(model => model.bytEntityTypeAttributeWidth)%></span>
</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="typeAttributeDiv">
<div class="title">
<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.AttributeValuesTitle %>
</div>
<div id="typeAttribute" style="height: 205px; background-color: #CFE1E5">
<table cellpadding="4" cellspacing="4" width="100%" class="admin-form">
<tr>
<th style="width: 350px">
<%: Html.LabelFor(model => model.entityTypeAttributeValueList)%>:
</th>
<td class="TdWidth">
<div class="wrap" id="ChildGroupList" style="display: block;">
<table id="myTable" style="width: 100%; height: 100%">
<tr>
<td style="display: none">
<a href="#" class="up">Up</a> <a href="#" class="down">Down</a>
</td>
<td>
One444444444iiiiiiiiiiifdsfsdfsfsfsdfsdfsd
</td>
<td style="display: none">
<span style="font-weight: bold;">*</span>
</td>
</tr>
<tr>
<td style="display: none">
<a href="#" class="up">Up</a> <a href="#" class="down">Down</a>
</td>
<td>
Two
</td>
<td style="display: none">
<span style="font-weight: bold;">*</span>
</td>
</tr>
<tr>
<td style="display: none">
<a href="#" class="up">Up</a> <a href="#" class="down">Down</a>
</td>
<td>
Three
</td>
<td style="display: none">
<span style="font-weight: bold;">*</span>
</td>
</tr>
<tr>
<td style="display: none">
<a href="#" class="up">Up</a> <a href="#" class="down">Down</a>
</td>
<td>
Four
</td>
<td style="display: none">
<span style="font-weight: bold;">*</span>
</td>
</tr>
<tr>
<td style="display: none">
<a href="#" class="up">Up</a> <a href="#" class="down">Down</a>
</td>
<td>
Five
</td>
<td style="display: none">
<span style="font-weight: bold;">*</span>
</td>
</tr>
</table>
<br>
<a href="#" class="add" style="display: none">Add new</a>
</div>
<%--<div class="wrap" id="ChildGroupList" style="display: block;">
<ul>
<% if (Model.entityTypeAttributeValueList != null)
{
foreach (var link in Model.entityTypeAttributeValueList)
{
%>
<li><a>
<%: link.strEntityTypeAttributeValue%>
</a>
<%: Html.Hidden("EntityTypeAttributeValueID", link.intEntityTypeAttributeValueID)%>
</li>
<%
}
}%>
</ul>
</div>--%>
</td>
</tr>
<tr>
<th style="width: 350px">
<%: com.nowdocs.nowsource.Admin.Resources.EntityTypeAttribute.EditValues %>:
</th>
<td class="TdWidth">
<%: Html.DropDownList("ViewEdit")%>
</td>
</tr>
</table>
</div>
</div>
<div class="buttons" style="height: 30px; background: #859DA1;">
<input type="submit" value="<%: com.nowdocs.nowsource.Admin.Resources.Common.Save %>" />
<input type="reset" value="<%: com.nowdocs.nowsource.Admin.Resources.Common.Cancel %>"
onclick="resetValidation();" />
</div>
<%: Html.Hidden("row")%>
<%: Html.Hidden("column")%>
<%: Html.Hidden("SelectValue")%>
</div>
<%} %>
</div>
分享到:
相关推荐
- `UPDATE`:修改已有记录,如`UPDATE table1 SET field1 = value1 WHERE condition`。 - `DELETE FROM`:删除满足特定条件的记录,例如`DELETE FROM table1 WHERE condition`。 3. **数据控制语言(DCL)**: -...
在IT领域,数据库管理和操作是核心技能之一,而“table add delete”则直指数据库中的基本操作:创建表(Create Table)、插入数据(Add Data)和删除数据(Delete Data)。这三个概念构成了数据库操作的基础,无论...
`ALTER TABLE table_name ADD column_name datatype`添加新列,`ALTER TABLE table_name DROP COLUMN column_name`删除列。`AS (alias for column)`和`AS (alias for table)`用于创建列和表的别名,方便读取和理解...
当尝试删除一个表而该表包含其他表所依赖的字段时,MySQL会抛出错误1217(23000),提示“Cannot delete or update a parent row: a foreign key constraint fails”。为了解决这个问题,我们可以利用MySQL中的一个...
根据提供的文件信息,本文将详细解释SQL操作中的增(Add)、删(Delete)、改(Update)、查(Select)等核心概念及其应用场景。 ### SQL表操作概述 SQL(Structured Query Language)是一种专门用于管理关系...
增加一个列: Alter table 表名 add column 字段 数据类型; 选择查询: select 字段(以”,”隔开) from 表名 where 条件; 日期和时间: Select datetime('now') 日期: select date('now'); 时间: select time('now'...
标题与描述概述的知识点主要集中在IT领域中的数据库管理方面,特别是Oracle SQL语句的应用,涵盖了数据操作语言(DML)、数据定义语言(DDL)以及数据控制语言(DCL)。以下是对这些知识点的详细阐述: ### 数据...
- **语法**: `SELECT * FROM table1 WHERE table1.column_name IN (SELECT aggregate_function(column_name) FROM table2);` - 示例: `SELECT * FROM a WHERE a.a IN (SELECT MAX(d) FROM b);` 3. **子查询与外部...
某知名公司内部ORACLE培训资料,绝对不可多得。 如果你下载后觉得不行,可以损我。 一、基础 1、说明:创建数据库 CREATE DATABASE database-name 2、说明:删除数据库 drop database dbname 3、说明:备份sql ...
- **语法**: `SELECT column1, column2 FROM table1 INTERSECT ALL SELECT column1, column2 FROM table2;` - **说明**: 返回同时存在于table1和table2中的所有记录,包括重复项。 - **示例**: `SELECT column1, ...
基本的SQL查询包括选择(SELECT)、插入(INSERT INTO)、删除(DELETE)、更新(UPDATE)和查找(LIKE)。例如: ```sql SELECT * FROM table1 WHERE 范围; INSERT INTO table1 (field1, field2) VALUES (value1, ...
- 语法:`SELECT column1, column2 FROM table1 INTERSECT ALL SELECT column1, column2 FROM table2;` - 示例:返回`new_table`与`another_table`中都存在的记录,包括重复记录。 ```sql SELECT id, name FROM ...
更新:UPDATE table1 SET field1=value1 WHERE 范围 查找:SELECT * FROM table1 WHERE field1 LIKE ’%value1%’ 排序:SELECT * FROM table1 ORDER BY field1,field2 [DESC] 总数:SELECT COUNT(*) AS ...
更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:...
CREATE TABLE tab_new AS SELECT col1, col2... FROM tab_old DEFINITION ONLY; ``` - **DROP TABLE**:删除表。例如: ```sql DROP TABLE tabname; ``` - **ALTER TABLE**:修改表结构。例如,添加列: ```...
EXCEPT 运算符:通过包括所有在 TABLE1 中但不在 TABLE2 中的行并消除所有重复行而派生出一个结果表。 INTERSECT 运算符:通过只包括 TABLE1 和 TABLE2 中都有的行并消除所有重复行而派生出一个结果表。 注意:使用...
delete from table1 where not exists ( select * from table2 where table1.field1=table2.field1 ) 11、说明:四表联查问题: select * from a left inner join b on a.a=b.b right inner join c on a.a=c.c inner...
本文将详细讲解与标题“mysql基本操作”相关的知识点,特别是涉及的`SELECT`、`UPDATE`、`DELETE`以及数据库表结构的修改。 1. **SELECT查询**: `SELECT`语句用于从一个或多个表中检索数据。基本语法是`SELECT ...
* EXCEPT 运算符:通过包括所有在 TABLE1 中但不在 TABLE2 中的行并消除所有重复行而派生出一个结果表。 * INTERSECT 运算符:通过只包括 TABLE1 和 TABLE2 中都有的行并消除所有重复行而派生出一个结果表。 一些...