Exemplo n.º 1
0
        protected override void InternalLoad(System.Collections.Generic.Dictionary <string, object> databaseProperties)
        {
            dao.Properties        daoProperties = (dao.Properties)((dao.Database)DaoObject).Properties;
            PropertyCollectionDao properties    = new PropertyCollectionDao(DaoObject, (dao.Properties)((dao.Database)DaoObject).Properties);

            foreach (KeyValuePair <string, object> item in databaseProperties)
            {
                //initialize default values
                int    dataType      = (int)dao.DataTypeEnum.dbText;
                string propertyValue = String.Empty;

                //Split property "value" in dataType,propertyValue. NOTE: In version 1.0, property value only contained the value itself, not the data type
                //the first group matches one or more digits followed by colon
                //    ?: is used for non capture group (if data type do not exists)
                //inside the first group is the dataType group
                //the second group matches any character after the colon
                Match match = Regex.Match(item.Value.ToString(), @"^(?:(?<dataType>[0-9]+),)*(?<value>.*)$");
                if (match.Success)
                {
                    if (match.Groups["dataType"].Success)
                    {
                        dataType = int.Parse(match.Groups["dataType"].Value);
                    }
                    if (match.Groups["value"].Success)
                    {
                        propertyValue = match.Groups["value"].Value;
                    }

                    if (propertyValue != String.Empty)
                    {
                        properties.AddProperty(item.Key, propertyValue, (dao.DataTypeEnum)dataType);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void AddCustomProperties()
        {
            PropertyCollectionDao propColl = new PropertyCollectionDao(daoField, daoField.Properties);

            propColl.AddOptionalProperty(props, "Description", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "DecimalPlaces", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "DisplayControl", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "RowSourceType", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "RowSource", dao.DataTypeEnum.dbMemo);
            propColl.AddOptionalProperty(props, "BoundColumn", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "ColumnCount", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "ColumnHeads", dao.DataTypeEnum.dbBoolean);
            propColl.AddOptionalProperty(props, "ColumnWidths", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "ListRows", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "ListWidth", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "LimitToList", dao.DataTypeEnum.dbBoolean);

            propColl.AddOptionalProperty(props, "ColumnWidth", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "ColumnOrder", dao.DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "ColumnHidden", dao.DataTypeEnum.dbBoolean);
            propColl.AddOptionalProperty(props, "Format", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "Caption", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "UnicodeCompression", dao.DataTypeEnum.dbBoolean);
            propColl.AddOptionalProperty(props, "SmartTags", dao.DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "InputMask", dao.DataTypeEnum.dbText);
        }
Exemplo n.º 3
0
        public override void SaveProperties(ExportObject export)
        {
            PropertyCollectionDao propColl = new PropertyCollectionDao(daoField, daoField.Properties);

            propColl.TryWriteProperty(export, "Attributes");
            propColl.TryWriteProperty(export, "CollatingOrder");
            propColl.TryWriteProperty(export, "Type");
            propColl.TryWriteProperty(export, "Name");
            propColl.TryWriteProperty(export, "OrdinalPosition");
            propColl.TryWriteProperty(export, "Size");
            propColl.TryWriteProperty(export, "SourceField");
            propColl.TryWriteProperty(export, "SourceTable");
            propColl.TryWriteProperty(export, "DataUpdatable");
            propColl.TryWriteProperty(export, "DefaultValue");
            propColl.TryWriteProperty(export, "ValidationRule");
            propColl.TryWriteProperty(export, "ValidationText");
            propColl.TryWriteProperty(export, "Required");
            propColl.TryWriteProperty(export, "AllowZeroLength");
            propColl.TryWriteProperty(export, "VisibleValue");
            propColl.TryWriteProperty(export, "Description");
            propColl.TryWriteProperty(export, "DecimalPlaces");
            propColl.TryWriteProperty(export, "DisplayControl");
            if (propColl.PropertyHasValue("DisplayControl"))
            {
                switch (Convert.ToInt32(daoField.Properties["DisplayControl"].Value))
                {
                case 110:       //listbox
                    propColl.TryWriteProperty(export, "RowSourceType");
                    propColl.TryWriteProperty(export, "RowSource");
                    propColl.TryWriteProperty(export, "BoundColumn");
                    propColl.TryWriteProperty(export, "ColumnCount");
                    propColl.TryWriteProperty(export, "ColumnHeads");
                    propColl.TryWriteProperty(export, "ColumnWidths");
                    break;

                case 111:       //dropdown list
                    propColl.TryWriteProperty(export, "RowSourceType");
                    propColl.TryWriteProperty(export, "RowSource");
                    propColl.TryWriteProperty(export, "BoundColumn");
                    propColl.TryWriteProperty(export, "ColumnCount");
                    propColl.TryWriteProperty(export, "ColumnHeads");
                    propColl.TryWriteProperty(export, "ColumnWidths");
                    propColl.TryWriteProperty(export, "ListRows");
                    propColl.TryWriteProperty(export, "ListWidth");
                    propColl.TryWriteProperty(export, "LimitToList");
                    break;
                }
            }
            propColl.TryWriteProperty(export, "ColumnWidth");
            propColl.TryWriteProperty(export, "ColumnOrder");
            propColl.TryWriteProperty(export, "ColumnHidden");
            propColl.TryWriteProperty(export, "Format");
            propColl.TryWriteProperty(export, "Caption");
            propColl.TryWriteProperty(export, "UnicodeCompression");
            propColl.TryWriteProperty(export, "SmartTags");
            propColl.TryWriteProperty(export, "InputMask");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Save table defintion to <paramref name="fileName"/>
        /// </summary>
        /// <param name="fileName">File name where save the table definition</param>
        public override void Save(string fileName)
        {
            MakePath(System.IO.Path.GetDirectoryName(fileName));

            dao.DBEngine dbEngine = new dao.DBEngine();
            dao.Database db       = dbEngine.OpenDatabase(App.FileName);
            dao.TableDef tbDef    = db.TableDefs[Name];

            using (StreamWriter sw = new StreamWriter(fileName)) {
                ExportObject export = new ExportObject(sw);
                //export.ListProperties(tbDef.Name, tbDef.Properties);
                export.WriteBegin(ClassName, TableName);
                export.WriteProperty("Attributes", tbDef.Attributes);
                export.WriteProperty("Connect", tbDef.Connect);
                export.WriteProperty("SourceTableName", tbDef.SourceTableName);
                export.WriteProperty("ValidationRule", tbDef.ValidationRule);
                export.WriteProperty("ValidationText", tbDef.ValidationText);

                PropertyCollectionDao propColl = new PropertyCollectionDao(tbDef, tbDef.Properties);
                propColl.TryWriteProperty(export, "Description");
                propColl.TryWriteProperty(export, "ConflictTable");
                propColl.TryWriteProperty(export, "ReplicaFilter");
                propColl.TryWriteProperty(export, "Orientation");
                propColl.TryWriteProperty(export, "OrderByOn");
                propColl.TryWriteProperty(export, "SubdatasheetName");
                propColl.TryWriteProperty(export, "LinkChildFields");
                propColl.TryWriteProperty(export, "LinkMasterFields");
                propColl.TryWriteProperty(export, "SubdatasheetHeight");
                propColl.TryWriteProperty(export, "SubdatasheetExpanded");
                propColl.TryWriteProperty(export, "DefaultView");
                propColl.TryWriteProperty(export, "OrderBy");

                export.WriteBegin("Fields");
                foreach (dao.Field field in tbDef.Fields)
                {
                    export.WriteObject(new Field(field));
                }
                export.WriteEnd();      //End Fields
                export.WriteBegin("Indexes");
                //TODO: Add new option menu to ignore linked tables errors if the linked document do not exist
                //      Check if the linked document exists before iterate the indexes collection
                foreach (dao.Index daoIndex in tbDef.Indexes)
                {
                    export.WriteObject(new Index(daoIndex));
                }
                export.WriteEnd();  //End Indexes
                export.WriteEnd();  //End Table
            }
            db.Close();
        }
Exemplo n.º 5
0
        private void AddCustomProperties(Dictionary <string, object> props)
        {
            PropertyCollectionDao propColl = new PropertyCollectionDao(tableDef, tableDef.Properties);

            propColl.AddOptionalProperty(props, "Description", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "ConflictTable", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "ReplicaFilter", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "Orientation", DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "OrderByOn", DataTypeEnum.dbBoolean);
            propColl.AddOptionalProperty(props, "SubdatasheetName", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "LinkChildFields", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "LinkMasterFields", DataTypeEnum.dbText);
            propColl.AddOptionalProperty(props, "SubdatasheetHeight", DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "SubdatasheetExpanded", DataTypeEnum.dbBoolean);
            propColl.AddOptionalProperty(props, "DefaultView", DataTypeEnum.dbInteger);
            propColl.AddOptionalProperty(props, "OrderBy", DataTypeEnum.dbText);
        }