void repositoryItemButtonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DataRow dr = ViewFieldConfig.GetDataRow(ViewFieldConfig.FocusedRowHandle); if (dr != null) { STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr); if (configInfo != null) { if (ABCDataLib.Tables.StructureProvider.IsForeignKey(configInfo.TableName, configInfo.FieldName)) { String strPKTableName = ABCDataLib.Tables.StructureProvider.GetTableNameOfForeignKey(configInfo.TableName, configInfo.FieldName); ABCCommonForms.FilterBuilderForm filterBuilder = new ABCCommonForms.FilterBuilderForm(strPKTableName); String strOldValue = ViewFieldConfig.GetRowCellValue(ViewFieldConfig.FocusedRowHandle, "FilterString").ToString(); filterBuilder.SetFilterString(strOldValue); if (filterBuilder.ShowDialog() == DialogResult.OK) { ViewFieldConfig.SetRowCellValue(ViewFieldConfig.FocusedRowHandle, "FilterString", filterBuilder.FilterString); } } } } }
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value) { IWindowsFormsEditorService svc = null; if (provider != null) { svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); } if (svc != null) { String strTableName = String.Empty; if ((context as DevExpress.XtraVerticalGrid.Data.DescriptorContext).FieldName == "FilterCondition" && context.Instance.GetType().FullName == typeof(ABCScreen.ABCBindingConfig).FullName) { //if ( Convert.ToBoolean( context.Instance.GetType().GetProperty( "IsList" ).GetValue( context.Instance , null ) )==false ) //{ // ABCHelper.ABCMessageBox.Show( "Please set IsList = true before use this function." ); // return value; //} strTableName = context.Instance.GetType().GetProperty("TableName").GetValue(context.Instance, null).ToString(); } if ((context as DevExpress.XtraVerticalGrid.Data.DescriptorContext).FieldName.EndsWith("Editor.FilterStringEx") && context.Instance.GetType().FullName.EndsWith("LookUpEdit")) { strTableName = context.Instance.GetType().GetProperty("TableName").GetValue(context.Instance, null).ToString(); String strFieldName = context.Instance.GetType().GetProperty("DataMember").GetValue(context.Instance, null).ToString(); if (DataStructureProvider.IsForeignKey(strTableName, strFieldName) == false) { return(value); } strTableName = DataStructureProvider.GetTableNameOfForeignKey(strTableName, strFieldName); } if (String.IsNullOrWhiteSpace(strTableName) == false) { using (ABCCommonForms.FilterBuilderForm form = new ABCCommonForms.FilterBuilderForm(strTableName)) { String strOld = String.Empty; if (value != null) { strOld = value.ToString(); } form.SetFilterString(strOld); if (form.ShowDialog() == DialogResult.OK) { value = form.FilterString; } } } } return(value); }
void repositoryItemButtonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { ABCBindingConfig.FieldFilterConfig data = FieldFilterGridView.GetRow(FieldFilterGridView.FocusedRowHandle) as ABCBindingConfig.FieldFilterConfig; if (data != null) { ABCCommonForms.FilterBuilderForm form = new ABCCommonForms.FilterBuilderForm(data.TableName); form.SetFilterString(data.FilterString); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { data.FilterString = form.FilterString; } } }
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; } } } }