Back to OIM Explorer

QBM.Forms/VI.Common.Forms/FrmDialogRichMailStammdaten.cs

Decompiler Source FileQBM.Forms.FrmDialogRichMailStammdatenDecompiled Source

1 extracted method/event/call references in FrmDialogRichMailStammdaten.

Source: F:\Claude\.tmp\oim-decompiled-full\0974_One_Identity_Manager_QBM.Forms.dll\VI.Common.Forms\FrmDialogRichMailStammdaten.cs

Source size: 20.504 characters

Interpretation

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

Relations

  • CallMethod: CopyAndSave at line 188

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

  • No direct source references extracted.

C# source-derived context

Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.

reads entity values references DB/Dialog objects

Summary: classes FrmDialogRichMailStammdaten; methods OnInit, OnDispose, OnDesignChanged, InitializeComponent, OnFormLoad, OnFormSizeChanged; references DialogCountry, DialogCountryHasCulture, DialogParameter, DialogParameterSet, DialogReport, DialogRichMail; markers reads entity values, references DB/Dialog objects

Complete Source

C#524 lines
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Diagnostics;5using System.Drawing;6using System.Globalization;7using System.Linq;8using System.Windows.Forms;9using VI.Base;10using VI.Controls;11using VI.Controls.Design;12using VI.Controls.Interfaces;13using VI.DB;14using VI.DB.Compatibility;15using VI.DB.Entities;16using VI.DB.Sync;17using VI.FormBase;18using VI.FormBase.Tasks;19using VI.FormTools;20using VI.ImageLibrary;21using VI.Mail;22using VI.UI.Base.DB.Services;23using VI.UI.Base.Data.Meta;24using VI.UI.Base.SnapIns;25using VI.UI.Controls.Common;26using VI.UI.Controls.DevExpressSupport;2728namespace VI.Common.Forms;2930public class FrmDialogRichMailStammdaten : BaseCustomizer31{32	private System.DateTime m_LastLoadTime = System.DateTime.MaxValue;3334	private bool m_BodyChanged;3536	private bool m_HtmlMode;3738	private IActivatorComponent m_MainActivator;3940	private IActivatorComponent m_RichEditActivator;4142	private ICheckBox m_CheckBoxAllowUnsubscribe;4344	private ICheckBox m_CheckBoxIsInActive;4546	private IChildRelationActivator m_ChildRelationActivatorBodies;4748	private IDBSyntaxEdit m_DBSyntaxEditAttachmentFileName;4950	private IRichEditorControl m_RichEditControl;5152	private IDBSyntaxEdit m_DBSyntaxEditRichMailSubject;5354	private IEdit m_EditDescription;5556	private IEdit m_EditIdentDialogRichMail;5758	private IFormDialogComponent m_FormDialogComponent;5960	private ITextComboBox m_TextComboBoxImportance;6162	private ITextComboBox m_TextComboBoxMailDesignType;6364	private ITextComboBox m_TextComboBoxSensitivity;6566	private ITextComboBox m_TextComboBoxTargetFormat;6768	private ITreeComboBox m_TreeComboBoxUIDDialogParameterSet;6970	private ITreeComboBox m_TreeComboUIDDialogCulture;7172	private ITreeComboBox m_TreeComboUIDDialogTableBaseObject;7374	private IVIPanel m_MainPanel;7576	private IObjectChangeComponent m_MailBodyChangeComponent;7778	private IObjectChangeComponent m_ObjectChangeComponent;7980	private VI.Controls.Interfaces.ITabPage m_TabPageGeneral;8182	private VI.Controls.Interfaces.ITabPage m_TabPageBody;8384	protected override void OnInit()85	{86		m_CheckBoxAllowUnsubscribe = base.Form.GetControl<ICheckBox>("CheckBoxAllowUnsubscribe");87		m_CheckBoxIsInActive = base.Form.GetControl<ICheckBox>("CheckBoxIsInActive");88		m_ChildRelationActivatorBodies = base.Form.GetControl<IChildRelationActivator>("ChildRelationActivatorBodies");89		m_DBSyntaxEditAttachmentFileName = base.Form.GetControl<IDBSyntaxEdit>("DBSyntaxEditAttachmentFileName");90		m_RichEditControl = base.Form.GetControl<IRichEditorControl>("EditRichMailBody");91		m_DBSyntaxEditRichMailSubject = base.Form.GetControl<IDBSyntaxEdit>("DBSyntaxEditRichMailSubject");92		m_EditDescription = base.Form.GetControl<IEdit>("EditDescription");93		m_EditIdentDialogRichMail = base.Form.GetControl<IEdit>("EditIdentDialogRichMail");94		m_FormDialogComponent = base.Form.GetComponent<IFormDialogComponent>("FormDialogComponent");95		m_MailBodyChangeComponent = base.Form.GetComponent<IObjectChangeComponent>("MailBodyChangeComponent");96		m_MainActivator = base.Form.GetComponent<IActivatorComponent>("MainActivator");97		m_MainPanel = base.Form.GetControl<IVIPanel>("MainPanel");98		m_ObjectChangeComponent = base.Form.GetComponent<IObjectChangeComponent>("ObjectChangeComponent");99		m_RichEditActivator = base.Form.GetComponent<IActivatorComponent>("RichEditActivator");100		m_TextComboBoxImportance = base.Form.GetControl<ITextComboBox>("TextComboBoxImportance");101		m_TextComboBoxMailDesignType = base.Form.GetControl<ITextComboBox>("TextComboBoxMailDesignType");102		m_TextComboBoxSensitivity = base.Form.GetControl<ITextComboBox>("TextComboBoxSensitivity");103		m_TextComboBoxTargetFormat = base.Form.GetControl<ITextComboBox>("TextComboBoxTargetFormat");104		m_TreeComboBoxUIDDialogParameterSet = base.Form.GetControl<ITreeComboBox>("TreeComboBoxUIDDialogParameterSet");105		m_TreeComboUIDDialogCulture = base.Form.GetControl<ITreeComboBox>("TreeComboUIDDialogCulture");106		m_TreeComboUIDDialogTableBaseObject = base.Form.GetControl<ITreeComboBox>("TreeComboUIDDialogTableBaseObject");107		m_TabPageGeneral = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPageGeneral");108		m_TabPageBody = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPageBody");109	}110111	protected override void OnDispose()112	{113		m_RichEditControl.IntelliBase = null;114		base.OnDispose();115	}116117	protected override void OnDesignChanged()118	{119		//IL_0008: Unknown result type (might be due to invalid IL or missing references)120		m_RichEditControl.BackColor = DesignColors.GetColor(DesignColor.White);121	}122123	private void InitializeComponent()124	{125	}126127	protected override void OnFormLoad()128	{129		m_TabPageGeneral.Caption = "QBM_FormDialogRichMailMasterData_Caption_TabPageGeneral";130		m_TabPageBody.Caption = "QBM_FormDialogRichMailMasterData_Caption_TabPageBody";131		m_RichEditControl.IntelliBase = null;132		m_RichEditControl.Tag = null;133		m_HtmlMode = false;134		_AdapteTargetFormat(m_HtmlMode);135		using (new UpdateHelper(base.Tasks))136		{137			Task task = base.Tasks["Copy"];138			task.TaskMethod = Task_Copy;139			task.Caption = "QBM_FrmDialogRichMailStammdaten_Task_CopyMail";140			task.StockImage = StockImage.Copy;141			task.Visible = false;142			Task task2 = base.Tasks["Preview"];143			task2.TaskMethod = Task_Preview;144			task2.Caption = "QBM_FrmDialogRichMailStammdaten_Task_PreviewMail";145			task2.StockImage = StockImage.Copy;146			task2.IsGuiTask = true;147			task2.Visible = true;148		}149	}150151	protected override void OnFormSizeChanged()152	{153		//IL_000e: Unknown result type (might be due to invalid IL or missing references)154		//IL_0013: Unknown result type (might be due to invalid IL or missing references)155		FormTool.StretchControl(m_RichEditControl, ExtOrientation.Both, keepSpaceForScrollBars: true, new Size(920, 0), Size.Empty);156		FormTool.StretchControl(m_DBSyntaxEditRichMailSubject, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);157	}158159	public void Task_Copy()160	{161		//IL_0088: Unknown result type (might be due to invalid IL or missing references)162		try163		{164			ISingleDbObject dbObject = m_MainActivator.DbObject;165			if (dbObject == null)166			{167				return;168			}169			Dictionary<string, object> parameters = new Dictionary<string, object>170			{171				["DialogPrefix_Prefix"] = "Copy_" + dbObject["Ident_DialogRichMail"].New.String,172				["DialogPrefix_PrefixCaption"] = BaseCustomizer.GetString("QBM_FrmDialogRichMailStammdaten_Caption_CopyName")173			};174			string ident;175			do176			{177				if (FormTool.ShowForm(base.ComponentContainer, m_FormDialogComponent, m_MainPanel, "FormPrefixDialog", "QBM_QBMPrefix_Dialog", dbObject, BaseCustomizer.GetString("QBM_FrmDialogRichMailStammdaten_Task_CopyMail"), UISnapInDialogButtons.OkCancel, (IReadOnlyDictionary<string, object>)(object)parameters).Item1 != UISnapInResultOption.Ok)178				{179					return;180				}181				ident = (base.Session.Variables["DialogPrefix_Prefix"] as string) ?? "";182				if (ident.Length == 0)183				{184					FormTool.ShowMessage("QBM_FrmDialogRichMailStammdaten_Message_PleaseInputAName");185				}186			}187			while (ident.Length == 0);188			dbObject.Custom.CallMethod("CopyAndSave", ident);189			Query query = (from t in Query.From("DialogRichMail")190				where t.Column("Ident_DialogRichMail") == ident191				select t).SelectNonLobs();192			if (base.Session.Source().TryGet(query, EntityLoadType.Interactive, out var entity))193			{194				NavigateTo(entity.CreateSingleDbObject(base.Session));195			}196		}197		finally198		{199			base.Session?.Variables.Remove("DialogPrefix_Prefix");200		}201	}202203	public void Task_Preview()204	{205		//IL_0042: Unknown result type (might be due to invalid IL or missing references)206		//IL_0048: Invalid comparison between Unknown and I4207		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)208		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)209		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)210		//IL_010d: Unknown result type (might be due to invalid IL or missing references)211		//IL_014b: Unknown result type (might be due to invalid IL or missing references)212		//IL_0150: Unknown result type (might be due to invalid IL or missing references)213		//IL_015c: Expected O, but got Unknown214		ISingleDbObject dbObject = m_MainActivator.DbObject;215		ISingleDbObject activeChild = m_ChildRelationActivatorBodies.ActiveChild;216		if (dbObject == null || activeChild == null || activeChild.IsDeleted || ((m_BodyChanged || !dbObject.IsLoaded) && (int)FormTool.ShowQuestion("QBM_FrmDialogRichMailStammdaten_Message_Question_SaveMailBody", (MessageBoxButtons)4) != 6))217		{218			return;219		}220		using (TransactionList transactionList = new TransactionList())221		{222			transactionList.Add(dbObject);223			transactionList.Add(base.Session);224			m_MainActivator.SaveToDatabase(autoReload: true);225			_SaveMailBody(saveDeleted: false);226			transactionList.Commit();227		}228		string text = dbObject.ObjectWalker["FK(UID_DialogTableBaseObject).TableName"].String;229		if (!string.IsNullOrEmpty(text))230		{231			Dictionary<string, object> parameters = new Dictionary<string, object> { ["BaseTablename"] = text };232			ValueTuple<UISnapInResultOption, object> val = FormTool.ShowForm(base.ComponentContainer, m_FormDialogComponent, m_MainPanel, "FrmDialogRichMailPreviewSelectBaseObject", "QBM_DialogRichMailPreviewSelectBaseObject", dbObject, BaseCustomizer.GetString("QBM_FrmDialogRichMailStammdaten_PleaseSelectBaseObject"), UISnapInDialogButtons.OkCancel, (IReadOnlyDictionary<string, object>)(object)parameters);233			if (val.Item1 == UISnapInResultOption.Ok)234			{235				_SaveMailBody(saveDeleted: false);236				MailComposer mailComposer = new MailComposer(base.Session);237				ISingleDbObject singleDbObject = (ISingleDbObject)val.Item2;238				Process.Start(new ProcessStartInfo(mailComposer.CreatePreview(culture: CultureInfo.GetCultureInfo(activeChild.ObjectWalker["FK(UID_DialogCulture).Ident_DialogCulture"].String), richMail: dbObject.GetEntity(), baseObject: singleDbObject.GetEntity()))239				{240					UseShellExecute = true241				});242			}243		}244	}245246	private void MainActivator_OnActivating(object sender, EventArgs e)247	{248		if (m_MainActivator.DbObject == null)249		{250			return;251		}252		try253		{254			m_LastLoadTime = System.DateTime.MaxValue;255			m_BodyChanged = false;256			m_HtmlMode = false;257			_AdapteTargetFormat(m_HtmlMode);258			m_RichEditControl.Tag = null;259			m_TreeComboBoxUIDDialogParameterSet.WhereClause = string.Format("\r\n                    UID_DialogParameterSet in\r\n                    (\r\n\t                    select UID_DialogParameterSet from DialogParameterSet dps\r\n\t\t                    join DialogReport dr on dr.XObjectKey = dps.ObjectKeyUsedBy and {0}\r\n\r\n\t                    union all\r\n\r\n\t                    select dps.UID_DialogParameterSet from DialogParameterSet dps\r\n\t\t                    join DialogParameterSet dpsp on dps.UID_DialogParameterSetParent = dpsp.UID_DialogParameterSet\r\n\t\t                    join DialogReport dr on dr.XObjectKey = dpsp.ObjectKeyUsedBy and {0}\r\n\r\n\t                    union all\r\n\r\n\t                    select dps.UID_DialogParameterSet from DialogParameterSet dps\r\n\t\t                    join DialogParameterSet dpsp on dps.UID_DialogParameterSetParent = dpsp.UID_DialogParameterSet\r\n\t\t                    join DialogParameterSet dpsp2 on dpsp.UID_DialogParameterSetParent = dpsp2.UID_DialogParameterSet\r\n\t\t                    join DialogReport dr on dr.XObjectKey = dpsp2.ObjectKeyUsedBy and {0}\r\n                    )", (object)"1=1");260			m_TreeComboUIDDialogTableBaseObject.WhereClause = base.SqlFormatter.Comparison("IsDeactivatedByPreprocessor", false, ValType.Bool);261			_FilterCultures();262		}263		finally264		{265			_AdaptTasks();266		}267	}268269	private void _AdaptTasks()270	{271		using (new UpdateHelper(base.Tasks))272		{273			ISingleDbObject dbObject = m_MainActivator.DbObject;274			ISingleDbObject activeChild = m_ChildRelationActivatorBodies.ActiveChild;275			base.Tasks["Copy"].Visible = dbObject != null && !m_MainActivator.IsChanged;276			base.Tasks["Preview"].Enabled = dbObject != null && activeChild != null && !activeChild.IsDeleted;277		}278	}279280	private void _LoadRichEdit()281	{282		//IL_004b: Unknown result type (might be due to invalid IL or missing references)283		//IL_0051: Unknown result type (might be due to invalid IL or missing references)284		m_BodyChanged = false;285		ISingleDbObject dbObject = m_RichEditActivator.DbObject;286		if (dbObject == null)287		{288			m_RichEditControl.Document.Text = "";289			return;290		}291		m_LastLoadTime = System.DateTime.Now;292		m_RichEditControl.LoadFromDatabase(base.Session, dbObject.GetEntity());293		m_RichEditControl.Tag = dbObject;294	}295296	private void _FilterCultures()297	{298		List<string> usedCultures = new List<string>();299		m_ChildRelationActivatorBodies.PreSelect(delegate(IValueProvider vp)300		{301			ISingleDbObject singleDbObject = (vp as ISingleDbObject) ?? (vp as IColElem)?.Create();302			if (singleDbObject != null)303			{304				usedCultures.Add(singleDbObject.GetValue("UID_DialogCulture").String);305			}306			return false;307		});308		string text = string.Format("UID_DialogCulture\r\n                        in\r\n                        (\r\n                            select UID_DialogCulture from DialogCountryHasCulture\r\n                            where UID_DialogCountry\r\n                                    in\r\n                                    (\r\n                                        select UID_DialogCountry from DialogCountry\r\n                                        where {0}\r\n                                    )\r\n                        )", (object)base.SqlFormatter.Comparison("IsInUse", true, ValType.Bool));309		string text2 = ((usedCultures.Count == 0) ? "" : ("not " + base.SqlFormatter.InClause("UID_DialogCulture", ValType.String, FormatterOptions.NonUnicodeLiterals, Enumerable.ToArray<object>(Enumerable.Cast<object>((System.Collections.IEnumerable)usedCultures)))));310		m_TreeComboUIDDialogCulture.WhereClause = base.SqlFormatter.AndRelation(text, text2);311	}312313	private void RichEditActivator_Activated(object sender, EventArgs e)314	{315		try316		{317			_LoadRichEdit();318			_FilterCultures();319		}320		catch (System.Exception exception)321		{322			ExceptionMgr.Instance.HandleException(exception, this);323		}324	}325326	private void RichEditActivator_Discarded(object sender, EventArgs e)327	{328		try329		{330			_LoadRichEdit();331		}332		catch (System.Exception exception)333		{334			ExceptionMgr.Instance.HandleException(exception, this);335		}336	}337338	private void RichEditActivator_Saving(object sender, EventArgs e)339	{340		_SaveMailBody(saveDeleted: true);341	}342343	private void _SaveMailBody(bool saveDeleted)344	{345		//IL_005e: Unknown result type (might be due to invalid IL or missing references)346		//IL_0064: Unknown result type (might be due to invalid IL or missing references)347		m_BodyChanged = false;348		if (m_HtmlMode && m_RichEditControl?.Tag is ISingleDbObject singleDbObject && singleDbObject["RichMailBody"].CanEdit && (saveDeleted || !singleDbObject.IsDeleted))349		{350			m_RichEditControl.SaveToDatabase(base.Session, singleDbObject.GetEntity());351			if (!singleDbObject.IsLoaded)352			{353				singleDbObject.Load();354			}355		}356	}357358	private void MailBodyChangeComponent_ColumnRightsChanged(object sender, ColumnEventArgs e)359	{360		try361		{362			if (e.Column.Columnname.ToLowerInvariant() == "richmailbody")363			{364				m_RichEditControl.ReadOnly = !e.Column.CanEdit;365			}366		}367		catch (System.Exception exception)368		{369			ExceptionMgr.Instance.HandleException(exception, this);370		}371	}372373	private void RichEditControl_ContentChanged(object sender, EventArgs e)374	{375		//IL_000e: Unknown result type (might be due to invalid IL or missing references)376		//IL_0013: Unknown result type (might be due to invalid IL or missing references)377		try378		{379			TimeSpan val = System.DateTime.Now.Subtract(m_LastLoadTime);380			if (((TimeSpan)(ref val)).TotalMilliseconds > 3000.0)381			{382				m_MainActivator.DataChanged("");383				m_BodyChanged = true;384			}385		}386		catch387		{388		}389	}390391	private void ObjectChangeComponent_ColumnValueChanged(object sender, ColumnEventArgs e)392	{393		//IL_006d: Unknown result type (might be due to invalid IL or missing references)394		//IL_0073: Unknown result type (might be due to invalid IL or missing references)395		//IL_012d: Unknown result type (might be due to invalid IL or missing references)396		//IL_0133: Invalid comparison between Unknown and I4397		try398		{399			if (base.Session == null)400			{401				return;402			}403			string text = e.Column.Columnname.ToLowerInvariant();404			if (!(text == "uid_dialogtablebaseobject"))405			{406				if (!(text == "targetformat"))407				{408					return;409				}410				bool flag = e.Column.New.String.ToLowerInvariant() == "html";411				if (flag != m_HtmlMode)412				{413					if (flag)414					{415						_LoadRichEdit();416					}417					else if (m_BodyChanged && (int)FormTool.ShowQuestion("QBM_FrmDialogRichMailStammdaten_Message_Question_SaveMailBody", (MessageBoxButtons)4) == 6)418					{419						_SaveMailBody(saveDeleted: false);420					}421					_AdapteTargetFormat(flag);422					m_HtmlMode = flag;423				}424				return;425			}426			string name = m_MainActivator.DbObject.ObjectWalker["FK(UID_DialogTableBaseObject).TableName"].String;427			IMetaType metaType = DatabaseMetaModelService.GetOrCreate(base.Session).GetDatabaseModel().Types[name, false];428			m_RichEditControl.IntelliBase = metaType;429			IEditControl[] array = new IEditControl[2]430			{431				GetControl<IEditControl>(m_DBSyntaxEditRichMailSubject),432				GetControl<IEditControl>(m_DBSyntaxEditAttachmentFileName)433			};434			foreach (IEditControl editControl in array)435			{436				if (editControl != null)437				{438					editControl.IntelliSense.BaseType = metaType;439				}440			}441		}442		catch (System.Exception exception)443		{444			ExceptionMgr.Instance.HandleException(exception, this);445		}446	}447448	private void _AdapteTargetFormat(bool htmlMode)449	{450		m_RichEditControl.Visible = htmlMode;451		OnFormSizeChanged();452	}453454	private void MainActivator_Saved(object sender, EventArgs e)455	{456		_AdaptTasks();457	}458459	private void MainActivator_Discarded(object sender, EventArgs e)460	{461		_AdaptTasks();462	}463464	private void MainActivator_Activated(object sender, EventArgs e)465	{466		if (m_MainActivator.DbObject == null)467		{468			return;469		}470		try471		{472			string defaultculture = base.Session.Config().GetConfigParm("Common\\MailNotification\\DefaultCulture");473			if (!string.IsNullOrEmpty(defaultculture))474			{475				base.Session.Source().TryGetSingleValue<string>((from c in Query.From("QBMCulture")476					where c.Column("Ident_DialogCulture") == defaultculture477					select c).Select("UID_DialogCulture"), out var uidDialogCulture);478				if (string.IsNullOrEmpty(uidDialogCulture))479				{480					return;481				}482				m_ChildRelationActivatorBodies.PreSelect((IValueProvider vp) => vp.GetValue("UID_DialogCulture").String.Equals(uidDialogCulture, (StringComparison)5));483			}484			if (m_ChildRelationActivatorBodies.CountChildren == 1 && m_ChildRelationActivatorBodies.ActiveChild == null)485			{486				m_ChildRelationActivatorBodies.PreSelect((IValueProvider vp) => true);487			}488		}489		catch490		{491		}492	}493494	private void ChildRelationActivatorBodies_ActiveChildChanging(object sender, ChildRelationActivatorEventArgs e)495	{496		//IL_003d: Unknown result type (might be due to invalid IL or missing references)497		//IL_0043: Invalid comparison between Unknown and I4498		try499		{500			ISingleDbObject activeChild = m_ChildRelationActivatorBodies.ActiveChild;501			if (m_HtmlMode && activeChild != null && m_BodyChanged && !activeChild.IsDeleted && e.ChildChangeReason != ChildRelationActivatorChildChangeReason.ChildDeleted && (int)FormTool.ShowQuestion("QBM_FrmDialogRichMailStammdaten_Message_Question_SaveMailBody", (MessageBoxButtons)4) == 6)502			{503				_SaveMailBody(saveDeleted: false);504			}505		}506		catch (System.Exception exception)507		{508			ExceptionMgr.Instance.HandleException(exception, this);509		}510	}511512	private void ChildRelationActivatorBodies_ActiveChildChanged(object sender, ChildRelationActivatorEventArgs e)513	{514		try515		{516			_AdaptTasks();517		}518		catch (System.Exception exception)519		{520			ExceptionMgr.Instance.HandleException(exception, this);521		}522	}523}524