diff --git a/插件库/Lskj.Control/Model/ControlModel.cs b/插件库/Lskj.Control/Model/ControlModel.cs
index 16c0286..c01534f 100644
--- a/插件库/Lskj.Control/Model/ControlModel.cs
+++ b/插件库/Lskj.Control/Model/ControlModel.cs
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
+using System.Data;
namespace Lskj.Control.Model
{
@@ -35,6 +36,10 @@ namespace Lskj.Control.Model
/// true if this instance is search control; otherwise, false.
public bool IsSearchControl { get; set; }
///
+ /// 是否必填(记录不可修改,修改会导致判断异常)
+ ///
+ public bool MustIn { get; set; }
+ ///
/// Gets or sets a value indicating whether this instance is empty.
///
/// true if this instance is empty; otherwise, false.
diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs
index c329c46..9a5834b 100644
--- a/插件库/Lskj.Control/Model/MyControl.cs
+++ b/插件库/Lskj.Control/Model/MyControl.cs
@@ -497,8 +497,9 @@ namespace Lskj.Control.Model
baseControl.ModifyDefaultColors(ColorTranslator.FromHtml(model.ControlTitleColor));
}
- baseControl.ReadOnly = model.ReadOnly;
baseControl.Required = model.IsEmpty;
+ model.IsEmpty = !model.ReadOnly;
+ baseControl.ReadOnly = model.ReadOnly;
baseControl.Tag = model;
baseControl.TabIndex = model.TabOrder;
@@ -3912,6 +3913,7 @@ namespace Lskj.Control.Model
model.id = item["id"] + "";
model.CanClear = (item["edited"] + "" != "1");
model.CanCopy = item.Table.Columns.Contains("canCopy") ? "1".Equals(item["canCopy"] + "") : true;
+ model.MustIn = !string.IsNullOrEmpty(item["nullable"] + "") ? Convert.ToBoolean(item["nullable"]) : false;
model.IsEmpty = !string.IsNullOrEmpty(item["nullable"] + "") ? Convert.ToBoolean(item["nullable"]) : false;
model.ReadOnly = ("1".Equals(item["edited"] + ""));
model.IsSave = true;
@@ -5125,6 +5127,21 @@ namespace Lskj.Control.Model
if (controls == null || controls.Length == 0) return;
string fieldValue = GetControlValue(model);
+ foreach (ControlModel item in requiredcontrols)
+ {
+ try
+ {
+ string requiredCond = this.ReplaceControlValue(item.RequiredCond.Replace("{" + model.FieldName + "}", fieldValue));
+ BaseUserControl control = FindControl(item);
+ control.Required = item.IsEmpty = item.MustIn ? ("true".Equals(ValidateCond(requiredCond, null) + "", StringComparison.OrdinalIgnoreCase)) : item.MustIn;
+ }
+ catch (Exception ex)
+ {
+ //MessageUtil.Show(ex);
+ string Message = ErrorMessage.PromptErrorMessage(ex);
+ MessageUtil.Show(Message, ex.Message);
+ }
+ }
foreach (ControlModel item in controls)
{
try
@@ -5153,21 +5170,6 @@ namespace Lskj.Control.Model
MessageUtil.Show(Message, ex.Message);
}
}
- foreach (ControlModel item in requiredcontrols)
- {
- try
- {
- string requiredCond = this.ReplaceControlValue(item.RequiredCond.Replace("{" + model.FieldName + "}", fieldValue));
- BaseUserControl control = FindControl(item);
- control.Required = model.IsEmpty ? ("true".Equals(ValidateCond(requiredCond, null) + "", StringComparison.OrdinalIgnoreCase)) : model.IsEmpty;
- }
- catch (Exception ex)
- {
- //MessageUtil.Show(ex);
- string Message = ErrorMessage.PromptErrorMessage(ex);
- MessageUtil.Show(Message, ex.Message);
- }
- }
}
///
/// 说明:检查可用条件
@@ -6017,30 +6019,4 @@ namespace Lskj.Control.Model
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
}
- else if (controlObj is LabelCheckEdit)
- {
- LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
- value = checkEdit.EditText;
- }
- else if (controlObj is LabelComboxEdit)
- {
- LabelComboxEdit autoEdit = controlObj as LabelComboxEdit;
- value = autoEdit.EditValue;
- }
- else if (controlObj is LabelTextEdit)
- {
- LabelTextEdit textIntEdit = controlObj as LabelTextEdit;
- if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText;
- }
-
- defaultValue = defaultValue.Replace(item, value);
- }
-
- }
- }
- return defaultValue;
- }
-
-
- }
-}
\ No newline at end of file
+ else if
\ No newline at end of file