private bool InsertOrUpdateTableStyleInfo() { var isChanged = false; _styleInfo.Additional.IsValidate = TranslateUtils.ToBool(IsValidate.SelectedValue); _styleInfo.Additional.IsRequired = TranslateUtils.ToBool(IsRequired.SelectedValue); _styleInfo.Additional.MinNum = TranslateUtils.ToInt(MinNum.Text); _styleInfo.Additional.MaxNum = TranslateUtils.ToInt(MaxNum.Text); _styleInfo.Additional.ValidateType = EInputValidateTypeUtils.GetEnumType(ValidateType.SelectedValue); _styleInfo.Additional.RegExp = RegExp.Text.Trim('/'); _styleInfo.Additional.ErrorMessage = ErrorMessage.Text; try { if (_tableStyleId == 0)//数据库中没有此项的表样式,但是有父项的表样式 { var relatedIdentity = (int)_relatedIdentities[0]; _styleInfo.RelatedIdentity = relatedIdentity; _styleInfo.TableStyleId = TableStyleManager.Insert(_styleInfo, _tableStyle); } if (_styleInfo.TableStyleId > 0) { TableStyleManager.Update(_styleInfo); Body.AddSiteLog(PublishmentSystemId, "修改表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}"); } else { TableStyleManager.Insert(_styleInfo, _tableStyle); Body.AddSiteLog(PublishmentSystemId, "新增表单验证", $"类型:{ETableStyleUtils.GetText(_tableStyle)},字段:{_styleInfo.AttributeName}"); } isChanged = true; } catch (Exception ex) { FailMessage(ex, "设置表单验证失败:" + ex.Message); } return(isChanged); }
public void Validate_SelectedIndexChanged(object sender, EventArgs e) { if (EBooleanUtils.Equals(EBoolean.False, IsValidate.SelectedValue)) { phValidate.Visible = false; } else { phValidate.Visible = true; } var type = EInputValidateTypeUtils.GetEnumType(ValidateType.SelectedValue); if (type == EInputValidateType.Custom) { phRegExp.Visible = true; } else { phRegExp.Visible = false; } }