Back to OIM Explorer

QER.Forms/QER.Forms/FormDynamicGroupMasterData.cs

Decompiler Source FileQER.Forms.FormDynamicGroupMasterDataDecompiled Source

1 extracted method/event/call references in FormDynamicGroupMasterData.

Source: F:\Claude\.tmp\oim-decompiled-full\0994_One_Identity_Manager_QER.Forms.dll\QER.Forms\FormDynamicGroupMasterData.cs

Source size: 25.818 characters

Interpretation

  • Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.

Relations

  • CallMethod: Calculate at line 360

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

  • No direct source references extracted.

Complete Source

C#733 lines
1using System;2using System.Collections;3using System.Collections.Generic;4using System.ComponentModel;5using System.Drawing;6using System.Linq;7using System.Runtime.CompilerServices;8using System.Text;9using System.Text.RegularExpressions;10using System.Windows.Forms;11using VI.AE.Forms.Base;12using VI.Base;13using VI.Common.Forms.Base;14using VI.Controls;15using VI.Controls.Design;16using VI.Controls.Interfaces;17using VI.DB;18using VI.DB.Compatibility;19using VI.DB.Entities;20using VI.DB.Sync;21using VI.FormBase;22using VI.FormBase.Tasks;23using VI.FormCustomizers;24using VI.FormTools;25using VI.ImageLibrary;26using VI.SqlWizard;27using VI.UI.Base;28using VI.UI.Base.Components;29using VI.UI.Base.Controls;30using VI.UI.Base.SnapIns;31using VI.UI.Controls.Common;32using VI.UI.Controls.QER;33using VI.UI.Controls.QER.FilterDesigner.Base;3435namespace QER.Forms;3637public class FormDynamicGroupMasterData : BaseCustomizer38{39	private bool m_WizardMode;4041	private bool m_FilterChanged;4243	private int m_IsInit;4445	private ToolTip m_ToolTip;4647	private IFilterDesignerControl m_FilterDesignerControl;4849	private ObjectKeyHelper objectKeyHelper;5051	private ChildRelationObjectEditor dialogColumnEditor;5253	private IActivatorComponent m_ChildActivatorDynamicGroupHasImmediateColumn;5455	private IActivatorComponent m_MainActivator;5657	private VI.Controls.Interfaces.IButton m_ButtonShowSql;5859	private VI.Controls.Interfaces.IButton m_ButtonShowWizard;6061	private VI.Controls.Interfaces.IButton m_ButtonSqlWizard;6263	private ICaptionLabel m_CaptionLabelWhereClause;6465	private ICheckBox m_CheckBoxIsCalculateImmediately;6667	private ICheckBox m_CheckBoxIsInactive;6869	private ICheckBox m_CheckBoxIsRecalculationDeactivated;7071	private IDBSyntaxEdit m_DBSyntaxEditWhereClause;7273	private IDynamicKeyButton m_DynamicKeyButtonObjectKeyDialogColumn;7475	private IEdit m_EditDescription;7677	private IEdit m_EditDisplayName;7879	private IEdit m_EditTestResult;8081	private INewObjectButton m_NewObjectButtonPayLoadSchedule;8283	private IRadioButton m_PlaceHolderDialogColumns;8485	private VI.Controls.Interfaces.ITabControl m_CustomTab1;8687	private VI.Controls.Interfaces.ITabPage m_TabPage_General;8889	private VI.Controls.Interfaces.ITabPage m_TabPageEnabledColumns;9091	private ITreeComboBox m_DynTreeComboBoxObjectKeyDialogColumn;9293	private ITreeComboBox m_TreeComboBoxObjectKeyBaseTree;9495	private ITreeComboBox m_TreeComboUIDDialogSchedule;9697	private ITreeComboBox m_TreeComboUIDDialogTableObjectClass;9899	private IVIPanel m_MainPanel;100101	private IVIPanel m_PanelWizardHost;102103	private IObjectChangeComponent m_ObjectChangeComponent;104105	private IObjectChangeComponent m_WhereClauseChangeComponent;106107	private StockImageComponent m_StockImageComponent;108109	private bool IsWizardSupported => AppData.Instance.AppType != AppType.Web;110111	protected override void OnInit()112	{113		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)114		//IL_02d9: Expected O, but got Unknown115		base.OnInit();116		try117		{118			m_ButtonShowSql = base.Form.GetControl<VI.Controls.Interfaces.IButton>("ButtonShowSql");119			m_ButtonShowWizard = base.Form.GetControl<VI.Controls.Interfaces.IButton>("ButtonShowWizard");120			m_ButtonSqlWizard = base.Form.GetControl<VI.Controls.Interfaces.IButton>("ButtonSqlWizard");121			m_CaptionLabelWhereClause = base.Form.GetControl<ICaptionLabel>("CaptionLabelWhereClause");122			m_CheckBoxIsCalculateImmediately = base.Form.GetControl<ICheckBox>("CheckBoxIsCalculateImmediately");123			m_CheckBoxIsInactive = base.Form.GetControl<ICheckBox>("CheckBoxIsInactive");124			m_CheckBoxIsRecalculationDeactivated = base.Form.GetControl<ICheckBox>("CheckBoxIsRecalculationDeactivated");125			m_ChildActivatorDynamicGroupHasImmediateColumn = base.Form.GetComponent<IActivatorComponent>("ChildActivatorDynamicGroupHasImmediateColumn");126			m_CustomTab1 = base.Form.GetControl<VI.Controls.Interfaces.ITabControl>("CustomTab1");127			m_DBSyntaxEditWhereClause = base.Form.GetControl<IDBSyntaxEdit>("DBSyntaxEditWhereClause");128			m_DynamicKeyButtonObjectKeyDialogColumn = base.Form.GetControl<IDynamicKeyButton>("DynamicKeyButtonObjectKeyDialogColumn");129			m_DynTreeComboBoxObjectKeyDialogColumn = base.Form.GetControl<ITreeComboBox>("DynTreeComboBoxObjectKeyDialogColumn");130			m_EditDescription = base.Form.GetControl<IEdit>("EditDescription");131			m_EditDisplayName = base.Form.GetControl<IEdit>("EditDisplayName");132			m_EditTestResult = base.Form.GetControl<IEdit>("EditTestResult");133			m_MainActivator = base.Form.GetComponent<IActivatorComponent>("MainActivator");134			m_MainPanel = base.Form.GetControl<IVIPanel>("MainPanel");135			m_NewObjectButtonPayLoadSchedule = base.Form.GetControl<INewObjectButton>("NewObjectButtonPayLoadSchedule");136			m_ObjectChangeComponent = base.Form.GetComponent<IObjectChangeComponent>("ObjectChangeComponent");137			m_PanelWizardHost = base.Form.GetControl<IVIPanel>("PanelWizardHost");138			m_PlaceHolderDialogColumns = base.Form.GetControl<IRadioButton>("PlaceHolderDialogColumns");139			m_StockImageComponent = base.Form.GetComponent<StockImageComponent>("StockImageComponent");140			m_TabPage_General = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPage_General");141			m_TabPageEnabledColumns = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPageEnabledColumns");142			m_TreeComboBoxObjectKeyBaseTree = base.Form.GetControl<ITreeComboBox>("TreeComboBoxObjectKeyBaseTree");143			m_TreeComboUIDDialogSchedule = base.Form.GetControl<ITreeComboBox>("TreeComboUIDDialogSchedule");144			m_TreeComboUIDDialogTableObjectClass = base.Form.GetControl<ITreeComboBox>("TreeComboUIDDialogTableObjectClass");145			m_WhereClauseChangeComponent = base.Form.GetComponent<IObjectChangeComponent>("WhereClauseChangeComponent");146			m_EditTestResult.Width -= 12;147			m_PanelWizardHost.Width = m_DBSyntaxEditWhereClause.Width - 12;148			string text = BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_ToolTip_ShowSql");149			string text2 = BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_ToolTip_ShowWizard");150			string text3 = BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_ToolTip_SqlWizard");151			if (AppData.Instance.AppType == AppType.Gui)152			{153				m_ToolTip = new ToolTip();154				m_ToolTip.SetToolTip(GetControl<Control>(m_ButtonShowSql), text);155				m_ToolTip.SetToolTip(GetControl<Control>(m_ButtonShowWizard), text2);156				m_ToolTip.SetToolTip(GetControl<Control>(m_ButtonSqlWizard), text3);157			}158			else159			{160				m_ButtonShowSql.Caption = text;161				m_ButtonShowWizard.Caption = text2;162				m_ButtonSqlWizard.Caption = text3;163			}164			if (!IsWizardSupported)165			{166				m_ButtonShowSql.Visible = false;167				m_ButtonShowWizard.Visible = false;168			}169			m_NewObjectButtonPayLoadSchedule.Variables["HideMinuteAndHour"] = true;170			m_NewObjectButtonPayLoadSchedule.SetUpNewObjectAction = [CompilerGenerated] (ISingleDbObject newObject) =>171			{172				newObject.SetValueSafe("UID_DialogTableBelongsTo", base.Session.MetaData().GetTable("DynamicGroup").Uid);173				newObject["UID_DialogTableBelongsTo"].CanSee = false;174			};175			objectKeyHelper = new ObjectKeyHelper(m_MainActivator, m_TreeComboBoxObjectKeyBaseTree);176			dialogColumnEditor = new ChildRelationObjectEditor(m_PlaceHolderDialogColumns.ParentControl, m_TabPageEnabledColumns, m_CheckBoxIsInactive.ParentControl, m_ChildActivatorDynamicGroupHasImmediateColumn, "DynamicGroupHasImmediateColumn", "UID_DynamicGroup", "%ObjectKeyDialogColumn%", null, new ChildRelationObjectEditorColumnDef[1]177			{178				new ChildRelationObjectEditorColumnDef("IsInActive", 0.25, null, null, ColumnWidthType.Percentaged)179			}, ColumnWidthType.Percentaged, 0.75)180			{181				CRRelationDisplay = "",182				ListHeight = 200183			};184		}185		catch (System.Exception innerException)186		{187			throw new FormCustomizerException(874825, innerException, ((object)this).ToString());188		}189	}190191	protected override void OnDispose()192	{193		base.OnDispose();194		try195		{196			ToolTip toolTip = m_ToolTip;197			if (toolTip != null)198			{199				((Component)toolTip).Dispose();200			}201			objectKeyHelper.Dispose();202		}203		catch (System.Exception innerException)204		{205			throw new FormCustomizerException(874826, innerException, ((object)this).ToString());206		}207	}208209	protected override void OnDesignChanged()210	{211		//IL_0010: Unknown result type (might be due to invalid IL or missing references)212		//IL_0020: Unknown result type (might be due to invalid IL or missing references)213		//IL_0030: Unknown result type (might be due to invalid IL or missing references)214		if (m_FilterDesignerControl != null)215		{216			m_FilterDesignerControl.BackColor = DesignColors.GetColor(DesignColor.White);217			m_FilterDesignerControl.EvenLineColor = DesignColors.ControlItemOdd;218			m_FilterDesignerControl.OddLineColor = DesignColors.ControlItemEven;219		}220	}221222	protected override void OnResetForm()223	{224		base.OnResetForm();225		try226		{227			m_EditDisplayName.Focus();228		}229		catch (System.Exception innerException)230		{231			ExceptionMgr.Instance.HandleException((System.Exception)(object)new FormCustomizerException(929002, innerException), this);232		}233	}234235	protected override void OnFormSizeChanged()236	{237		using (new UpdateHelper(m_PanelWizardHost.ParentControl, ChangeType.Layout))238		{239			FormTool.StretchControl(m_PanelWizardHost, ExtOrientation.Vertical, keepSpaceForScrollBars: true);240			FormTool.StretchControl(m_PanelWizardHost, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);241			FormTool.StretchControl(m_DBSyntaxEditWhereClause, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);242			FormTool.StretchControl(m_EditTestResult, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);243			if (m_FilterDesignerControl != null)244			{245				FormTool.StretchControl(m_FilterDesignerControl, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);246			}247			m_EditTestResult.Height = m_PanelWizardHost.Height / 2 - 5;248			m_DBSyntaxEditWhereClause.Height = m_PanelWizardHost.Height / 2 - 5;249		}250	}251252	protected override void OnFormLoad()253	{254		m_PanelWizardHost.VisibleByUser = false;255		m_DBSyntaxEditWhereClause.VisibleByUser = false;256		m_EditTestResult.VisibleByUser = false;257		m_WizardMode = false;258		m_FilterChanged = false;259		m_TabPage_General.Caption = "QER_FormCommon_General";260		m_TabPageEnabledColumns.Caption = "QER_FormDynamicGroupMasterData_ColumnsTab";261		using (new UpdateHelper(base.Tasks))262		{263			Task task = base.Tasks["TestWhereclause"];264			task.TaskMethod = Task_TestWhereclause;265			task.Caption = "QER_FormDynamicGroupMasterData_Task_TestWhereclause";266			task.StockImage = StockImage.Task;267			task.Enabled = true;268			task.Visible = true;269			Task task2 = base.Tasks["Calculate"];270			task2.TaskMethod = Task_Calculate;271			task2.Caption = "QER_FormDynamicGroupMasterData_Task_Calculate";272			task2.StockImage = StockImage.Refresh;273			task2.Enabled = false;274			task2.Visible = true;275		}276	}277278	protected override void OnFormUnload()279	{280		m_EditTestResult.Text = "";281	}282283	internal static string Test(ISingleDbObject dynGroupObject)284	{285		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)286		//IL_00ef: Expected O, but got Unknown287		if (dynGroupObject == null)288		{289			return "";290		}291		string text = dynGroupObject.GetValueSafe("UID_DialogTableObjectClass", "").ToUpperInvariant().ToLowerInvariant();292		string tablename;293		if (!(text == "qer-t-hardware"))294		{295			if (!(text == "qer-t-person"))296			{297				if (!(text == "qer-t-workdesk"))298				{299					return "";300				}301				tablename = "WorkDesk";302			}303			else304			{305				tablename = "Person";306			}307		}308		else309		{310			tablename = "Hardware";311		}312		ISqlFormatter sqlFormatter = dynGroupObject.Connection.SqlFormatter;313		string text2 = sqlFormatter.CleanWhereClause(dynGroupObject.GetValueSafe("WhereClause", ""));314		DbObjectKey dbObjectKey = new DbObjectKey(dynGroupObject.GetValue<string>("ObjectKeyBaseTree"));315		text2 = Regex.Replace(text2, "@UID_Org", sqlFormatter.FormatValue(dbObjectKey.Keys[0], ValType.String), (RegexOptions)1);316		IEntityCollection collection = dynGroupObject.Connection.Session.Source().GetCollection(Query.From(tablename).Where(text2).SelectDisplays());317		StringBuilder val = new StringBuilder();318		System.Collections.Generic.IEnumerator<IEntity> enumerator = ((System.Collections.Generic.IEnumerable<IEntity>)collection).GetEnumerator();319		try320		{321			while (((System.Collections.IEnumerator)enumerator).MoveNext())322			{323				IEntity current = enumerator.Current;324				val.Append(current.Display);325				val.Append(Environment.NewLine);326			}327		}328		finally329		{330			((System.IDisposable)enumerator)?.Dispose();331		}332		val.Append(Environment.NewLine);333		val.Append("--------------------------");334		val.Append(Environment.NewLine);335		val.Append(BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_CountResultObjects", ((System.Collections.Generic.IReadOnlyCollection<IEntity>)collection).Count.ToString()));336		return ((object)val).ToString();337	}338339	public void Task_TestWhereclause()340	{341		try342		{343			_SaveFilter();344			m_EditTestResult.Text = Test(m_MainActivator.DbObject);345		}346		catch (System.Exception innerException)347		{348			ExceptionMgr.Instance.HandleException((System.Exception)(object)new FormCustomizerException(929001, innerException, BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_Task_TestWhereclause").Replace("&", "")), this);349		}350	}351352	public void Task_Calculate()353	{354		try355		{356			_SaveFilter();357			ISingleDbObject dbObject = m_MainActivator.DbObject;358			if (dbObject != null)359			{360				dbObject.Custom.CallMethod("Calculate");361				FormTool.ShowMessage("QER_FormDynamicGroupMasterData_Message_DynGroupCalculateSucc");362			}363		}364		catch (System.Exception innerException)365		{366			ExceptionMgr.Instance.HandleException((System.Exception)(object)new FormCustomizerException(929001, innerException, BaseCustomizer.GetString("QER_FormDynamicGroupMasterData_Task_Calculate").Replace("&", "")), this);367		}368	}369370	private void _AdaptTasks()371	{372		try373		{374			ISingleDbObject dbObject = m_MainActivator.DbObject;375			m_TreeComboBoxObjectKeyBaseTree.EnabledByUser = dbObject?.GetEntity().CanEdit("ObjectKeyBaseTree") ?? false;376			m_TreeComboBoxObjectKeyBaseTree.IsMandatoryField = dbObject != null && dbObject.GetEntity().Columns["ObjectKeyBaseTree"].MinLen > 0;377			using (new UpdateHelper(base.Tasks))378			{379				base.Tasks["TestWhereclause"].Visible = dbObject != null && !m_WizardMode && dbObject.GetValueSafe("UID_DialogTableObjectClass", "") != "";380				base.Tasks["Calculate"].Enabled = dbObject?.IsLoaded ?? false;381			}382		}383		catch (System.Exception exception)384		{385			ExceptionMgr.Instance.HandleException(exception, this);386		}387	}388389	private void InitializeComponent()390	{391	}392393	private void MainActivator_OnActivating(object sender, EventArgs e)394	{395		//IL_0063: Unknown result type (might be due to invalid IL or missing references)396		//IL_006d: Expected O, but got Unknown397		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)398		m_IsInit = 0;399		try400		{401			ISingleDbObject dbObject = m_MainActivator.DbObject;402			if (dbObject == null)403			{404				return;405			}406			if (m_FilterDesignerControl == null)407			{408				ITypeMappingService typeMappingService = base.ComponentContainer.Resolve<ITypeMappingService>();409				System.Type type = typeMappingService.Resolve("UI.QER.FilterDesigner", typeMappingService.DefaultFrameWorkType);410				m_FilterDesignerControl = (IFilterDesignerControl)Activator.CreateInstance(type);411				m_FilterDesignerControl.Changed += new EventHandler(FilterDesignerControl_Changed);412				m_FilterDesignerControl.OperatorDescriptionText = LanguageManager.Instance["QER_FormDynamicGroupMasterData_OperatorDescription"];413				m_CaptionLabelWhereClause.AssociatedControl = m_FilterDesignerControl;414				((System.Collections.Generic.ICollection<IUIControl>)m_CaptionLabelWhereClause.ParentControl.SubControls).Add((IUIControl)m_FilterDesignerControl);415				Control control = GetControl<Control>(m_CaptionLabelWhereClause.ParentControl);416				if (control != null)417				{418					control.Location = new Point(0, 0);419				}420			}421			if (base.Session != null)422			{423				ISqlFormatter sqlFormatter = base.SqlFormatter;424				m_TreeComboUIDDialogSchedule.WhereClause = sqlFormatter.UidComparison("UID_DialogTableBelongsTo", base.Session.MetaData().GetTable("DynamicGroup").Uid);425				m_DynamicKeyButtonObjectKeyDialogColumn.WhereClauses["DialogColumn"] = "UID_DialogTable in (SELECT UID_DialogTable FROM DialogTable WHERE TableType NOT IN ('R','U','P'))";426			}427			_handleUIDDialogTableObjectClass();428			_PreSelectObjectClass();429			_ShowWizard(!dbObject.IsLoaded || dbObject.GetValueSafe("WhereClauseAddOn", "").Length > 0);430		}431		catch (System.Exception exception)432		{433			ExceptionMgr.Instance.HandleException(exception, this);434		}435		finally436		{437			_AdaptTasks();438		}439	}440441	protected override bool OnValidateData()442	{443		ISingleDbObject dbObject = m_MainActivator.DbObject;444		if (dbObject == null || !dbObject.GetValue<bool>("IsCalculateImmediately"))445		{446			return base.OnValidateData();447		}448		if (!Enumerable.Any<IEntity>(dialogColumnEditor.Childs, (Func<IEntity, bool>)((IEntity e) => !e.GetValue<bool>("IsInactive"))))449		{450			FormTool.ShowError("QER_FormDynamicGroupMasterData_DynamicGroupHasImmediateColumn_Error");451			return false;452		}453		return base.OnValidateData();454	}455456	private void MainActivator_Saving(object sender, EventArgs e)457	{458		_SaveFilter();459	}460461	private void MainActivator_Saved(object sender, EventArgs e)462	{463		_AdaptTasks();464	}465466	private void MainActivator_Discarded(object sender, EventArgs e)467	{468		try469		{470			_InitSqlEditor();471		}472		catch (System.Exception exception)473		{474			ExceptionMgr.Instance.HandleException(exception, this);475		}476	}477478	private void ObjectChangeComponent_ColumnValueChanged(object sender, ColumnEventArgs e)479	{480		try481		{482			if (m_MainActivator.DbObject == null)483			{484				return;485			}486			string text = e.Column.Columnname.ToLowerInvariant();487			if (!(text == "uid_dialogtableobjectclass"))488			{489				if (!(text == "objectkeybasetree"))490				{491					if (text == "iscalculateimmediately")492					{493						m_TabPageEnabledColumns.VisibleByUser = e.New.Bool;494					}495				}496				else497				{498					_handleUIDDialogTableObjectClass();499				}500			}501			else502			{503				m_ButtonSqlWizard.Enabled = !string.IsNullOrWhiteSpace(e.New.String);504			}505		}506		catch (System.Exception exception)507		{508			ExceptionMgr.Instance.HandleException(exception, this);509		}510	}511512	private void _PreSelectObjectClass()513	{514		ISingleDbObject dbObject = m_MainActivator.DbObject;515		if (dbObject != null && string.IsNullOrWhiteSpace(dbObject.GetValueSafe("ObjectKeyBaseTree", "")) && string.IsNullOrWhiteSpace(dbObject.GetValueSafe("UID_DialogTableObjectClass", "")))516		{517			dbObject.SetValueSafe("UID_DialogTableObjectClass", "QER-T-Person");518		}519	}520521	private void _handleUIDDialogTableObjectClass()522	{523		ISingleDbObject dbObject = m_MainActivator.DbObject;524		if (dbObject == null)525		{526			return;527		}528		string valueSafe = dbObject.GetValueSafe("ObjectKeyBaseTree", "");529		m_TreeComboUIDDialogTableObjectClass.EditWhereClause = string.Format(" UID_DialogTable not in (select UID_DialogTableObjectClass from DynamicGroup where {0} )", (object)base.SqlFormatter.AndRelation(base.SqlFormatter.UidComparison("ObjectKeyBaseTree", valueSafe), base.SqlFormatter.UidComparison("UID_DynamicGroup", dbObject.GetValueSafe("UID_DynamicGroup", ""), CompareOperator.NotEqual)));530		ISingleDbObject singleDbObject = null;531		if (!string.IsNullOrWhiteSpace(valueSafe))532		{533			singleDbObject = new DbObjectKey(valueSafe).GetObject(base.Session.GetConnection());534		}535		string value = ((singleDbObject == null) ? "" : singleDbObject.GetValueSafe("UID_OrgRoot", ""));536		System.Collections.Generic.IEnumerable<string> values = new string[3] { "QER-T-Person", "QER-T-Hardware", "QER-T-Workdesk" };537		if (dbObject["UID_DialogTableObjectClass"].ColDef.HasLimitedValues)538		{539			values = Enumerable.Select<LimitedValue, string>((System.Collections.Generic.IEnumerable<LimitedValue>)dbObject["UID_DialogTableObjectClass"].ColDef.LimitedValues, (Func<LimitedValue, string>)((LimitedValue l) => l.Value));540		}541		m_TreeComboUIDDialogTableObjectClass.WhereClause = base.SqlFormatter.AndRelation(base.SqlFormatter.InClause("UID_DialogTable", ValType.String, FormatterOptions.NonUnicodeLiterals, (System.Collections.IEnumerable)values), string.Format("UID_DialogTable in (\r\n\t\tselect UID_DialogTableElement from BaseTreeAssign where\r\n\t\t\tUID_BaseTreeAssign in (\r\n\t\t\t\tselect UID_BaseTreeAssign from OrgRootAssign where {0} ))", (object)base.SqlFormatter.AndRelation(base.SqlFormatter.Comparison("IsAssignmentAllowed", true, ValType.Bool), base.SqlFormatter.UidComparison("UID_OrgRoot", value))));542	}543544	private void _ShowWizard(bool showWizard)545	{546		if (!IsWizardSupported)547		{548			showWizard = false;549		}550		m_PanelWizardHost.VisibleByUser = showWizard;551		m_DBSyntaxEditWhereClause.VisibleByUser = !showWizard;552		m_EditTestResult.VisibleByUser = !showWizard;553		m_WizardMode = showWizard;554		_AdaptTasks();555		OnFormSizeChanged();556	}557558	private void _SaveFilter()559	{560		ISingleDbObject dbObject = m_MainActivator.DbObject;561		m_IsInit++;562		try563		{564			if (dbObject != null && m_FilterChanged)565			{566				dbObject.SetValueSafe("WhereClauseAddOn", ((object)m_FilterDesignerControl.Filter).ToString());567				dbObject.SetValueSafe("WhereClause", m_FilterDesignerControl.Filter.GetWhereClause(dbObject.Connection.Session));568			}569		}570		catch (System.Exception exception)571		{572			ExceptionMgr.Instance.HandleException(exception, this);573		}574		finally575		{576			m_IsInit--;577		}578	}579580	private void _InitSqlEditor()581	{582		ISingleDbObject dbObject = m_MainActivator.DbObject;583		m_IsInit++;584		try585		{586			if (dbObject == null)587			{588				return;589			}590			using (new UpdateHelper(m_FilterDesignerControl.ParentControl, ChangeType.Layout))591			{592				string valueSafe = dbObject.GetValueSafe("WhereClauseAddOn", "");593				m_FilterDesignerControl.Initialize(dbObject.Connection, (valueSafe.Length == 0) ? new Filter() : Filter.FromString(dbObject.GetValueSafe("WhereClauseAddOn", "")));594				m_FilterChanged = false;595			}596		}597		catch (System.Exception exception)598		{599			ExceptionMgr.Instance.HandleException(exception, this);600		}601		finally602		{603			m_IsInit--;604		}605	}606607	private void ButtonShowWizard_Click(object sender, EventArgs e)608	{609		try610		{611			_ShowWizard(showWizard: true);612		}613		catch (System.Exception exception)614		{615			ExceptionMgr.Instance.HandleException(exception, this);616		}617	}618619	private void ButtonShowSql_Click(object sender, EventArgs e)620	{621		try622		{623			_SaveFilter();624			_ShowWizard(showWizard: false);625		}626		catch (System.Exception exception)627		{628			ExceptionMgr.Instance.HandleException(exception, this);629		}630	}631632	private void FilterDesignerControl_Changed(object sender, EventArgs e)633	{634		if (m_IsInit <= 0)635		{636			m_FilterChanged = true;637			m_MainActivator.DataChanged("");638		}639	}640641	private void WhereClauseChangeComponent_ColumnValueChanged(object sender, ColumnEventArgs e)642	{643		try644		{645			string text = e.Column.Columnname.ToLowerInvariant();646			if (!(text == "whereclause"))647			{648				if (!(text == "whereclauseaddon"))649				{650					if (!(text == "uid_dialogtableobjectclass"))651					{652						return;653					}654					ISingleDbObject dbObject = m_MainActivator.DbObject;655					if (dbObject == null)656					{657						return;658					}659					if (string.Equals(e.New.String, "QER-T-Person", (StringComparison)5))660					{661						m_ButtonShowWizard.Enabled = true;662						_ShowWizard(!dbObject.IsLoaded || dbObject.GetValueSafe("WhereClauseAddOn", "").Length > 0);663					}664					else665					{666						m_ButtonShowWizard.Enabled = false;667						if (m_WizardMode)668						{669							_ShowWizard(showWizard: false);670						}671					}672					_AdaptTasks();673				}674				else675				{676					_InitSqlEditor();677				}678			}679			else680			{681				if (!e.Old.String.Equals(e.New.String, (StringComparison)5))682				{683					_ResetWhereClauseAddon();684				}685				_InitSqlEditor();686			}687		}688		catch (System.Exception exception)689		{690			ExceptionMgr.Instance.HandleException(exception, this);691		}692	}693694	private void _ResetWhereClauseAddon()695	{696		ISingleDbObject dbObject = m_MainActivator.DbObject;697		if (dbObject != null && m_IsInit <= 0)698		{699			if (!string.IsNullOrEmpty(dbObject.GetValueSafe("WhereClauseAddOn", "")))700			{701				FormTool.ShowMessage("QER_FormDynamicGroupMasterData_MessageWhereClauseAddonDisposed");702			}703			dbObject.SetValueSafe("WhereClauseAddOn", "");704			_ShowWizard(showWizard: false);705		}706	}707708	private void ButtonSqlWizard_Click(object sender, EventArgs e)709	{710		ButtonShowSql_Click(sender, e);711		try712		{713			ISingleDbObject dbObject = m_MainActivator.DbObject;714			if (dbObject == null)715			{716				return;717			}718			using UsiWhereClauseWizard usiWhereClauseWizard = new UsiWhereClauseWizard(base.ComponentContainer);719			usiWhereClauseWizard.Session = base.Session;720			usiWhereClauseWizard.WhereClause = dbObject["WhereClause"].New.String;721			usiWhereClauseWizard.TableName = dbObject.ObjectWalker["FK(UID_DialogTableObjectClass).TableName"].String;722			if (usiWhereClauseWizard.ShowModal() != UISnapInDialogResult.Cancel)723			{724				m_MainActivator.DbObject["WhereClause"].NewValue = usiWhereClauseWizard.WhereClause;725			}726		}727		catch (System.Exception exception)728		{729			ExceptionMgr.Instance.HandleException(exception, this);730		}731	}732}733