Example #1
0
        public List <TableForeignKeyDesignerInfo> GetForeignKeys()
        {
            List <TableForeignKeyDesignerInfo> keyDesingerInfos = new List <TableForeignKeyDesignerInfo>();

            foreach (DataGridViewRow row in this.dgvForeignKeys.Rows)
            {
                TableForeignKeyDesignerInfo key = new TableForeignKeyDesignerInfo();

                string keyName = row.Cells[this.colKeyName.Name].Value?.ToString();

                if (!string.IsNullOrEmpty(keyName))
                {
                    TableForeignKeyDesignerInfo tag = row.Tag as TableForeignKeyDesignerInfo;

                    key.OldName             = tag?.OldName;
                    key.Name                = keyName;
                    key.Columns             = tag?.Columns;
                    key.ReferencedTableName = DataGridViewHelper.GetCellStringValue(row, this.colReferenceTable.Name);
                    key.UpdateCascade       = DataGridViewHelper.GetCellBoolValue(row, this.colUpdateCascade.Name);
                    key.DeleteCascade       = DataGridViewHelper.GetCellBoolValue(row, this.colDeleteCascade.Name);
                    key.Comment             = DataGridViewHelper.GetCellStringValue(row, this.colComment.Name);

                    row.Tag = key;

                    keyDesingerInfos.Add(key);
                }
            }

            return(keyDesingerInfos);
        }
Example #2
0
        public List <TableColumnDesingerInfo> GetColumns()
        {
            List <TableColumnDesingerInfo> columnDesingerInfos = new List <TableColumnDesingerInfo>();

            int order = 1;

            foreach (DataGridViewRow row in this.dgvColumns.Rows)
            {
                TableColumnDesingerInfo col = new TableColumnDesingerInfo()
                {
                    Order = order
                };

                string colName = row.Cells[this.colColumnName.Name].Value?.ToString();

                if (!string.IsNullOrEmpty(colName))
                {
                    TableColumnDesingerInfo tag = row.Tag as TableColumnDesingerInfo;

                    string dataType = DataGridViewHelper.GetCellStringValue(row, this.colDataType.Name);

                    col.OldName           = tag?.OldName;
                    col.Name              = colName;
                    col.DataType          = dataType;
                    col.Length            = DataGridViewHelper.GetCellStringValue(row, this.colLength.Name);
                    col.IsNullable        = DataGridViewHelper.GetCellBoolValue(row, this.colNullable.Name);
                    col.IsPrimary         = DataGridViewHelper.GetCellBoolValue(row, this.colPrimary.Name);
                    col.IsIdentity        = DataGridViewHelper.GetCellBoolValue(row, this.colIdentity.Name);
                    col.DefaultValue      = DataGridViewHelper.GetCellStringValue(row, this.colDefaultValue.Name);
                    col.Comment           = DataGridViewHelper.GetCellStringValue(row, this.colComment.Name);
                    col.ExtraPropertyInfo = tag?.ExtraPropertyInfo;

                    UserDefinedType userDefinedType = this.GetUserDefinedType(dataType);

                    if (userDefinedType != null)
                    {
                        col.IsUserDefined = true;
                        col.TypeOwner     = userDefinedType.Owner;
                    }

                    row.Tag = col;

                    columnDesingerInfos.Add(col);

                    order++;
                }
            }

            return(columnDesingerInfos);
        }
Example #3
0
        private List <BackupSetting> GetSettings()
        {
            List <BackupSetting> settings = new List <BackupSetting>();

            foreach (DataGridViewRow row in this.dgvSettings.Rows)
            {
                BackupSetting setting = new BackupSetting();
                setting.DatabaseType       = DataGridViewHelper.GetCellStringValue(row, this.colDatabaseType.Name);
                setting.ClientToolFilePath = DataGridViewHelper.GetCellStringValue(row, this.colClientToolFilePath.Name);
                setting.SaveFolder         = DataGridViewHelper.GetCellStringValue(row, this.colSaveFolder.Name);
                setting.ZipFile            = DataGridViewHelper.GetCellBoolValue(row, this.colZipBackupFile.Name);

                settings.Add(setting);
            }

            return(settings);
        }