public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; string reg = colConfig.ControlLegal.Reg; var match = Regex.Match(value, reg, RegexOptions.ECMAScript); if (!match.Success) { isLegal = false; error = "格式不正确!"; } //if (!reg.IsMatch(value)) //{ // isLegal = false; // error = "电子邮箱格式不正确!"; //} return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool IsLegal = true; string error = ""; if (value == "" || value == null) { IsLegal = false; error = "{0}的值不能为空".AkFormat(displayName); } return(new LegalObject { IsLegal = IsLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("(^\\d{15}$)|(^\\d{17}([0-9]|X)$)"); if (!reg.IsMatch(value)) { isLegal = false; error = "身份证号码格式不正确"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("(^1[3578]\\d{9}$)|(^((0\\d{2,3})-)(\\d{7,8})(-(\\d{3,}))?$)"); if (!reg.IsMatch(value)) { isLegal = false; error = "必须是座机号或手机号,座机号格式为(0(2或者3位)-(7或者8位)"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^\\d+(\\.\\d{1,2})?$"); if (!reg.IsMatch(value)) { isLegal = false; error = "{0}必须是整数或小数点后1-2位的小数".AkFormat(displayName); } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^1[34578]\\d{9}$"); if (!reg.IsMatch(value)) { isLegal = false; error = "手机格式不对,必须以13、14、15、17、18开头并且为11位"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^([1-9]\\d{0,}|0)$"); if (!reg.IsMatch(value)) { isLegal = false; error = "必须为非负整数"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^((0\\d{2,3})-)(\\d{7,8})(-(\\d{3,}))?$"); if (!reg.IsMatch(value)) { isLegal = false; error = "座机号码格式不对,必须为(0(2或者3位)-(7或者8位),如0571-8888888"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$"); if (!reg.IsMatch(value)) { isLegal = false; error = "只能输入5-20个以字母开头、可带数字、“_”、“.”的字符串!"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+\\.(?:com|cn)$"); if (!reg.IsMatch(value)) { isLegal = false; error = "邮箱格式不对,格式如[email protected]"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^[0-9a-zA-Z]w{5,17}$"); if (!reg.IsMatch(value)) { isLegal = false; error = "用户名长度在6-18位之间,只能包含字符、数字、下划线"; } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^.{1,200}$"); if (value != null && value != "") { if (!reg.IsMatch(value)) { isLegal = false; error = "备注介绍不得大于200字"; } } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex(@"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$"); if (value != null && value != "") { if (!reg.IsMatch(value)) { isLegal = false; error = "身份证号码格式不正确"; } } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
public LegalObject CheckLegal(ColumnConfig colConfig, ObjectData data) { string name = colConfig.Name; string displayName = colConfig.DisplayName; string value = data.Row[name].ToString(); bool isLegal = true; string error = ""; Regex reg = new Regex("^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$"); if (value != null && value != "") { if (!reg.IsMatch(value)) { isLegal = false; error = "必须为非负数且大于0"; } } return(new LegalObject { IsLegal = isLegal, ErrorMessage = error }); }
protected virtual AtawColumnConfigView CreateColumn(AtawFormConfigView formView, ColumnConfig column) { AtawColumnConfigView colView = new AtawColumnConfigView(); colView.ControlType = column.ControlType; colView.DisplayName = column.DisplayName; colView.Prompt = column.Prompt; colView.ValPrompt = column.ValPrompt; //if ((PageStyle == PageStyle.Update || PageStyle == PageStyle.Insert) && colView.ValPrompt != null && column.ShowType > 0) //{ // column.ShowType = column.ShowType >= 3?0:2; //} if (column.Changer != null) { colView.Changer = new ChangerViewConfig(); colView.Changer.Expression = column.Changer.Expression; colView.Changer.DependColumns = column.Changer.DependColumns; colView.Changer.NotifyColumns = column.Changer.NotifyColumns; } if (column.ShowType == 0 || column.ControlType == ControlType.AllImageShow || column.ControlType == ControlType.Editor || column.ControlType == ControlType.EditorDetail || column.ControlType == ControlType.ImageDetail || column.ControlType == ControlType.PCAS || column.ControlType == ControlType.MultiSelector || column.ControlType == ControlType.MultiImageUpload || column.ControlType == ControlType.SingleImageUpload || column.ControlType == ControlType.SingleFileUpload || column.ControlType == ControlType.MultiFileUpload || column.ControlType == ControlType.FormMultiSelector || column.ControlType == ControlType.TextArea) { colView.ShowType = "ColShowType".AppKv <int>(4); } else { colView.ShowType = column.ShowType; } if (column.ControlType == ControlType.Hidden) { colView.ShowType = 0; } colView.Sortable = column.Sortable; colView.IsDetailLink = column.IsDetailLink; colView.Name = column.Name; colView.Kind = column.Kind; colView.NormalStyle = column.NormalStyle; colView.TdStyle = column.TdStyle; colView.IsHiddenCol = column.IsHiddenCol; colView.Width = column.Width; colView.LinkFormat = column.LinkFormat; colView.ChangeEventFun = column.ChangeEventFun; colView.Report = column.Report; colView.TreeConfig = column.TreeConfig; colView.ShortCutName = column.ShortCutName; colView.Amount = column.Amount; if (column.ControlType == ControlType.Custom) { AtawDebug.AssertArgumentNull(column.CustomControl, "Custom控件类型需要配置CustomControl", column); AtawDebug.AssertArgumentNullOrEmpty(column.CustomControl.ControlType, "CustomControl中必须指定自定义控件类型", column); } colView.CustomControl = column.CustomControl; if (column.ControlType == ControlType.Editor) { colView.Editor = column.Editor; } if (!column.SourceName.IsEmpty()) { colView.QingColumnName = column.Name; } string controlRegname = column.ControlType.ToString(); // to.Options var optionCreator = controlRegname.CodePlugIn <AtawOptionCreator>(); //初始化 optionCreator.Initialize(BasePageView, formView, column, PageStyle); //方法调用 colView.Options = optionCreator.Create(); return(colView); }
public static void AssignColumn(OverrideColumnConfig oCol, ColumnConfig baseCol) { if (!oCol.DisplayName.IsEmpty()) { baseCol.DisplayName = oCol.DisplayName; } if (!oCol.Prompt.IsEmpty()) { baseCol.Prompt = oCol.Prompt; } if (!oCol.ValPrompt.IsEmpty()) { baseCol.ValPrompt = oCol.ValPrompt; } if (oCol.ControlType != ControlType.None) { baseCol.ControlType = oCol.ControlType; } if (oCol.Order != 0) { baseCol.Order = oCol.Order; } if (oCol.Search != null) { baseCol.Search = oCol.Search; } if (oCol.Selector != null) { baseCol.Selector = oCol.Selector; } if (oCol.Navigation != null) { baseCol.Navigation = oCol.Navigation; } if (!oCol.InternalShowPage.IsEmpty()) { var arr = oCol.InternalShowPage.Split('|'); baseCol.ShowPage = PageStyle.None; arr.ToList().ForEach(str => { baseCol.ShowPage = baseCol.ShowPage | str.ToEnum <PageStyle>(); }); } if (oCol.DefaultValue != null) { if (oCol.DefaultValue.Value.IsEmpty()) { baseCol.DefaultValueStr = string.Empty; } else if (!oCol.DefaultValue.NeedParse) { oCol.DefaultValueStr = oCol.DefaultValue.Value; } else { oCol.DefaultValueStr = MacroExpression.Execute(oCol.DefaultValue.Value); } } if (!oCol.RegName.IsEmpty()) { baseCol.RegName = oCol.RegName; } if (!oCol.DetailRegName.IsEmpty()) { baseCol.DetailRegName = oCol.DetailRegName; } if (oCol.IsReadOnly) { baseCol.IsReadOnly = true; } else { baseCol.IsReadOnly = false; } if (oCol.ControlLegal != null) { baseCol.ControlLegal = oCol.ControlLegal; } if (!oCol.LinkFormat.IsEmpty()) { baseCol.LinkFormat = oCol.LinkFormat; } if (oCol.IsDetailLink) { baseCol.IsDetailLink = true; } else { baseCol.IsDetailLink = false; } }
protected override AtawColumnConfigView CreateColumn(AtawFormConfigView formView, ColumnConfig column) { var col = base.CreateColumn(formView, column); switch (column.ControlType) { case ControlType.Hidden: col.ControlType = ControlType.Hidden; break; case ControlType.Date: col.ControlType = ControlType.DetailDate; break; case ControlType.MultiFileUpload: case ControlType.SingleFileUpload: col.ControlType = ControlType.FileDetail; break; case ControlType.SingleImageUpload: case ControlType.MultiImageUpload: col.ControlType = ControlType.ImageDetail; break; case ControlType.Editor: col.ControlType = ControlType.EditorDetail; break; case ControlType.InnerPage: col.ControlType = ControlType.InnerPage; break; case ControlType.InnerForm: col.ControlType = ControlType.InnerForm; break; //case ControlType.MaskCode: // col.ControlType = ControlType.MaskCode; // break; case ControlType.Amount: col.ControlType = ControlType.AmountDetail; break; case ControlType.AmountDetail: col.ControlType = ControlType.AmountDetail; break; case ControlType.TwoColumns: col.ControlType = ControlType.TwoColumnsDetail; break; case ControlType.TwoColumnsDetail: col.ControlType = ControlType.TwoColumnsDetail; break; case ControlType.TextArea: col.ControlType = ControlType.DetailArea; break; case ControlType.DetailArea: col.ControlType = ControlType.DetailArea; break; default: col.ControlType = ControlType.Detail; break; } //if (column.ControlType != ControlType.Hidden) // col.ControlType = ControlType.Detail; //if (column.ControlType == ControlType.Date) // col.ControlType = ControlType.DetailDate; //if (column.ControlType == ControlType.SingleFileUpload) // col.ControlType = ControlType.DownLink; //if (column.ControlType == ControlType.SingleImageUpload || column.ControlType == ControlType.MultiImageUpload) // col.ControlType = ControlType.ImageDetail; ////case ControlType.Editor: //// col.ControlType = ControlType.EditorDetail; //// break; //if (column.ControlType == ControlType.Editor) // col.ControlType = ControlType.EditorDetail; return(col); }
public void Initialize(AtawPageConfigView pageView, AtawFormConfigView formView, ColumnConfig columnConfig, PageStyle style) { this.PageView = pageView; this.FormView = formView; this.Config = columnConfig; this.PageStyle = style; }
protected virtual AtawNaviColumnConfigView CreateColumnNavigation(AtawColumnConfigView atawColumnConfigView, ColumnConfig columnConfig) { if (atawColumnConfigView == null || columnConfig == null) { return(null); } try { AtawColumnConfigView viewColumn = new AtawColumnConfigView(); atawColumnConfigView.ObjectClone <AtawColumnConfigView>(viewColumn); // viewColumn = atawColumnConfigView.c // viewColumn = atawColumnConfigView; AtawNaviColumnConfigView naviViewColumn = new AtawNaviColumnConfigView(); naviViewColumn.ChangeEventFun = viewColumn.ChangeEventFun; naviViewColumn.DisplayName = viewColumn.DisplayName; naviViewColumn.Prompt = viewColumn.Prompt; naviViewColumn.ValPrompt = viewColumn.ValPrompt; naviViewColumn.Kind = viewColumn.Kind; naviViewColumn.Name = viewColumn.Name; naviViewColumn.ShowType = viewColumn.ShowType; naviViewColumn.NormalStyle = viewColumn.NormalStyle; naviViewColumn.Width = viewColumn.Width; naviViewColumn.TdStyle = viewColumn.TdStyle; naviViewColumn.IsHiddenCol = viewColumn.IsHiddenCol; naviViewColumn.Sortable = viewColumn.Sortable; naviViewColumn.Options = new BaseOptions(); viewColumn.Options.ObjectClone(naviViewColumn.Options); naviViewColumn.IsRefrech = columnConfig.Navigation.IsRefrech; naviViewColumn.IsAvailable = columnConfig.Navigation.IsAvailable; naviViewColumn.IsExpand = columnConfig.Navigation.IsExpand; if (!string.IsNullOrEmpty(columnConfig.Navigation.RegName)) { naviViewColumn.Options.RegName = columnConfig.Navigation.RegName; } ControlType controlType = columnConfig.Navigation.ControlType; if (controlType == ControlType.CheckBoxNavi || controlType == ControlType.RadioNavi || controlType == ControlType.TreeSingleNavi || controlType == ControlType.TreeMultiNavi || controlType == ControlType.SingleRadioNavi || controlType == ControlType.RadioNavi || controlType == ControlType.NaviFilter ) { naviViewColumn.ControlType = controlType; } else { switch (columnConfig.ControlType) { case ControlType.Combo: case ControlType.Radio: naviViewColumn.ControlType = ControlType.RadioNavi; break; case ControlType.CheckBox: naviViewColumn.ControlType = ControlType.CheckBoxNavi; break; case ControlType.SingleCheckBox: naviViewColumn.ControlType = ControlType.SingleRadioNavi; break; case ControlType.TreeSingleSelector: naviViewColumn.ControlType = ControlType.TreeSingleNavi; break; case ControlType.TreeMultiSelector: naviViewColumn.ControlType = ControlType.TreeMultiNavi; break; case ControlType.NaviFilter: naviViewColumn.ControlType = ControlType.NaviFilter; break; default: return(null); } } return(naviViewColumn); } catch { return(null); } }
private string ConvertToDataBaseType(ColumnConfig column) { int length = column.Length == 0 ? 200 : column.Length; if (column.DataType != default(XmlDataType)) { switch (column.DataType) { case XmlDataType.String: return("NVARCHAR(" + length + ")"); case XmlDataType.Binary: return("VARBINARY(" + length + ")"); case XmlDataType.Bit: return("BIT"); case XmlDataType.Byte: return("IMAGE"); case XmlDataType.Date: return("DATETIME"); case XmlDataType.DateTime: return("DATETIME"); case XmlDataType.Decimal: return("DECIMAL"); case XmlDataType.Double: return("FLOAT"); case XmlDataType.Int: return("INT"); case XmlDataType.Long: return("BIGINT"); case XmlDataType.Money: return("numeric(18,4)"); case XmlDataType.Short: return("SMALLINT"); case XmlDataType.Text: return("NTEXT"); default: return("VARCHAR(200)"); } } else if (column.ControlType != ControlType.None) { ControlType controlType = column.ControlType; if (controlType == ControlType.Radio || controlType == ControlType.Combo || controlType == ControlType.CheckBox) { return("INT"); } if (controlType == ControlType.Date || controlType == ControlType.DateTime || controlType == ControlType.DetailDate) { return("DATETIME"); } if (controlType == ControlType.TextArea || controlType == ControlType.MultiSelector || controlType == ControlType.FormMultiSelector) { return("NTEXT"); } if (controlType == ControlType.SingleFileUpload || controlType == ControlType.SingleImageUpload || controlType == ControlType.MultiFileUpload || controlType == ControlType.MultiImageUpload || controlType == ControlType.ImageDetail) { return("NTEXT"); } else { return("VARCHAR(" + length + ")"); } } return("VARCHAR(" + length + ")"); }
private void CreateSearchColumn(AtawFormConfigView formView, ColumnConfig column) { AtawColumnConfigView colView = new AtawColumnConfigView(); if (column.IsReadOnly) { column.IsReadOnly = false; } if (column.ControlType == ControlType.TreeMultiSelector) { colView.ControlType = ControlType.TreeSingleSelector; } else if (column.ControlType == ControlType.Detail || column.ControlType == ControlType.TextArea || (column.Search != null && column.Search.IsLike == true))//添加如果islike为true { colView.ControlType = ControlType.Text; } //else if (column.Search.ControlType != ControlType.None) //{ // colView.ControlType = column.Search.ControlType; //} else if (column.ControlType == ControlType.SingleCheckBox) { colView.ControlType = ControlType.Combo; column.RegName = "SingleCheckBoxIsOrNo"; } else { colView.ControlType = column.ControlType; } //搜索区的控件类型当为搜索字段配置的控件类型 if (column.Search.ControlType != ControlType.None) { colView.ControlType = column.Search.ControlType; } if (column.Search.DateSpan) { colView.DisplayName = column.DisplayName + "开始"; } else { colView.DisplayName = column.DisplayName; } colView.DisplayName = column.DisplayName; colView.Name = column.Name; string controlRegname = colView.ControlType.ToString(); // to.Options var optionCreator = controlRegname.CodePlugIn <AtawOptionCreator>(); //初始化 optionCreator.Initialize(BasePageView, formView, column, PageStyle.None); //方法调用 colView.Options = optionCreator.Create(); if (!column.DetailRegName.IsEmpty()) { colView.Options.RegName = column.DetailRegName; } if (column.Search != null && column.Search.IsOpenByDefault == true) { colView.Options.IsOpenByDefault = true; } colView.Options.DataValue = null; if (column.ControlType == ControlType.Text) //Text字段,模糊查询 { colView.Options.PostSetting.ColumnName = colView.Name + "_LIKE"; } //如果islike为true则 if (column.Search != null && column.Search.IsLike == true) { colView.Options.PostSetting.ColumnName = colView.Name + "_LIKE"; colView.Options.IsLike = true; } if (column.Search.IsExtension) //查询扩展 { colView.Options.PostSetting.ColumnName = colView.Name + "_IN"; } //查询区日期控件需要扩展成2个控件 if (column.Search.DateSpan) { colView.DisplayName = column.DisplayName + "开始"; formView.Columns.Add(colView); PageStyle = PageStyle.None;//避免创建选择器控件或多选控件的时候重复解码CodeTable var col = CreateColumn(formView, column); PageStyle = PageStyle.List; col.DisplayName = column.DisplayName + "结束"; col.Name = column.Name + "_END"; col.ControlType = colView.ControlType; col.Options.DataValue = null; col.Options.PostSetting.ColumnName = col.Name; formView.Columns.Add(col); } else { formView.Columns.Add(colView); } }