void repoFieldNameChooser_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            String strTableName = this.TableName;

            if (this.ConfigGridView.FocusedRowHandle < 0)
            {
                this.ConfigGridView.AddNewRow();
            }

            ABCGridColumn.ColumnConfig config = this.ConfigGridView.GetRow(this.ConfigGridView.FocusedRowHandle) as ABCGridColumn.ColumnConfig;
            if (config != null)
            {
                strTableName = config.TableName;
            }

            if (String.IsNullOrWhiteSpace(strTableName) == false)
            {
                String         strOldFieldName = this.ConfigGridView.GetFocusedDisplayText();
                FieldChooserEx chooser         = new FieldChooserEx(strTableName, strOldFieldName);
                if (chooser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.ConfigGridView.SetFocusedRowCellValue(this.ConfigGridView.FocusedColumn, chooser.Result);
                }
            }
        }
        void ConfigGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "FieldName" || e.Column.FieldName == "IsUseAlias")
            {
                ABCGridColumn.ColumnConfig config = this.ConfigGridView.GetRow(this.ConfigGridView.FocusedRowHandle) as ABCGridColumn.ColumnConfig;
                if (config != null)
                {
                    if (config.IsUseAlias)
                    {
                        String strCaption = String.Empty;
                        if (config.FieldName.Contains(":"))
                        {
                            DataCachingProvider.AccrossStructInfo structInfo = DataCachingProvider.GetAccrossStructInfo(config.TableName, config.FieldName);
                            if (structInfo != null)
                            {
                                strCaption = DataConfigProvider.GetFieldCaption(structInfo.TableName, structInfo.FieldName);
                            }
                        }
                        else
                        {
                            strCaption = DataConfigProvider.GetFieldCaption(config.TableName, config.FieldName);
                        }

                        if (string.IsNullOrWhiteSpace(strCaption) == false)
                        {
                            config.Caption = strCaption;
                        }
                    }
                }
            }

            RefreshDisplayGrid();
        }
Esempio n. 3
0
 void ConfigGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
 {
     if (String.IsNullOrWhiteSpace(this.TableName) == false)
     {
         ABCGridColumn.ColumnConfig config = this.ConfigGridView.GetRow(e.RowHandle) as ABCGridColumn.ColumnConfig;
         if (config != null)
         {
             config.TableName = this.TableName;
         }
     }
 }
Esempio n. 4
0
 void ConfigGridView_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
 {
     if (e.Column.FieldName == "FilterString")
     {
         ABCGridColumn.ColumnConfig config = this.ConfigGridView.GetRow(this.ConfigGridView.FocusedRowHandle) as ABCGridColumn.ColumnConfig;
         if (config == null || ABCDataLib.Tables.StructureProvider.IsForeignKey(config.TableName, config.FieldName) == false)
         {
             e.RepositoryItem = null;
             return;
         }
     }
 }
Esempio n. 5
0
 void repoFilterStringEditor_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     ABCGridColumn.ColumnConfig config = this.ConfigGridView.GetRow(this.ConfigGridView.FocusedRowHandle) as ABCGridColumn.ColumnConfig;
     if (config != null && ABCDataLib.Tables.StructureProvider.IsForeignKey(config.TableName, config.FieldName))
     {
         String strTableName = ABCDataLib.Tables.StructureProvider.GetTableNameOfForeignKey(config.TableName, config.FieldName);
         using (ABCCommonForms.FilterBuilderForm form = new ABCCommonForms.FilterBuilderForm(strTableName))
         {
             form.SetFilterString(config.FilterString);
             if (form.ShowDialog() == DialogResult.OK)
             {
                 config.FilterString = form.FilterString;
             }
         }
     }
 }