RPS.Forms/RPS.Forms/FormRPSReportMasterData.cs
Decompiler Source FileRPS.Forms.FormRPSReportMasterDataDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- CallMethod: CreateParameterSet at line 296
- CallMethod: CreateParameterSet at line 413
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 writes entity values references DB/Dialog objects IT Shop related markers
Summary: classes FormRPSReportMasterData; methods OnInit, OnDesignChanged, InitializeComponent, OnFormLoad, OnFormSizeChanged, Task_Preview; references AccProduct, DialogParameter, DialogParameterSet, DialogReport, Person, RPSReport; markers reads entity values, writes entity values, references DB/Dialog objects, IT Shop related markers
Classes
FormRPSReportMasterDataMethods
- OnInit
- OnDesignChanged
- InitializeComponent
- OnFormLoad
- OnFormSizeChanged
- Task_Preview
- MainActivator_OnActivating
- _SetupExportFormat
- _GetRPSReportParameterSet
- _ClearParameters
- _LoadParameter
- EnableParameterCreationControlsConditional
- MainActivator_Saving
- MainActivator_Saved
- MainActivator_Discarded
- AdaptTreeComboDialogReport
- ObjectChangeComponent_ObjectEventOccurred
- ObjectChangeComponent_ColumnValueChanged
- ObjectChangeComponent_ColumnRightsChanged
- _AdaptTask
- TreeListParameters_SelectedNodeChanged
- BitMaskComboExportFormat_BitMaskChanged
- GetNewParameterName
- ButtonAddParameter_Click
- ButtonRemoveParameter_Click
- IsDeleteParameterAllowed
- ParameterName_ValueChanged
DB/Dialog object references
OIM key/entity markers
UID_DialogReport XObjectKey ObjectKeyUsedBy UID_DialogParameterSetParent UID_DialogParameterSetAPI/entity calls
CreateSingle CreateNew GetValue PutValue Source AndRelation Comparison IsModuleOwner MetaData UidComparison From MarkForDeletion SaveRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Linq;5using System.Windows.Forms;6using VI.Base;7using VI.Common.Forms.Base;8using VI.Controls;9using VI.Controls.Design;10using VI.Controls.Interfaces;11using VI.DB;12using VI.DB.Entities;13using VI.DB.MetaData;14using VI.DB.Sync;15using VI.FormBase;16using VI.FormBase.Tasks;17using VI.FormTools;18using VI.ImageLibrary;19using VI.UI.Base;20using VI.UI.Base.Components;21using VI.UI.Base.Controls;22using VI.UI.Base.Data.Entities;23using VI.UI.Base.Images;24using VI.UI.Base.IoC;25using VI.UI.Base.SnapIns;26using VI.UI.Controls.Common;27using VI.UI.Controls.QBM;2829namespace RPS.Forms;3031public class FormRPSReportMasterData : BaseCustomizer32{33 private int m_Activating;3435 private bool _saving;3637 private DialogParameterSet _currentRPSReportParameterSet;3839 private DialogParameterSet _currentDialogReportParameterSet;4041 private UsiDialogParameter m_DialogParameterUsi;4243 private IUIControl m_DialogParameterUsiControl;4445 private readonly List<IParameter> _paramsToDelete = new List<IParameter>();4647 private IActivatorComponent m_HelpActivator;4849 private IActivatorComponent m_MainActivator;5051 private IBitMaskComboBox m_BitMaskComboExportFormat;5253 private VI.Controls.Interfaces.IButton m_ButtonAddParameter;5455 private VI.Controls.Interfaces.IButton m_ButtonRemoveParameter;5657 private ICheckBox m_CheckBoxIsDeactivatedByPreProcessor;5859 private ICheckBox m_CheckBoxIsForITShop;6061 private ICheckBox m_CheckBoxIsInactive;6263 private ICheckBox m_CheckBoxIsITShopOnly;6465 private ICheckBox m_CheckBoxIsListReport;6667 private IDBSyntaxEdit m_EditReportDefinition;6869 private IEdit m_EditDescription;7071 private IEdit m_EditIdentRPSReport;7273 private IEdit m_EditPreProcessorCondition;7475 private INetLabel m_LabelSaveHint;7677 private INewObjectButton m_NewObjectButtonAccProduct;7879 private VI.Controls.Interfaces.ITabControl m_TabControl;8081 private VI.Controls.Interfaces.ITabPage m_TabPageGeneral;8283 private VI.Controls.Interfaces.ITabPage m_TabPageParameters;8485 private ITrackBar m_TrackBarRiskIndex;8687 private ITreeComboBox m_TreeComboBoxUIDAccProduct;8889 private ITreeComboBox m_TreeComboUIDDialogReport;9091 private ITreeComboBox m_TreeComboUIDPersonOwner;9293 private VI.Controls.Interfaces.ITreeListControl m_TreeListParameters;9495 private IVIPanel m_MainPanel;9697 private IObjectChangeComponent m_ObjectChangeComponent;9899 protected override void OnInit()100 {101 m_BitMaskComboExportFormat = base.Form.GetControl<IBitMaskComboBox>("BitMaskComboExportFormat");102 m_ButtonAddParameter = base.Form.GetControl<VI.Controls.Interfaces.IButton>("ButtonAddParameter");103 m_ButtonRemoveParameter = base.Form.GetControl<VI.Controls.Interfaces.IButton>("ButtonRemoveParameter");104 m_CheckBoxIsDeactivatedByPreProcessor = base.Form.GetControl<ICheckBox>("CheckBoxIsDeactivatedByPreProcessor");105 m_CheckBoxIsForITShop = base.Form.GetControl<ICheckBox>("CheckBoxIsForITShop");106 m_CheckBoxIsInactive = base.Form.GetControl<ICheckBox>("CheckBoxIsInactive");107 m_CheckBoxIsITShopOnly = base.Form.GetControl<ICheckBox>("CheckBoxIsITShopOnly");108 m_CheckBoxIsListReport = base.Form.GetControl<ICheckBox>("CheckBoxIsListReport");109 m_EditDescription = base.Form.GetControl<IEdit>("EditDescription");110 m_EditIdentRPSReport = base.Form.GetControl<IEdit>("EditIdentRPSReport");111 m_EditPreProcessorCondition = base.Form.GetControl<IEdit>("EditPreProcessorCondition");112 m_EditReportDefinition = base.Form.GetControl<IDBSyntaxEdit>("EditReportDefinition");113 m_HelpActivator = base.Form.GetComponent<IActivatorComponent>("HelpActivator");114 m_LabelSaveHint = base.Form.GetControl<INetLabel>("LabelSaveHint");115 m_MainActivator = base.Form.GetComponent<IActivatorComponent>("MainActivator");116 m_MainPanel = base.Form.GetControl<IVIPanel>("MainPanel");117 m_NewObjectButtonAccProduct = base.Form.GetControl<INewObjectButton>("NewObjectButtonAccProduct");118 m_ObjectChangeComponent = base.Form.GetComponent<IObjectChangeComponent>("ObjectChangeComponent");119 m_TabControl = base.Form.GetControl<VI.Controls.Interfaces.ITabControl>("TabControl");120 m_TabPageGeneral = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPageGeneral");121 m_TabPageParameters = base.Form.GetControl<VI.Controls.Interfaces.ITabPage>("TabPageParameters");122 m_TrackBarRiskIndex = base.Form.GetControl<ITrackBar>("TrackBarRiskIndex");123 m_TreeComboBoxUIDAccProduct = base.Form.GetControl<ITreeComboBox>("TreeComboBoxUIDAccProduct");124 m_TreeComboUIDDialogReport = base.Form.GetControl<ITreeComboBox>("TreeComboUIDDialogReport");125 m_TreeComboUIDPersonOwner = base.Form.GetControl<ITreeComboBox>("TreeComboUIDPersonOwner");126 m_TreeListParameters = base.Form.GetControl<VI.Controls.Interfaces.ITreeListControl>("TreeListParameters");127 m_TreeListParameters.ImageList = StockImageList.Small;128 CommonTools.SetProperty(m_TreeListParameters, "ImageNameList", ImageHost.StockImageNameListSmall);129 m_TreeListParameters.AlternateNodeBackground = true;130 m_TreeListParameters.Proxy.SelectedNodeChanged += TreeListParameters_SelectedNodeChanged;131 ITypeMappingService typeMappingService = IoCDefaults.DefaultContainer.Resolve<ITypeMappingService>(throwEx: true);132 m_DialogParameterUsi = (UsiDialogParameter)Activator.CreateInstance(typeMappingService.Resolve("SnapIn.DialogParameter", typeMappingService.DefaultFrameWorkType), new object[1] { IoCDefaults.DefaultContainer });133 m_DialogParameterUsiControl = (IUIControl)m_DialogParameterUsi.GetOrCreateControl(typeMappingService.DefaultFrameWorkType);134 ((System.Collections.Generic.ICollection<IUIControl>)m_TreeListParameters.ParentControl.SubControls).Add(m_DialogParameterUsiControl);135 m_DialogParameterUsi.AsDataEditorControl().Controller = GetControl<VI.UI.Controls.Common.ITabPage>(m_TabPageParameters);136 m_ButtonRemoveParameter.Enabled = false;137 m_EditReportDefinition.Height = 150;138 }139140 protected override void OnDesignChanged()141 {142 //IL_0008: Unknown result type (might be due to invalid IL or missing references)143 //IL_0018: Unknown result type (might be due to invalid IL or missing references)144 m_LabelSaveHint.BackColor = DesignColors.GetColor(DesignColor.White);145 m_LabelSaveHint.ForeColor = DesignColors.ControlText;146 }147148 private void InitializeComponent()149 {150 }151152 protected override void OnFormLoad()153 {154 m_TabPageGeneral.Caption = "RPS_FormCommon_General";155 m_TabPageParameters.Caption = "RPS_FormRPSReportMasterData_TabPage_Parameters";156 m_LabelSaveHint.Text = BaseCustomizer.GetString("RPS_FormRPSReportMasterData_Message_HintSaveFirst");157 m_ButtonAddParameter.Caption = BaseCustomizer.GetString("RPS_FormRPSReportMasterData_btnAdd");158 m_ButtonRemoveParameter.Caption = BaseCustomizer.GetString("RPS_FormRPSReportMasterData_btnRemove");159 using (new UpdateHelper(base.Tasks))160 {161 Task task = base.Tasks["Preview"];162 task.TaskMethod = Task_Preview;163 task.Caption = "RPS_FormRPSReportMasterData_Task_ReportPreview";164 task.StockImage = StockImage.Report;165 task.Enabled = false;166 task.Visible = true;167 }168 }169170 protected override void OnFormSizeChanged()171 {172 base.OnFormSizeChanged();173 m_TreeListParameters.Height = 140;174 FormTool.StretchControl(m_TreeListParameters, ExtOrientation.Horizontal, keepSpaceForScrollBars: true);175 FormTool.StretchControl(m_DialogParameterUsiControl, ExtOrientation.Both, keepSpaceForScrollBars: true);176 }177178 public void Task_Preview()179 {180 ISingleDbObject dbObject = m_MainActivator.DbObject;181 if (dbObject == null)182 {183 return;184 }185 DialogParameterSet parentSet;186 DialogParameterSet dialogParameterSet = _GetRPSReportParameterSet(out parentSet);187 if (dialogParameterSet != null)188 {189 string valueSafe = dbObject.GetValueSafe("UID_DialogReport", "");190 if (!string.IsNullOrEmpty(valueSafe))191 {192 ISingleDbObject dbObject2 = base.Session.Resolve<IConnection>().CreateSingle("DialogReport", valueSafe);193 IVarContext varContext = new VarContext();194 varContext["ParameterSet"] = dialogParameterSet;195 varContext.Put("RPSReportObjectKey", dbObject.GetValueSafe("XObjectKey", string.Empty));196 varContext.Put("ReportAlias", dbObject.GetValueSafe("Ident_RPSReport", string.Empty));197 NavigateTo(dbObject2, "VI_System_DialogReport_ViewReport", varContext, openInNewTab: true);198 }199 }200 }201202 private void MainActivator_OnActivating(object sender, EventArgs e)203 {204 ISingleDbObject dbObject = m_MainActivator.DbObject;205 if (dbObject != null)206 {207 _saving = false;208 m_DialogParameterUsi.Bind(base.Session.Source().CreateNew("DialogParameter", EntityCreationType.Interactive).ToUIEntity(base.Session), new UISnapIn.BindArgs());209 m_DialogParameterUsi.EnabledByUser = false;210 m_LabelSaveHint.Visible = !dbObject.IsLoaded;211 m_TreeComboUIDDialogReport.WhereClause = base.SqlFormatter.AndRelation(base.SqlFormatter.Comparison("IsDeactivatedByPreProcessor", false, ValType.Bool), "NOT " + base.SqlFormatter.IsModuleOwner("UID_DialogReport", "QBM"));212 _SetupExportFormat();213 AdaptTreeComboDialogReport();214 }215 }216217 private void _SetupExportFormat()218 {219 //IL_007b: Unknown result type (might be due to invalid IL or missing references)220 //IL_0080: Unknown result type (might be due to invalid IL or missing references)221 if (base.Session == null)222 {223 return;224 }225 m_BitMaskComboExportFormat.Caption = base.Session.MetaData().GetTable("RPSReport").Columns["ExportFormat"].Display.Translated;226 IMetaColumn metaColumn = base.Session.MetaData().GetTable("RPSSubscription").Columns["ExportFormat"];227 ((CollectionBase)m_BitMaskComboExportFormat.BitPositions).Clear();228 Enumerator<LimitedValue> enumerator = ((List<LimitedValue>)(object)metaColumn.LimitedValues).GetEnumerator();229 try230 {231 while (enumerator.MoveNext())232 {233 LimitedValue current = enumerator.Current;234 m_BitMaskComboExportFormat.BitPositions.Add(new BitMaskItemCollection.BitMaskItem(current.Description, useBit: true, current.Value));235 }236 }237 finally238 {239 ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();240 }241 }242243 private DialogParameterSet _GetRPSReportParameterSet(out DialogParameterSet parentSet)244 {245 parentSet = null;246 ISingleDbObject dbObject = m_MainActivator.DbObject;247 if (dbObject == null)248 {249 return null;250 }251 ISqlFormatter sqlFormatter = base.SqlFormatter;252 DialogParameterSet dialogParameterSet = DialogParameterSet.LoadByWhereClause(base.Session, sqlFormatter.AndRelation(sqlFormatter.UidComparison("ObjectKeyUsedBy", new DbObjectKey(dbObject).ToXmlString()), string.Format("{0}={0}", (object)System.DateTime.Now.Ticks)));253 if (dialogParameterSet != null)254 {255 string singleValue = base.Session.Source().GetSingleValue<string>("DialogParameterSet", "UID_DialogParameterSetParent", base.SqlFormatter.UidComparison("UID_DialogParameterSet", dialogParameterSet.Uid));256 if (!string.IsNullOrEmpty(singleValue))257 {258 parentSet = DialogParameterSet.LoadByWhereClause(base.Session, base.SqlFormatter.UidComparison("UID_DialogParameterSet", singleValue));259 }260 }261 return dialogParameterSet;262 }263264 private void _ClearParameters()265 {266 _paramsToDelete.Clear();267 using (new UpdateHelper(m_TreeListParameters))268 {269 ITreeListProxy proxy = m_TreeListParameters.Proxy;270 foreach (ITreeListNode item in (System.Collections.IEnumerable)proxy.GetNodes())271 {272 if ((item?.Tag as IParameter)?.Tag is ISingleDbObject singleDbObject)273 {274 singleDbObject["ParameterName"].ValueChanged -= ParameterName_ValueChanged;275 }276 }277 proxy.Clear();278 }279 }280281 private void _LoadParameter()282 {283 try284 {285 _ClearParameters();286 using (new UpdateHelper(m_TreeListParameters))287 {288 ISingleDbObject dbObject = m_MainActivator.DbObject;289 if (dbObject == null || !dbObject.IsLoaded)290 {291 return;292 }293 _currentRPSReportParameterSet = _GetRPSReportParameterSet(out _currentDialogReportParameterSet);294 if (_currentRPSReportParameterSet == null)295 {296 dbObject.Custom.CallMethod("CreateParameterSet");297 _currentRPSReportParameterSet = _GetRPSReportParameterSet(out _currentDialogReportParameterSet);298 }299 System.Collections.Generic.IEnumerator<ISingleDbObject> enumerator = _currentRPSReportParameterSet.GetOrCreateParameterObjects().GetEnumerator();300 try301 {302 while (((System.Collections.IEnumerator)enumerator).MoveNext())303 {304 ISingleDbObject current = enumerator.Current;305 string pname = current["ParameterName"].New.String;306 DialogParameter dialogParameter = Enumerable.FirstOrDefault<Parameter>(_currentRPSReportParameterSet.All, (Func<Parameter, bool>)((Parameter p) => p.Name == pname)) as DialogParameter;307 ParameterSet parent = _currentRPSReportParameterSet.Parent;308 DialogParameter dialogParameter2 = ((parent != null) ? Enumerable.FirstOrDefault<Parameter>(parent.All, (Func<Parameter, bool>)((Parameter p) => p.Name == pname)) : null) as DialogParameter;309 if (dialogParameter != null && (dialogParameter2 == null || dialogParameter2.IsVisibleForChildren))310 {311 dialogParameter.Tag = current;312 m_TreeListParameters.Proxy.AddNode(dialogParameter.Caption, 160).Tag = dialogParameter;313 }314 }315 }316 finally317 {318 ((System.IDisposable)enumerator)?.Dispose();319 }320 }321 }322 finally323 {324 EnableParameterCreationControlsConditional();325 }326 }327328 private void EnableParameterCreationControlsConditional()329 {330 ISingleDbObject dbObject = m_MainActivator.DbObject;331 bool flag = dbObject?.GetValue<bool>("IsListReport") ?? false;332 m_TabPageParameters.VisibleByUser = (flag && dbObject.IsLoaded) || m_TreeListParameters.Proxy.GetNodes().Count > 0;333 VI.Controls.Interfaces.IButton buttonAddParameter = m_ButtonAddParameter;334 bool visible = (m_ButtonRemoveParameter.Visible = flag);335 buttonAddParameter.Visible = visible;336 }337338 private void MainActivator_Saving(object sender, EventArgs e)339 {340 //IL_0187: Unknown result type (might be due to invalid IL or missing references)341 //IL_018d: Invalid comparison between Unknown and I4342 //IL_0191: Unknown result type (might be due to invalid IL or missing references)343 //IL_0196: Unknown result type (might be due to invalid IL or missing references)344 if (!m_TabPageParameters.VisibleByUser)345 {346 return;347 }348 using (TransactionList transactionList = new TransactionList())349 {350 m_DialogParameterUsi.CommitChanges(new UISnapIn.CommitChangesArgs351 {352 Transaction = transactionList353 });354 transactionList.Commit();355 }356 string[] array = new string[3] { "OnPropertyChangedScript", "ValidationScript", "ValueScript" };357 List<IDbColumn> val = new List<IDbColumn>();358 System.Collections.Generic.IEnumerator<ISingleDbObject> enumerator = Enumerable.Where<ISingleDbObject>(Enumerable.Select<IParameter, ISingleDbObject>(Enumerable.Where<IParameter>(Enumerable.Select<ITreeListNode, IParameter>(Enumerable.OfType<ITreeListNode>((System.Collections.IEnumerable)m_TreeListParameters.Proxy.GetNodes()), (Func<ITreeListNode, IParameter>)((ITreeListNode n) => n.Tag as IParameter)), (Func<IParameter, bool>)((IParameter n) => n != null)), (Func<IParameter, ISingleDbObject>)((IParameter p) => p.Tag as ISingleDbObject)), (Func<ISingleDbObject, bool>)((ISingleDbObject p) => p != null)).GetEnumerator();359 try360 {361 while (((System.Collections.IEnumerator)enumerator).MoveNext())362 {363 ISingleDbObject current = enumerator.Current;364 string[] array2 = array;365 foreach (string columnname in array2)366 {367 if (current.Columns[columnname].IsDifferent)368 {369 val.Add(current.Columns[columnname]);370 }371 }372 }373 }374 finally375 {376 ((System.IDisposable)enumerator)?.Dispose();377 }378 if (val.Count <= 0 || (int)FormTool.ShowQuestion("RPS_FormRPSReportMasterData_QuestionScriptsCompile", (MessageBoxButtons)4) == 6)379 {380 return;381 }382 Enumerator<IDbColumn> enumerator2 = val.GetEnumerator();383 try384 {385 while (enumerator2.MoveNext())386 {387 enumerator2.Current.Discard();388 }389 }390 finally391 {392 ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();393 }394 }395396 private void MainActivator_Saved(object sender, EventArgs e)397 {398 //IL_0168: Unknown result type (might be due to invalid IL or missing references)399 //IL_016d: Unknown result type (might be due to invalid IL or missing references)400 _saving = true;401 try402 {403 ISingleDbObject dbObject = m_MainActivator.DbObject;404 if (dbObject == null)405 {406 return;407 }408 string xmlkey = new DbObjectKey(dbObject).ToXmlString();409 if (!string.IsNullOrEmpty(dbObject.GetValue("UID_DialogReport").String) && dbObject.Columns["UID_DialogReport"].IsChanged && !string.IsNullOrEmpty(dbObject.Columns["UID_DialogReport"].Old.String) && base.Session.Source().TryGet(Query.From("DialogParameterSet").Where(base.SqlFormatter.UidComparison("ObjectKeyUsedBy", xmlkey)).SelectNone(), out var entity))410 {411 entity.MarkForDeletion();412 entity.Save(base.Session);413 dbObject.Custom.CallMethod("CreateParameterSet");414 _LoadParameter();415 }416 using (TransactionList transactionList = new TransactionList())417 {418 transactionList.Add(base.Session);419 transactionList.Add(dbObject);420 dbObject.Save();421 dbObject.Load();422 Query query = (from tbl in Query.From("DialogParameterSet")423 where tbl.Column("ObjectKeyUsedBy") == xmlkey424 select tbl).Select("UID_DialogParameterSet");425 if (base.Session.Source().TryGetSingleValue<string>(query, out var value))426 {427 Enumerator<IParameter> enumerator = _paramsToDelete.GetEnumerator();428 try429 {430 while (enumerator.MoveNext())431 {432 if (enumerator.Current.Tag is ISingleDbObject { IsLoaded: not false } singleDbObject)433 {434 singleDbObject.Delete();435 singleDbObject.Save();436 }437 }438 }439 finally440 {441 ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();442 }443 foreach (ITreeListNode item in (System.Collections.IEnumerable)m_TreeListParameters.Proxy.GetNodes())444 {445 if ((item.Tag as IDialogParameter)?.Tag is ISingleDbObject singleDbObject2 && (singleDbObject2.IsChanged || !string.Equals(singleDbObject2.GetValue<string>("UID_DialogParameterSet"), value, (StringComparison)4)))446 {447 singleDbObject2["UID_DialogParameterSet"].NewValue = value;448 singleDbObject2.Save();449 singleDbObject2.Load();450 }451 }452 }453 transactionList.Commit();454 }455 m_LabelSaveHint.Visible = false;456 _LoadParameter();457 }458 finally459 {460 _saving = false;461 AdaptTreeComboDialogReport();462 }463 }464465 private void MainActivator_Discarded(object sender, EventArgs e)466 {467 try468 {469 _LoadParameter();470 }471 catch (System.Exception exception)472 {473 ExceptionMgr.Instance.HandleException(exception, this);474 }475 }476477 private void AdaptTreeComboDialogReport()478 {479 try480 {481 ITreeComboBox treeComboUIDDialogReport = m_TreeComboUIDDialogReport;482 ISingleDbObject dbObject = m_MainActivator.DbObject;483 treeComboUIDDialogReport.EnabledByUser = dbObject != null && !dbObject.IsLoaded;484 }485 catch (System.Exception exception)486 {487 ExceptionMgr.Instance.HandleException(exception, this);488 }489 }490491 private void ObjectChangeComponent_ObjectEventOccurred(object sender, ObjectChangeComponentEventArgs e)492 {493 if (!_saving)494 {495 AdaptTreeComboDialogReport();496 }497 }498499 private void ObjectChangeComponent_ColumnValueChanged(object sender, ColumnEventArgs e)500 {501 try502 {503 string text = e.Column.Columnname.ToLowerInvariant();504 if (!(text == "uid_dialogreport"))505 {506 if (!(text == "islistreport"))507 {508 if (!(text == "exportformat"))509 {510 return;511 }512 try513 {514 m_Activating++;515 long num = 0L;516 long num2 = 1L;517 HashSet<string> val = Enumerable.ToHashSet<string>((System.Collections.Generic.IEnumerable<string>)new MultiValueProperty(e.New.String), (IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase);518 foreach (BitMaskItemCollection.BitMaskItem item in (CollectionBase)m_BitMaskComboExportFormat.BitPositions)519 {520 if (val.Contains((string)item.Tag))521 {522 num |= num2;523 }524 num2 <<= 1;525 }526 m_BitMaskComboExportFormat.BitMask = num;527 return;528 }529 finally530 {531 m_Activating--;532 }533 }534 m_EditReportDefinition.VisibleByUser = e.New.Bool;535 EnableParameterCreationControlsConditional();536 }537 else538 {539 _LoadParameter();540 _AdaptTask();541 if (!string.IsNullOrEmpty(e.Column.New.String) && !string.IsNullOrEmpty(e.Column.Old.String) && !e.Column.New.String.Equals(e.Column.Old.String, (StringComparison)5))542 {543 m_LabelSaveHint.Visible = true;544 m_TabPageParameters.VisibleByUser = false;545 }546 }547 }548 catch (System.Exception exception)549 {550 ExceptionMgr.Instance.HandleException(exception, this);551 }552 }553554 private void ObjectChangeComponent_ColumnRightsChanged(object sender, ColumnEventArgs e)555 {556 try557 {558 if (e.Column.Columnname.ToLowerInvariant() == "exportformat")559 {560 m_BitMaskComboExportFormat.EnabledByUser = e.Column.CanEdit;561 m_BitMaskComboExportFormat.VisibleByUser = e.Column.CanSee;562 }563 }564 catch (System.Exception exception)565 {566 ExceptionMgr.Instance.HandleException(exception, this);567 }568 }569570 private void _AdaptTask()571 {572 ISingleDbObject dbObject = m_MainActivator.DbObject;573 using (new UpdateHelper(base.Tasks))574 {575 base.Tasks["Preview"].Enabled = dbObject != null && dbObject.GetValueSafe("UID_DialogReport", "").Length > 0;576 }577 }578579 private void TreeListParameters_SelectedNodeChanged(object sender, TreeListProxyEventArgs e)580 {581 ITreeListNode node;582 bool isListReport;583 try584 {585 node = m_TreeListParameters.Proxy.SelectedNode;586 m_ButtonRemoveParameter.Enabled = IsDeleteParameterAllowed(node);587 if ((node?.Tag as IParameter)?.Tag is ISingleDbObject dbObject)588 {589 m_DialogParameterUsi.Bind(dbObject.ToUIEntity(), new UISnapIn.BindArgs());590 m_DialogParameterUsi.EnabledByUser = true;591 }592 else593 {594 m_DialogParameterUsi.Bind(base.Session.Source().CreateNew("DialogParameter", EntityCreationType.Interactive).ToUIEntity(base.Session), new UISnapIn.BindArgs());595 m_DialogParameterUsi.EnabledByUser = false;596 }597 isListReport = m_MainActivator.DbObject?.GetValue<bool>("IsListReport") ?? false;598 m_DialogParameterUsi.PropertyFilter = Filter;599 }600 catch (System.Exception exception)601 {602 ExceptionMgr.Instance.HandleException(exception, this);603 }604 bool Filter(string x)605 {606 string text = x.ToLowerInvariant();607 if (text == "parametername" || text == "examplevalue" || text == "valuescript" || text == "validationscript")608 {609 if (isListReport)610 {611 return !IsDeleteParameterAllowed(node);612 }613 return true;614 }615 return false;616 }617 }618619 private void BitMaskComboExportFormat_BitMaskChanged(object sender, BitMaskComboBoxEventArgs e)620 {621 try622 {623 ISingleDbObject dbObject = m_MainActivator.DbObject;624 if (dbObject == null || m_Activating != 0)625 {626 return;627 }628 long bitMask = m_BitMaskComboExportFormat.BitMask;629 MultiValueProperty multiValueProperty = new MultiValueProperty();630 for (int i = 0; i < ((CollectionBase)m_BitMaskComboExportFormat.BitPositions).Count; i++)631 {632 BitMaskItemCollection.BitMaskItem bitMaskItem = m_BitMaskComboExportFormat.BitPositions[i];633 if ((bitMask & (1 << i)) > 0)634 {635 multiValueProperty.Add((string)bitMaskItem.Tag);636 }637 }638 if (dbObject.SetValueSafe("ExportFormat", ((object)multiValueProperty).ToString()) && !m_MainActivator.IsChanged)639 {640 m_MainActivator.DataChanged("");641 }642 }643 catch (System.Exception exception)644 {645 ExceptionMgr.Instance.HandleException(exception, this);646 }647 }648649 private string GetNewParameterName()650 {651 string text = "Parameter";652 System.Collections.ICollection nodes = m_TreeListParameters.Proxy.GetNodes();653 int num = nodes.Count + 1;654 string currentParamName;655 while (true)656 {657 currentParamName = $"{text}{num}";658 if (!Enumerable.Any<ITreeListNode>(Enumerable.OfType<ITreeListNode>((System.Collections.IEnumerable)nodes), (Func<ITreeListNode, bool>)((ITreeListNode node) => node.Tag is IDialogParameter dialogParameter && dialogParameter.Name.Equals(currentParamName, (StringComparison)5))))659 {660 break;661 }662 num++;663 }664 return currentParamName;665 }666667 private void ButtonAddParameter_Click(object sender, EventArgs e)668 {669 IConnection connection = base.Session.Resolve<IConnection>();670 ISingleDbObject singleDbObject = connection.CreateSingle("DialogParameter");671 string newParameterName = GetNewParameterName();672 singleDbObject.PutValue("ParameterName", newParameterName);673 singleDbObject.PutValue("DisplayName", newParameterName);674 singleDbObject["ParameterName"].ValueChanged += ParameterName_ValueChanged;675 DialogParameter dialogParameter = DialogParameter.Create(connection, singleDbObject);676 string caption = (dialogParameter.Name = newParameterName);677 dialogParameter.Caption = caption;678 dialogParameter.Tag = singleDbObject;679 using (new UpdateHelper(m_TreeListParameters))680 {681 m_TreeListParameters.Proxy.AddNode(dialogParameter.Caption, 160).Tag = dialogParameter;682 }683 _currentRPSReportParameterSet.AddParameter(dialogParameter);684 m_MainActivator.DataChanged("");685 }686687 private void ButtonRemoveParameter_Click(object sender, EventArgs e)688 {689 ITreeListNode selectedNode = m_TreeListParameters.Proxy.SelectedNode;690 if (selectedNode != null)691 {692 if (!(selectedNode.Tag is IParameter parameter))693 {694 return;695 }696 _paramsToDelete.Add(parameter);697 if (parameter.Tag is ISingleDbObject singleDbObject)698 {699 singleDbObject["ParameterName"].ValueChanged -= ParameterName_ValueChanged;700 }701 _currentRPSReportParameterSet.RemoveParameter(parameter.Name);702 using (new UpdateHelper(m_TreeListParameters))703 {704 m_TreeListParameters.Proxy.RemoveNode(selectedNode);705 }706 }707 m_ButtonRemoveParameter.Enabled = false;708 m_MainActivator.DataChanged("");709 }710711 private bool IsDeleteParameterAllowed(ITreeListNode node)712 {713 IParameter param = node?.Tag as IParameter;714 if (!(param?.Tag is ISingleDbObject))715 {716 return false;717 }718 if (_currentDialogReportParameterSet == null)719 {720 return true;721 }722 return !Enumerable.Any<Parameter>(_currentDialogReportParameterSet.All, (Func<Parameter, bool>)((Parameter p) => p.Name.Equals(param.Name, (StringComparison)5)));723 }724725 private void ParameterName_ValueChanged(object sender, ColumnEventArgs e)726 {727 foreach (ITreeListNode item in (System.Collections.IEnumerable)m_TreeListParameters.Proxy.GetNodes())728 {729 if ((item.Tag as IParameter)?.Tag is ISingleDbObject singleDbObject && singleDbObject == e.Object)730 {731 item.Caption = e.New.String;732 break;733 }734 }735 }736}737