public ValueField() { defaultValue = string.Empty; length = 75; extensions = new Dictionary <Type, ValueFieldExtension>(); readOnlyExtensions = new ReadOnlyDictionary <Type, ValueFieldExtension>(extensions); isClientEditEnabled = true; isClientViewEnabled = true; builder = ValueTypeBuilder.Default; }
public static ValueTypeCollection Make(ValueTypeBuilder builder) { ValueType fdt; ValueTypeCollection values; values = new ValueTypeCollection(20); #region bool fdt = new ValueType("bool", "bool", "Boolean", "DbType.Boolean", "BIT", "BIT", "{0}.GetBoolean({1})", "{0}", "System.Web.UI.WebControls", "CheckBox", "cb", "{0}{1}.Checked = {2}.{1};", "{2}.{1} = {0}{1}.Checked;"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region byte fdt = new ValueType("byte", "byte", "Byte", "DbType.Byte", "BYTE", "TINYINT", "{0}.GetByte({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = byte.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region char fdt = new ValueType("char", "char", "Char", "DbType.String", "TEXT(1)", "NVARCHAR(1)", "{0}.GetChar({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = char.Parse({0}{1}.Text);", false, true, string.Empty); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region decimal fdt = new ValueType("decimal", "decimal", "Decimal", "DbType.Currency", "CURRENCY", "MONEY", "{0}.GetDecimal({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = decimal.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region double fdt = new ValueType("double", "double", "Double", "DbType.Double", "DOUBLE", "FLOAT", "{0}.GetDouble({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = double.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region float fdt = new ValueType("float", "float", "Single", "DbType.Single", "SINGLE", "REAL", "{0}.GetFloat({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = float.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region short fdt = new ValueType("short", "short", "Int16", "DbType.Int16", "SHORT", "SMALLINT", "{0}.GetInt16({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = short.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region int fdt = new ValueType("int", "int", "Int32", "DbType.Int32", "LONG", "INT", "{0}.GetInt32({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = int.Parse({0}{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region string fdt = new ValueType("string", "string", "String", "DbType.String", "TEXT({0})", "NVARCHAR({0})", "{0}.GetString({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1};", "{2}.{1} = {0}{1}.Text;", true, true, string.Empty); fdt.NullValue = "null"; if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region string (MEMO) fdt = new ValueType("string (MEMO)", "string", "String", "DbType.String", "MEMO", "NTEXT", "{0}.GetString({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1};", "{2}.{1} = {0}{1}.Text;", false, true, string.Empty); fdt.NullValue = "null"; if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region string (MEMO) - FTB fdt = new ValueType("string (MEMO) - FTB", "string", "String", "DbType.String", "MEMO", "NTEXT", "{0}.GetString({1})", "{0}", "FreeTextBoxControls", "FreeTextBox", "ftb", "{0}{1}.Text = {2}.{1};", "{2}.{1} = {0}{1}.Text;", false, true, string.Empty); fdt.EditorProperties = new System.Collections.Generic.List <string>(); fdt.EditorProperties.Add("ftb{0}.ID = this.ID + \"_{0}\";"); fdt.EditorProperties.Add("ftb{0}.Width = Unit.Percentage(100);"); fdt.NullValue = "null"; // = "string.Empty values.Add(fdt); #endregion #region string (MEMO) - FCKeditor fdt = new ValueType("string (MEMO) - FCKeditor", "string", "String", "DbType.String", "MEMO", "NTEXT", "{0}.GetString({1})", "{0}", "FredCK", "FCKeditor", "fcke", "{0}{1}.Value = {2}.{1};", "{2}.{1} = {0}{1}.Value;", false, true, string.Empty); fdt.EditorProperties = new System.Collections.Generic.List <string>(); fdt.EditorProperties.Add("fcke{0}.ID = this.ID + \"_{0}\";"); fdt.EditorProperties.Add("fcke{0}.Width = Unit.Percentage(100);"); fdt.NullValue = "null"; // = "string.Empty"; values.Add(fdt); #endregion #region DateTime fdt = new ValueType("DateTime", "DateTime", "DateTime", "DbType.Date", "DATETIME", "DATETIME", "{0}.GetDateTime({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = DateTime.Parse({0}{1}.Text);"); fdt.NullValue = "DateTime.MinValue"; if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region DateTime (DateEditor) fdt = new ValueType("DateTime (DateEditor)", "DateTime", "DateTime", "DbType.Date", "DATETIME", "DATETIME", "{0}.GetDateTime({1})", "{0}", "Amns.GreyFox.Web.UI.WebControls", "DateEditor", "de", "{0}{1}.Date = {2}.{1};", "{2}.{1} = {0}{1}.Date;"); fdt.EditorProperties = new System.Collections.Generic.List <string>(); fdt.EditorProperties.Add("de{0}.ID = this.ID + \"_{0}\";"); fdt.EditorProperties.Add("de{0}.AutoAdjust = true;"); fdt.NullValue = "DateTime.MinValue"; values.Add(fdt); #endregion #region TimeSpan fdt = new ValueType("TimeSpan", "TimeSpan", "TimeSpan", "DbType.Double", "DOUBLE", "FLOAT", "TimeSpan.FromTicks((long) {0}.GetDouble({1}))", "{0}.Ticks", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = TimeSpan.Parse({0}{1}.Text);"); fdt.NullValue = "TimeSpan.Zero"; if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion #region GUID fdt = new ValueType("Guid", "Guid", "Guid", "DbType.Guid", "GUID", "UNIQUEIDENTIFIER", "{0}.GetGuid({1})", "{0}", "System.Web.UI.WebControls", "TextBox", "tb", "{0}{1}.Text = {2}.{1}.ToString();", "{2}.{1} = new Guid({0}.{1}.Text);"); if (builder != null) { builder.SetEditorProperties(fdt); } values.Add(fdt); #endregion //fieldTypes.Add(new FieldDataType("object", "BINARY", false, "{0}.GetBytes({1},0,{2},0,int.MaxValue)")); return(values); }