QER.Customizer/QER.Customizer/QERPickCategory.cs
Decompiler Source FileQER.Customizer.QERPickCategoryDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- Method registration: FillRandomSample at line 186
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 QERPickCategory; methods MoveNext, SetStateMachine, _IsAssigned, FillRandomSampleAsync; references AttestationRun, DialogTable, QERPickCategory; markers reads entity values, references DB/Dialog objects
Classes
QERPickCategoryDB/Dialog object references
OIM key/entity markers
UID_DialogTable UID_QERPickCategoryAPI/entity calls
GetValue SqlFormatterRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Diagnostics;3using System.Runtime.CompilerServices;4using System.Runtime.InteropServices;5using System.Threading;6using System.Threading.Tasks;7using NLog;8using VI.Base;9using VI.DB;10using VI.DB.DataAccess;11using VI.DB.Entities;1213namespace QER.Customizer;1415public class QERPickCategory : StateBasedEntityLogic16{17 [StructLayout((LayoutKind)3)]18 [CompilerGenerated]19 private struct _003CFillRandomSampleAsync_003Ed__2 : IAsyncStateMachine20 {21 public int _003C_003E1__state;2223 public AsyncTaskMethodBuilder _003C_003Et__builder;2425 public LogSession log;2627 public ISession session;2829 public IEntity ePickCategory;3031 public CancellationToken ct;3233 private ConfiguredTaskAwaiter<int> _003C_003Eu__1;3435 private void MoveNext()36 {37 //IL_01b3: Unknown result type (might be due to invalid IL or missing references)38 //IL_01b8: Unknown result type (might be due to invalid IL or missing references)39 //IL_01c0: Unknown result type (might be due to invalid IL or missing references)40 //IL_016d: Unknown result type (might be due to invalid IL or missing references)41 //IL_0178: Unknown result type (might be due to invalid IL or missing references)42 //IL_017d: Unknown result type (might be due to invalid IL or missing references)43 //IL_0181: Unknown result type (might be due to invalid IL or missing references)44 //IL_0186: Unknown result type (might be due to invalid IL or missing references)45 //IL_009e: Unknown result type (might be due to invalid IL or missing references)46 //IL_019b: Unknown result type (might be due to invalid IL or missing references)47 //IL_019d: Unknown result type (might be due to invalid IL or missing references)48 int num = _003C_003E1__state;49 try50 {51 ConfiguredTaskAwaiter<int> val;52 if (num != 0)53 {54 if (log == null)55 {56 log = new LogSession("ObjectLog", session.Id ?? string.Empty, useMultiLanguage: false);57 }58 ISqlFormatter sqlFormatter = session.SqlFormatter();59 string text = ePickCategory.Columns["RandomSampleWhereClause"].GetValue<string>();60 if (string.IsNullOrEmpty(text))61 {62 text = "1=1";63 }64 string text2 = ePickCategory.CreateWalker(session).GetValue("FK(UID_DialogTable).TableName");65 if (string.IsNullOrEmpty(text2))66 {67 throw new ArgumentNullException("FK(UID_DialogTable).TableName");68 }69 double value = ePickCategory.Columns["RandomSamplePickRate"].GetValue<double>();70 log.Debug("Create random samples from table '{0}' with condition '{1}' for {2:0.00}% of the records.", text2, text, value);71 string statement = sqlFormatter.StoredProcedure(new SqlFunction("QER", "''", "PPickedItemInsertRandom"), sqlFormatter.FormatValue(ePickCategory.Columns["UID_QERPickCategory"].GetValue(), ValType.String, forUpdate: true), sqlFormatter.FormatValue(text2, ValType.String, forUpdate: true), sqlFormatter.FormatValue(value, ValType.Double, forUpdate: true), sqlFormatter.FormatValue(text, ValType.String, forUpdate: true));72 val = session.Resolve<IDbSession>().SqlExecuteNonQueryInContextAsync(session, statement, ct).ConfigureAwait(false)73 .GetAwaiter();74 if (!val.IsCompleted)75 {76 num = (_003C_003E1__state = 0);77 _003C_003Eu__1 = val;78 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<int>, _003CFillRandomSampleAsync_003Ed__2>(ref val, ref this);79 return;80 }81 }82 else83 {84 val = _003C_003Eu__1;85 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<int>);86 num = (_003C_003E1__state = -1);87 }88 val.GetResult();89 }90 catch (System.Exception exception)91 {92 _003C_003E1__state = -2;93 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);94 return;95 }96 _003C_003E1__state = -2;97 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();98 }99100 [DebuggerHidden]101 private void SetStateMachine(IAsyncStateMachine stateMachine)102 {103 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);104 }105 }106107 [StructLayout((LayoutKind)3)]108 [CompilerGenerated]109 private struct _003C_IsAssigned_003Ed__1 : IAsyncStateMachine110 {111 public int _003C_003E1__state;112113 public AsyncTaskMethodBuilder<bool> _003C_003Et__builder;114115 public ISession session;116117 public IEntity entity;118119 public CancellationToken ct;120121 private ConfiguredTaskAwaiter<DbObjectKey?> _003C_003Eu__1;122123 private void MoveNext()124 {125 //IL_005a: Unknown result type (might be due to invalid IL or missing references)126 //IL_005f: Unknown result type (might be due to invalid IL or missing references)127 //IL_0066: Unknown result type (might be due to invalid IL or missing references)128 //IL_0017: Unknown result type (might be due to invalid IL or missing references)129 //IL_0022: Unknown result type (might be due to invalid IL or missing references)130 //IL_0027: Unknown result type (might be due to invalid IL or missing references)131 //IL_002a: Unknown result type (might be due to invalid IL or missing references)132 //IL_002f: Unknown result type (might be due to invalid IL or missing references)133 //IL_0043: Unknown result type (might be due to invalid IL or missing references)134 //IL_0044: Unknown result type (might be due to invalid IL or missing references)135 int num = _003C_003E1__state;136 bool result;137 try138 {139 ConfiguredTaskAwaiter<DbObjectKey> val;140 if (num != 0)141 {142 val = QERHelper.FindPickCategoryUsageAsync(session, entity, ct).ConfigureAwait(false).GetAwaiter();143 if (!val.IsCompleted)144 {145 num = (_003C_003E1__state = 0);146 _003C_003Eu__1 = val;147 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<DbObjectKey>, _003C_IsAssigned_003Ed__1>(ref val, ref this);148 return;149 }150 }151 else152 {153 val = _003C_003Eu__1;154 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<DbObjectKey>);155 num = (_003C_003E1__state = -1);156 }157 result = val.GetResult() != null;158 }159 catch (System.Exception exception)160 {161 _003C_003E1__state = -2;162 _003C_003Et__builder.SetException(exception);163 return;164 }165 _003C_003E1__state = -2;166 _003C_003Et__builder.SetResult(result);167 }168169 [DebuggerHidden]170 private void SetStateMachine(IAsyncStateMachine stateMachine)171 {172 _003C_003Et__builder.SetStateMachine(stateMachine);173 }174 }175176 public QERPickCategory()177 {178 RegisterExpensive("_IsAssigned").DependsOn("UID_QERPickCategory").As<bool>((Func<ISession, IEntity, IEntityWalker, CancellationToken, System.Threading.Tasks.Task<bool>>)_IsAssigned);179 RadioGroup("IsRandomSample", "IsManual");180 using (base.Section.Except("SPECIAL(IsTransport)"))181 {182 CanEdit("RemoveAfterAttestationRun").From("_IsAssigned").As<bool>((Func<bool, bool>)((bool isAssigned) => !isAssigned));183 CanEdit("RandomSamplePickRate", "CreateRandomSampleForEachRun", "RandomSampleWhereClause").From("IsRandomSample").As<bool>((Func<bool, bool>)((bool isRandomSample) => isRandomSample)).ClearValueOnFalse()184 .HiddenWhenDisabled();185 MinLen("UID_DialogTable").From("IsRandomSample").As<bool>((Func<bool, int>)((bool isRandomSample) => isRandomSample ? 1 : 0));186 RegisterMethod("FillRandomSample").As((ISession s, IEntity e, CancellationToken ct) => FillRandomSampleAsync(s, e, null, ct)).Enabled().From("IsRandomSample")187 .As<bool>((Func<bool, bool>)((bool isRandomSample) => isRandomSample))188 .Behavior(MethodBehavior.ChangesExternalState)189 .Description("Method_QERPickCategory_FillRandomSample");190 }191 }192193 [AsyncStateMachine(typeof(_003C_IsAssigned_003Ed__1))]194 private async System.Threading.Tasks.Task<bool> _IsAssigned(ISession session, IEntity entity, IEntityWalker walker, CancellationToken ct)195 {196 //IL_0002: Unknown result type (might be due to invalid IL or missing references)197 //IL_0007: Unknown result type (might be due to invalid IL or missing references)198 //IL_001e: Unknown result type (might be due to invalid IL or missing references)199 //IL_0020: Unknown result type (might be due to invalid IL or missing references)200 return await QERHelper.FindPickCategoryUsageAsync(session, entity, ct).ConfigureAwait(false) != null;201 }202203 [AsyncStateMachine(typeof(_003CFillRandomSampleAsync_003Ed__2))]204 public static System.Threading.Tasks.Task FillRandomSampleAsync(ISession session, IEntity ePickCategory, LogSession? log, CancellationToken ct)205 {206 //IL_0002: Unknown result type (might be due to invalid IL or missing references)207 //IL_0007: Unknown result type (might be due to invalid IL or missing references)208 //IL_0026: Unknown result type (might be due to invalid IL or missing references)209 //IL_0027: Unknown result type (might be due to invalid IL or missing references)210 _003CFillRandomSampleAsync_003Ed__2 _003CFillRandomSampleAsync_003Ed__ = default(_003CFillRandomSampleAsync_003Ed__2);211 _003CFillRandomSampleAsync_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();212 _003CFillRandomSampleAsync_003Ed__.session = session;213 _003CFillRandomSampleAsync_003Ed__.ePickCategory = ePickCategory;214 _003CFillRandomSampleAsync_003Ed__.log = log;215 _003CFillRandomSampleAsync_003Ed__.ct = ct;216 _003CFillRandomSampleAsync_003Ed__._003C_003E1__state = -1;217 ((AsyncTaskMethodBuilder)(ref _003CFillRandomSampleAsync_003Ed__._003C_003Et__builder)).Start<_003CFillRandomSampleAsync_003Ed__2>(ref _003CFillRandomSampleAsync_003Ed__);218 return ((AsyncTaskMethodBuilder)(ref _003CFillRandomSampleAsync_003Ed__._003C_003Et__builder)).Task;219 }220}221