Esempio n. 1
0
 public AFieldTable(string name, string discript)
 {
     TableName     = name;
     TableDiscript = discript;
     TableFields.Add(new TableField()
     {
         Name     = "ID",
         Type     = "int identity(1,1) primary key not null",
         IsExtend = true
     });
     CommonFields.AddRange(
         new TableField[] {
         new TableField()
         {
             Name     = "修改人",
             Type     = TableField.FieldTypeList[TableFieldType.文本],
             IsExtend = true,
         },
         new TableField()
         {
             Name     = "修改时间",
             Type     = TableField.FieldTypeList[TableFieldType.日期时间],
             IsExtend = true,
             Value    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
         },
     });
 }
Esempio n. 2
0
        /// <summary>
        /// Get Specify Table Column Data
        /// </summary>
        /// <param name="tableFields"></param>
        /// <param name="field"></param>
        /// <param name="conditions"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        /// Owner:Andy Gao 2010-07-13 12:12:27
        public static string GetSpecifyTableColumnData(TableFields tableFields, string field, Conditions conditions, DbTransaction transaction)
        {
            List <string> interestColumns = new List <string>()
            {
                field
            };

            string sqlString = DatabaseTable.BuildQuerySqlStatement(tableFields, interestColumns, conditions);

            if (transaction != null && transaction.Connection != null)
            {
                DbCommand command = transaction.Connection.CreateCommand();

                command.CommandType = CommandType.Text;
                command.CommandText = sqlString;
                command.Transaction = transaction;

                object scalar = command.ExecuteScalar();

                if (scalar != null && scalar != DBNull.Value)
                {
                    return(scalar.ToString());
                }
                else
                {
                    return(string.Empty);
                }
            }
            else
            {
                return(string.Empty);
            }
        }
        private async Task GetTableFieldsAsync()
        {
            if (EditingTemplate.Current.MapMember == null)
            {
                return;
            }
            var tableToEdit = EditingTemplate.Current.MapMember as StandaloneTable;

            if (tableToEdit == null)
            {
                return;
            }

            TableFields.Clear();
            await QueuedTask.Run(() =>
            {
                ObservableCollection <string> tableFields = new ObservableCollection <string>();

                foreach (FieldDescription fd in tableToEdit.GetFieldDescriptions())
                {
                    tableFields.Add(fd.Name);
                }
                SetProperty(ref _tableFields, tableFields, () => TableFields);
                SetProperty(ref _selectedTableField, tableFields.FirstOrDefault(), () => SelectedTableField);
            });
        }
Esempio n. 4
0
 private void GetSection(string sName)
 {
     if (ConfigObj != null)
     {
         MyKeyValueSetting oneSetting = ConfigObj.Section[sName];
         //解析connectionstring,server=WINDYCOMPUTER\TESTDB;database=CIS_TEST;uid=sa;pwd=winning
         //edtShowFields.Text = oneSetting.column;
         //edtShowTable.Text = oneSetting.table;
         SetConnectString(oneSetting.ConnectString);
         //表格
         gcShow.DataSource = null;
         gcShow.RefreshDataSource();
         List <TableFields> showData   = new List <TableFields>();
         string[]           tableArray = oneSetting.table.Split(';');
         string[]           fieldArray = oneSetting.column.Split(';');
         for (int i = 0; i < tableArray.Length; i++)
         {
             TableFields item = new TableFields();
             item.sTableName = tableArray[i];
             item.sFields    = fieldArray[i];
             showData.Add(item);
         }
         gcShow.DataSource = showData;
         gcShow.RefreshDataSource();
     }
 }
Esempio n. 5
0
 public Table(int id, string name)
     : base(id, name)
 {
     Properties  = new TableProperties(this);
     Fields      = new TableFields(this);
     Keys        = new TableKeys(this);
     FieldGroups = new TableFieldGroups(this);
     Code        = new Code.Variable.Code(this);
 }
        public static void Write(this TableFields tableFields, CSideWriter writer)
        {
            writer.BeginSection("FIELDS");

            foreach (TableField tableField in tableFields.OrderBy(f => f.ID))
            {
                tableField.Write(writer);
            }

            writer.EndSection();
        }
Esempio n. 7
0
 public override bool ValidateSelectors() =>
 (
     !string.IsNullOrEmpty(PageReference) &&
     !string.IsNullOrEmpty(Table) &&
     !string.IsNullOrEmpty(LoadElement) &&
     SetFields.Any() &&
     GetFields.Any() &&
     PageButtons.Any() &&
     TableFields.Any() &&
     ErrorElements.Any()
 );
