Esempio n. 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            DBColumn dbColumn = new DBColumn()
            {
                ColumnName = txtColumnName.Text,
                AllowNull = checkBoxAllowNull.Checked,
                DbType =  JFieldType.String,
            };
            int length = 0;
            if (!string.IsNullOrEmpty(txtLength.Text))
            {
                int.TryParse(txtLength.Text, out  length);
                dbColumn.Length = length;
            }

            if (!string.IsNullOrEmpty(comboBoxSQLDBType.Text))
            {
                JFieldType dbType;
                if (Enum.TryParse<JFieldType>(comboBoxSQLDBType.Text, out dbType))
                {
                    dbColumn.DbType = dbType;
                }
            }

            JField field = new JField(dbColumn);

            if (AddFieldDelegate != null)
            {
                AddFieldDelegate(field);
            }
            this.Close();
        }
Esempio n. 2
0
 private DBForeignKey(DBColumn column)
 {
     this.ColumnName = column.ColumnName;
     this.DbType     = column.DbType;
     this.Length     = column.Length;
     this.AllowNull  = column.AllowNull;
 }
Esempio n. 3
0
 private DBForeignKey(DBColumn column)
 {
     this.ColumnName = column.ColumnName;
     this.DbType = column.DbType;
     this.Length = column.Length;
     this.AllowNull = column.AllowNull;
 }
Esempio n. 4
0
 public DBPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step)
     : this(column)
 {
     this.IsIdentity   = isIdentity;
     this.Seed         = seed;
     this.CurrentValue = currentValue;
     this.Step         = step;
 }
Esempio n. 5
0
 public JField(DBColumn column)
 {
     this.FieldName    = column.ColumnName;
     this.ValueType    = column.DbType;
     this.FirstOperand = new JOperateNum(this.FieldName, this.ValueType);
     this.AllowNull    = column.AllowNull;
     if (column is DBPrimaryKey)
     {
         DBPrimaryKey pk = column as DBPrimaryKey;
         this.FirstOperand.ValueCategroy = JValueCategroy.Sequence;
         this.FirstOperand.MinValue      = pk.CurrentValue + pk.Step;
         this.FirstOperand.Step          = pk.Step;
     }
     if (column is DBForeignKey)
     {
         DBForeignKey fk = column as DBForeignKey;
         this.FirstOperand.ValueCategroy       = JValueCategroy.FromTable;
         this.FirstOperand.ReferenceTableName  = fk.ReferenceTableName;
         this.FirstOperand.ReferenceColumnName = fk.ReferenceColumnName;
     }
     this.Visible = false;
     this.Order   = 0;
 }
Esempio n. 6
0
 private DBPrimaryKey(DBColumn column)
 {
     this.ColumnName = column.ColumnName;
     this.DbType     = column.DbType;
     this.Length     = column.Length;
 }
Esempio n. 7
0
 public DBForeignKey(DBColumn column, string reftableName, string refColumnName)
     : this(column)
 {
     this.ReferenceColumnName = refColumnName;
     this.ReferenceTableName  = reftableName;
 }
Esempio n. 8
0
 public void AddForeignKey(DBColumn column, string refTableName, string refColumnName)
 {
     this.ForeignKeys.Add(new DBForeignKey(column, refTableName, refColumnName));
     this.Columns.Remove(column);
 }
Esempio n. 9
0
 public void SetPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step)
 {
     this.PrimaryKey = new DBPrimaryKey(column, isIdentity, seed, currentValue, step);
     this.Columns.Remove(column);
 }
Esempio n. 10
0
 private DBPrimaryKey(DBColumn column)
 {
     this.ColumnName = column.ColumnName;
     this.DbType = column.DbType;
     this.Length = column.Length;
 }
Esempio n. 11
0
 public DBPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step)
     : this(column)
 {
     this.IsIdentity = isIdentity;
     this.Seed = seed;
     this.CurrentValue = currentValue;
     this.Step = step;
 }
Esempio n. 12
0
 public DBForeignKey(DBColumn column, string reftableName, string refColumnName)
     : this(column)
 {
     this.ReferenceColumnName = refColumnName;
     this.ReferenceTableName = reftableName;
 }
Esempio n. 13
0
 public void SetPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step)
 {
     this.PrimaryKey = new DBPrimaryKey(column, isIdentity, seed, currentValue, step);
     this.Columns.Remove(column);
 }
Esempio n. 14
0
 public void AddForeignKey(DBColumn column, string refTableName, string refColumnName)
 {
     this.ForeignKeys.Add(new DBForeignKey(column, refTableName, refColumnName));
     this.Columns.Remove(column);
 }
Esempio n. 15
0
 public JField(DBColumn column)
 {
     this.FieldName = column.ColumnName;
     this.ValueType = column.DbType;
     this.FirstOperand = new JOperateNum(this.FieldName, this.ValueType);
     this.AllowNull = column.AllowNull;
     if (column is DBPrimaryKey)
     {
         DBPrimaryKey pk = column as DBPrimaryKey;
         this.FirstOperand.ValueCategroy = JValueCategroy.Sequence;
         this.FirstOperand.MinValue = pk.CurrentValue + pk.Step;
         this.FirstOperand.Step = pk.Step;
     }
     if (column is DBForeignKey)
     {
         DBForeignKey fk = column as DBForeignKey;
         this.FirstOperand.ValueCategroy = JValueCategroy.FromTable;
         this.FirstOperand.ReferenceTableName = fk.ReferenceTableName;
         this.FirstOperand.ReferenceColumnName = fk.ReferenceColumnName;
     }
     this.Visible = false;
     this.Order = 0;
 }
Esempio n. 16
0
        protected virtual void FillFields(DBTable table)
        {
            OleDbDataReader rd = OleDbHelper.ExecuteReader(this.OleDbConnStr, string.Format(this.Format_GET_ALL_FIELDS, table.TableName));
            List<DBColumn> fields = new List<DBColumn>();

            while (rd.Read())
            {
                try
                {
                    DBColumn column = new DBColumn(rd["fieldName"].ToString());
                    string fieldType = rd["fieldType"].ToString();
                    if (this.DataBaseType == DataBaseType.MSSQL)
                    {
                        column.DbType = ((SqlDbType)Enum.Parse(typeof(SqlDbType), fieldType, true)).ToJFielType();
                    }
                    else
                    {
                        column.DbType = ((OracleType)Enum.Parse(typeof(OracleType), fieldType, true)).ToJFielType();
                    }

                    column.Length = int.Parse(rd["fieldLength"].ToString());
                    column.AllowNull = rd["allowNull"].ToString() == "1" ? true : false;
                    fields.Add(column);
                }
                catch (Exception ex)
                {
                }
            }
            rd.Close();
            rd.Dispose();
            table.Columns = fields;
        }