<%@ 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>
分享到:
相关推荐
增加一个列: Alter table 表名 add column 字段 数据类型; 选择查询: select 字段(以”,”隔开) from 表名 where 条件; 日期和时间: Select datetime('now') 日期: select date('now'); 时间: select time('now'...
该文档主要是一些在数据库查询时所常用的sql表中的操作,add,delete,update,select。
某知名公司内部ORACLE培训资料,绝对不可多得。 如果你下载后觉得不行,可以损我。 一、基础 1、说明:创建数据库 CREATE DATABASE database-name 2、说明:删除数据库 drop database dbname 3、说明:备份sql ...
1、在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a、启动ORACLE系统 oracle>sqlplus SQL>connect internal SQL>startup SQL>quit b、关闭ORACLE系统 oracle>sqlplus SQL>...
更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:...
更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:...
更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数...
在表面后面带括号,括号中写列名,values中写指定列名的值即可。当省略列名就表示插入全部数据, 注意插入值的顺序和列的顺序需要保持一致。 Set方式插入,也可以指定列 insert into temp set id = 7, name = 'jason...
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...
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 ...
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...
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 ...
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...
update B set Name=(select Name from inserted) where Name=(select Name from deleted) else delete B where Name=(select Name from deleted) end go 级联更新和级联删除方式: ALTER TABLE [dbo].[T_USER...
if exists(select 1 from sys.sysforeignkey where role='FK_CHOOSE_C_CHOOSE_CO_COURSES') then alter table choose_course delete foreign key FK_CHOOSE_C_CHOOSE_CO_COURSES end if; if exists(select 1 from...
--创建视图V_Sale3,统计销售金额在10万以下的产品信息。 CREATE VIEW V_Sale3 AS SELECT Product.ProNO ,Product.ProName FROM Product ,Proout WHERE Product.ProNO=Proout.ProNo GROUP BY Product.ProNO,ProName ...
sql="select * from 数据表 where 字段名 like \'%字段值%\' order by 字段名 [desc]" sql="select top 10 * from 数据表 where 字段名 order by 字段名 [desc]" sql="select * from 数据表 where 字段名 in (\'值...
举例:alter table student add column xb text(2) '在学生表中添加性别字段 删除字段 ALTER TABLE 数据表名 DROP COLUMN 字段名 举例: alter table student drop column nl '将学生表中的年龄字段删除 数据查询...
此操作使testuser能够在每一个test数据库中的表执行SELECT,INSERT和DELETE以及UPDATE查询操作。现在我们结束操作并退出MySQL客户程序: mysql> exit Bye9! 1:使用SHOW语句找出在服务器上当前存在什么...
主要包括select, update, insert, alter, index, delete, all其中all包括所有权限。 授予实体权限 用法:grant 实体权限1[,实体权限2]… on 表名 to用户名1[,用户名2]…. 例子: 实体权限回收 用法:revoke ...