Esempio n. 8
0
        /// <summary>
        /// 根据数据库表字段创建数据表对象。
        /// </summary>
        /// <returns>包含数据库表字段的数据表对象。</returns>
        public static DataTable CreateDataTable(TableFields fields)
        {
            DataTable dtRetrun = new DataTable();

            dtRetrun.TableName = fields.TABLE_NAME;
            foreach (string key in fields.FIELDS.Keys)
            {
                FieldProperties properties = fields.FIELDS[key];
                DataColumn      dc         = dtRetrun.Columns.Add(key, properties.DATATYPE);
                dc.AllowDBNull  = properties.CanNull;
                dc.DefaultValue = properties.DefaultValue;
            }
            return(dtRetrun);
        }
 /// <summary>
 /// Create Table to display fields
 /// </summary>
 /// <param name="totalRows">Total Number of Rows in the HTML Table</param>
 /// <param name="totalColumns">Total Number of Columns in the HTML Table</param>
 private void CreateTable(int totalRows, int totalColumns)
 {
     TableFields.Dispose();
     for (int row = 0; row < totalRows + 4; row++)
     {
         TableRow tr = new TableRow();
         for (int column = 0; column <= totalColumns; column++)
         {
             TableCell td = new TableCell();
             td.Wrap = false;
             tr.Cells.Add(td);
         }
         TableFields.Rows.Add(tr);
     }
 }
Esempio n. 10
0
 public override void AddField(TableField field)
 {
     foreach (TableField f in TableFields)
     {
         if (f.Name == field.Name)
         {
             f.Value = field.Value;
             return;
         }
     }
     if (CommonFields.Select(f => f.Name).Contains(field.Name))
     {
         field.IsExtend = true;
     }
     TableFields.Add(field);
 }
Esempio n. 11
0
        /// <summary>
        /// Get Specify Table Column Data
        /// </summary>
        /// <param name="tableFields"></param>
        /// <param name="field"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        /// Owner:Andy Gao 2010-07-08 11:14:01
        public static string GetSpecifyTableColumnData(TableFields tableFields, string field, string key, object value, DbTransaction transaction)
        {
            List <string> interestColumns = new List <string>()
            {
                field
            };

            Conditions conditions = new Conditions();

            if (value == null || value == DBNull.Value)
            {
                conditions.Add(DatabaseLogicOperator.And, key, DatabaseCompareOperator.Null, string.Empty);
            }
            else
            {
                conditions.Add(DatabaseLogicOperator.And, key, DatabaseCompareOperator.Equal, value.ToString());
            }

            string sqlString = DatabaseTable.BuildQuerySqlStatement(tableFields, interestColumns, conditions);

            if (transaction != null && transaction.Connection != null)
            {
                DbCommand command = transaction.Connection.CreateCommand();

                command.CommandType = CommandType.Text;
                command.CommandText = sqlString;
                command.Transaction = transaction;

                object scalar = command.ExecuteScalar();

                if (scalar != null && scalar != DBNull.Value)
                {
                    return(scalar.ToString());
                }
                else
                {
                    return(string.Empty);
                }
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 12
0
        private void btnAddDetail_Click(object sender, EventArgs e)
        {
            if ((edtTable.Text == "") || (edtFields.Text == ""))
            {
                MessageBox.Show("表名和字段集合不能为空!");
                return;
            }
            List <TableFields> gcDataSource = gcDetail.DataSource as List <TableFields>;

            TableFields tableFields = new TableFields();

            tableFields.sTableName = edtTable.Text;
            tableFields.sFields    = edtFields.Text;
            if (gcDataSource == null)
            {
                gcDataSource = new List <TableFields>();
            }
            gcDataSource.Add(tableFields);
            gcDetail.DataSource = gcDataSource;
            gcDetail.RefreshDataSource();
        }
Esempio n. 13
0
        public TableFields getTable(string id)
        {
            TableFields d = new TableFields();

            if(mTA.Find(mPrefix + id))
            {
                d.ID = id;
                d.TX1 = mTX1.Value;
                d.TX2 = mTX2.Value;
                d.KD1 = mKD1.Value;
                d.Active = true;
            }
            else
            {
                d.ID = "";
                d.TX1 = "";
                d.TX2 = "";
                d.KD1 = "";
                d.Active = true;
            }
            return d;
        }
Esempio n. 14
0
 public static IEnumerable <Invocation> ToInvocations(this TableFields fields) => fields.Select(f => f.ToInvocation());