Example #1
0
        private void bindGridControl()
        {
            _DataSet = getData();
            if (null != _DataSet)
            {
                LocalLanguageObject language = new LocalLanguageObject(rxtLanguage);

                DataColumnCollection dataColumnCollections = _DataSet.Tables[0].Columns;

                DataColumn colName = new DataColumn(DEFAULT_COLUMN_NAME);
                colName.Caption = DEFAULT_COLUMN_NAME_CAPTION;

                DataColumn colDescription = new DataColumn(DEFAULT_COLUMN_DESCRIPTION);
                colDescription.Caption = DEFAULT_COLUMN_DESCRIPTION_CAPTION;

                DataColumn colType = new DataColumn(DEFAULT_COLUMN_TYPE);
                colType.Caption = DEFAULT_COLUMN_TYPE_CAPTION;

                DataTable dataTable = new DataTable();
                DataSet   dataSet   = new DataSet();
                dataTable.Columns.AddRange(new DataColumn[] { colName, colDescription, colType });


                foreach (DataColumn dataColumn in dataColumnCollections)
                {
                    dataTable.Rows.Add(dataColumn.ColumnName, language.GetDescription(dataColumn.ColumnName), dataColumn.DataType);
                }

                dataSet.Tables.Add(dataTable);

                gridControl.DataSource = dataSet.Tables[0].DefaultView;

                string[] items = getDataTypes();

                DevExpress.XtraEditors.Repository.RepositoryItemComboBox repositoryItemComboBoxDataType =
                    new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();
                repositoryItemComboBoxDataType.Items.AddRange(items);

                gridView.Columns[2].ColumnEdit = repositoryItemComboBoxDataType;

                this.gridView.Name = DEFAULT_GRIDVIEW_NAME;
            }
        }
Example #2
0
        /// <summary>
        /// 生成代码。
        /// </summary>
        /// <param name="rxtBox"></param>
        public void GenerateToRichTextBox(System.Windows.Forms.RichTextBox rxtBox)
        {
            List <string> whileLines    = new List <string>();
            List <string> templeteLines = ShareLib.Instance.ReadRfTemplete(TEMPLETE_NAME, ref whileLines);

            foreach (string line in templeteLines)
            {
                string tempLine = line.Replace(ShareLib.PARAM_SYSTEM_TIME, System.DateTime.Now.ToString("yyyy-MM-dd hh:mm"));

                if (string.Compare(tempLine.Trim(), ShareLib.PARAM_WHILE, true) == 0)
                {
                    foreach (DataColumn dc in _DataColumns)
                    {
                        foreach (string pro in whileLines)
                        {
                            string propertyLine = pro;
                            if (!string.IsNullOrEmpty(propertyLine))
                            {
                                propertyLine = propertyLine.Replace(PARAM_PROPERTY_NAME, dc.ColumnName);
                                propertyLine = propertyLine.Replace(PARAM_DESCRIPTION, _Language.GetDescription(dc.ColumnName));
                                propertyLine = propertyLine.Replace(PARAM_IS_KEY, "False");
                                propertyLine = propertyLine.Replace(PARAM_IS_NULL, "True");
                                propertyLine = propertyLine.Replace(PARAM_VISIBLED, "True");
                                propertyLine = propertyLine.Replace(PARAM_CANEDIT, "True");
                                propertyLine = propertyLine.Replace(PARAM_WIDTH, "100");
                                string dataType = ShareLib.Instance.ConvertDataTypeFullName(dc.ColumnName, dc.DataType);
                                propertyLine = propertyLine.Replace(PARAM_DATA_TYPE, dataType);
                            }
                            appendLine(rxtBox, propertyLine);
                        }
                    }
                    continue;
                }
                string dataLine = tempLine;
                appendLine(rxtBox, dataLine);
            }
        }