CPL.Customizer/CPL.Customizer/PersonInNonCompliance.cs
Decompiler Source FileCPL.Customizer.PersonInNonComplianceDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- ExtendedMethod registration: MakeDecision at line 618
- ExtendedMethod registration: UpdateDecision at line 622
- ExtendedMethod registration: MakeDecision at line 626
- ExtendedMethod registration: UpdateDecision at line 630
- Function registration: IsValidDecisionMaker at line 634
- CustomGenerated event: Granted at line 617
- CustomGenerated event: Denied at line 617
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 PersonInNonCompliance, MP; methods MoveNext, SetStateMachine, OnSavingAsync, _CheckExceptionGranted, GetIsExceptionAllowed, MakeDecision; references ComplianceRule, NonCompliance, Person, PersonInNonCompliance, QERJustification; markers reads entity values, references DB/Dialog objects
Classes
PersonInNonCompliance MPMethods
DB/Dialog object references
OIM key/entity markers
UID_NonCompliance UID_Person UID_PersonDecisionMade UID_QERJustificationAPI/entity calls
GetValue TryResult SetValue Source Config Database UserRegistrations / 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 QER.Customizer;8using VI.Base;9using VI.DB;10using VI.DB.DataAccess;11using VI.DB.Entities;1213namespace CPL.Customizer;1415public class PersonInNonCompliance : StateBasedEntityLogic16{17 [RequiredMember]18 private class MP19 {20 [RequiredMember]21 public string Person;2223 public bool Granted;2425 public string? Message;2627 public bool Update;2829 public System.DateTime ValidUntil;3031 public string? Justification;3233 [Obsolete("Constructors of types with required members are not supported in this version of your compiler.", true)]34 [CompilerFeatureRequired("RequiredMembers")]35 public MP()36 {37 }38 }3940 [StructLayout((LayoutKind)3)]41 [CompilerGenerated]42 private struct _003CDecision_OnSaving_003Ed__8 : IAsyncStateMachine43 {44 public int _003C_003E1__state;4546 public AsyncTaskMethodBuilder _003C_003Et__builder;4748 public IEntity entity;4950 public LogicReadWriteParameters parameter;5152 public CancellationToken ct;5354 public MP mp;5556 private ConfiguredTaskAwaiter _003C_003Eu__1;5758 private void MoveNext()59 {60 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)61 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)62 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)63 //IL_001a: Unknown result type (might be due to invalid IL or missing references)64 //IL_0062: Unknown result type (might be due to invalid IL or missing references)65 //IL_006d: Unknown result type (might be due to invalid IL or missing references)66 //IL_0072: Unknown result type (might be due to invalid IL or missing references)67 //IL_0075: Unknown result type (might be due to invalid IL or missing references)68 //IL_007a: Unknown result type (might be due to invalid IL or missing references)69 //IL_008e: Unknown result type (might be due to invalid IL or missing references)70 //IL_008f: Unknown result type (might be due to invalid IL or missing references)71 int num = _003C_003E1__state;72 try73 {74 ConfiguredTaskAwaiter val2;75 if (num != 0)76 {77 LogicParameter logicParameter = new LogicParameter(entity, parameter, ct);78 logicParameter.Entity.SetValue("IsDecisionMade", true);79 ConfiguredTaskAwaitable val = logicParameter.UnitOfWork.GenerateAsync(logicParameter.Entity, mp.Granted ? "GRANTED" : "DENIED", null, logicParameter.CancellationToken).ConfigureAwait(false);80 val2 = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();81 if (!((ConfiguredTaskAwaiter)(ref val2)).IsCompleted)82 {83 num = (_003C_003E1__state = 0);84 _003C_003Eu__1 = val2;85 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CDecision_OnSaving_003Ed__8>(ref val2, ref this);86 return;87 }88 }89 else90 {91 val2 = _003C_003Eu__1;92 _003C_003Eu__1 = default(ConfiguredTaskAwaiter);93 num = (_003C_003E1__state = -1);94 }95 ((ConfiguredTaskAwaiter)(ref val2)).GetResult();96 }97 catch (System.Exception exception)98 {99 _003C_003E1__state = -2;100 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);101 return;102 }103 _003C_003E1__state = -2;104 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();105 }106107 [DebuggerHidden]108 private void SetStateMachine(IAsyncStateMachine stateMachine)109 {110 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);111 }112 }113114 [StructLayout((LayoutKind)3)]115 [CompilerGenerated]116 private struct _003CGetIsExceptionAllowed_003Ed__4 : IAsyncStateMachine117 {118 public int _003C_003E1__state;119120 public AsyncTaskMethodBuilder<bool> _003C_003Et__builder;121122 public LogicParameter lp;123124 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;125126 private void MoveNext()127 {128 //IL_00d9: Unknown result type (might be due to invalid IL or missing references)129 //IL_00de: Unknown result type (might be due to invalid IL or missing references)130 //IL_00e6: Unknown result type (might be due to invalid IL or missing references)131 //IL_0093: Unknown result type (might be due to invalid IL or missing references)132 //IL_009e: Unknown result type (might be due to invalid IL or missing references)133 //IL_00a3: Unknown result type (might be due to invalid IL or missing references)134 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)135 //IL_00ac: Unknown result type (might be due to invalid IL or missing references)136 //IL_00c1: Unknown result type (might be due to invalid IL or missing references)137 //IL_00c3: Unknown result type (might be due to invalid IL or missing references)138 int num = _003C_003E1__state;139 bool result;140 try141 {142 ConfiguredTaskAwaiter<bool> val;143 if (num == 0)144 {145 val = _003C_003Eu__1;146 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);147 num = (_003C_003E1__state = -1);148 goto IL_00f5;149 }150 ISqlFormatter sqlFormatter = lp.SqlFormatter;151 string value = lp.Entity.GetValue<string>("UID_NonCompliance");152 if (!string.IsNullOrEmpty(value))153 {154 string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_NonCompliance", value), sqlFormatter.Comparison("IsWorkingCopy", false, ValType.Bool));155 val = lp.Session.Source().GetSingleValueAsync<bool>("ComplianceRule", "IsExceptionAllowed", whereclause, lp.CancellationToken).ConfigureAwait(false)156 .GetAwaiter();157 if (!val.IsCompleted)158 {159 num = (_003C_003E1__state = 0);160 _003C_003Eu__1 = val;161 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003CGetIsExceptionAllowed_003Ed__4>(ref val, ref this);162 return;163 }164 goto IL_00f5;165 }166 result = false;167 goto end_IL_0007;168 IL_00f5:169 result = val.GetResult();170 end_IL_0007:;171 }172 catch (System.Exception exception)173 {174 _003C_003E1__state = -2;175 _003C_003Et__builder.SetException(exception);176 return;177 }178 _003C_003E1__state = -2;179 _003C_003Et__builder.SetResult(result);180 }181182 [DebuggerHidden]183 private void SetStateMachine(IAsyncStateMachine stateMachine)184 {185 _003C_003Et__builder.SetStateMachine(stateMachine);186 }187 }188189 [StructLayout((LayoutKind)3)]190 [CompilerGenerated]191 private struct _003CIsValidDecisionMakerAsync_003Ed__9 : IAsyncStateMachine192 {193 public int _003C_003E1__state;194195 public AsyncTaskMethodBuilder<bool> _003C_003Et__builder;196197 public LogicParameter lp;198199 public string uidPerson;200201 private ISqlFormatter _003CfSql_003E5__2;202203 private ConfiguredTaskAwaiter<string> _003C_003Eu__1;204205 private ConfiguredTaskAwaiter<object> _003C_003Eu__2;206207 private void MoveNext()208 {209 //IL_0086: Unknown result type (might be due to invalid IL or missing references)210 //IL_008b: Unknown result type (might be due to invalid IL or missing references)211 //IL_0093: Unknown result type (might be due to invalid IL or missing references)212 //IL_01f2: Unknown result type (might be due to invalid IL or missing references)213 //IL_01f7: Unknown result type (might be due to invalid IL or missing references)214 //IL_01ff: Unknown result type (might be due to invalid IL or missing references)215 //IL_003d: Unknown result type (might be due to invalid IL or missing references)216 //IL_0048: Unknown result type (might be due to invalid IL or missing references)217 //IL_004d: Unknown result type (might be due to invalid IL or missing references)218 //IL_0051: Unknown result type (might be due to invalid IL or missing references)219 //IL_0056: Unknown result type (might be due to invalid IL or missing references)220 //IL_01ac: Unknown result type (might be due to invalid IL or missing references)221 //IL_01b7: Unknown result type (might be due to invalid IL or missing references)222 //IL_01bc: Unknown result type (might be due to invalid IL or missing references)223 //IL_01c0: Unknown result type (might be due to invalid IL or missing references)224 //IL_01c5: Unknown result type (might be due to invalid IL or missing references)225 //IL_006b: Unknown result type (might be due to invalid IL or missing references)226 //IL_006d: Unknown result type (might be due to invalid IL or missing references)227 //IL_01da: Unknown result type (might be due to invalid IL or missing references)228 //IL_01dc: Unknown result type (might be due to invalid IL or missing references)229 int num = _003C_003E1__state;230 bool result;231 try232 {233 ConfiguredTaskAwaiter<object> val;234 ConfiguredTaskAwaiter<string> val2;235 if (num != 0)236 {237 if (num == 1)238 {239 val = _003C_003Eu__2;240 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<object>);241 num = (_003C_003E1__state = -1);242 goto IL_020e;243 }244 _003CfSql_003E5__2 = lp.SqlFormatter;245 val2 = lp.Session.Config().GetConfigParmAsync("QER\\ComplianceCheck\\DisableSelfExceptionGranting", lp.CancellationToken).ConfigureAwait(false)246 .GetAwaiter();247 if (!val2.IsCompleted)248 {249 num = (_003C_003E1__state = 0);250 _003C_003Eu__1 = val2;251 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, _003CIsValidDecisionMakerAsync_003Ed__9>(ref val2, ref this);252 return;253 }254 }255 else256 {257 val2 = _003C_003Eu__1;258 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<string>);259 num = (_003C_003E1__state = -1);260 }261 bool num2 = DbVal.ConvertTo<bool>(val2.GetResult());262 string text = null;263 if (num2)264 {265 text = string.Format("and not {0} in ( select UID_Person from {1} )", (object)_003CfSql_003E5__2.FormatUidValue(lp.Entity.GetValue<string>("UID_Person")), (object)_003CfSql_003E5__2.InlineFunctionCall(new SqlFunction("QER", "GGetInfo", "FTPersonsAreMe")266 {267 TableFunction = true268 }, _003CfSql_003E5__2.FormatUidValue(uidPerson)));269 }270 string systemIdentifier = lp.Session.Database().SystemIdentifier;271 global::_003C_003Ey__InlineArray3<object> buffer = default(global::_003C_003Ey__InlineArray3<object>);272 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 0) = _003CfSql_003E5__2.FormatUidValue(lp.Entity.GetValue<string>("UID_NonCompliance"));273 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 1) = _003CfSql_003E5__2.FormatUidValue(uidPerson);274 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 2) = text;275 string sqlStatement = SqlStrings.Format(systemIdentifier, "PersonInNonCompliance_IsValidDecisionMaker", global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray3<object>, object>(in buffer, 3));276 val = lp.DbSession.SqlExecuteScalarAsync(sqlStatement, lp.CancellationToken).ConfigureAwait(false).GetAwaiter();277 if (!val.IsCompleted)278 {279 num = (_003C_003E1__state = 1);280 _003C_003Eu__2 = val;281 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<object>, _003CIsValidDecisionMakerAsync_003Ed__9>(ref val, ref this);282 return;283 }284 goto IL_020e;285 IL_020e:286 result = DbVal.ConvertTo<bool>(val.GetResult());287 }288 catch (System.Exception exception)289 {290 _003C_003E1__state = -2;291 _003CfSql_003E5__2 = null;292 _003C_003Et__builder.SetException(exception);293 return;294 }295 _003C_003E1__state = -2;296 _003CfSql_003E5__2 = null;297 _003C_003Et__builder.SetResult(result);298 }299300 [DebuggerHidden]301 private void SetStateMachine(IAsyncStateMachine stateMachine)302 {303 _003C_003Et__builder.SetStateMachine(stateMachine);304 }305 }306307 [StructLayout((LayoutKind)3)]308 [CompilerGenerated]309 private struct _003CMakeDecision_003Ed__6 : IAsyncStateMachine310 {311 public int _003C_003E1__state;312313 public AsyncTaskMethodBuilder<MP> _003C_003Et__builder;314315 public ISession session;316317 public IEntity entity;318319 public CancellationToken ct;320321 public string uidPerson;322323 public PersonInNonCompliance _003C_003E4__this;324325 public string reason;326327 public string uidJustfication;328329 public bool decision;330331 public System.DateTime exceptionValidUntil;332333 private LogicParameter _003Clp_003E5__2;334335 private bool _003CadminContext_003E5__3;336337 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;338339 private void MoveNext()340 {341 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)342 //IL_00cf: Unknown result type (might be due to invalid IL or missing references)343 //IL_00d7: Unknown result type (might be due to invalid IL or missing references)344 //IL_0025: Unknown result type (might be due to invalid IL or missing references)345 //IL_008c: Unknown result type (might be due to invalid IL or missing references)346 //IL_0091: Unknown result type (might be due to invalid IL or missing references)347 //IL_0095: Unknown result type (might be due to invalid IL or missing references)348 //IL_009a: Unknown result type (might be due to invalid IL or missing references)349 //IL_00af: Unknown result type (might be due to invalid IL or missing references)350 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)351 int num = _003C_003E1__state;352 PersonInNonCompliance personInNonCompliance = _003C_003E4__this;353 MP result;354 try355 {356 bool flag;357 ConfiguredTaskAwaiter<bool> val;358 if (num != 0)359 {360 _003Clp_003E5__2 = new LogicParameter(session, null, entity, null, null, ct);361 _003CadminContext_003E5__3 = (string.Equals(uidPerson, "sa", (StringComparison)5) && _003Clp_003E5__2.Session.User().IsAdministrativeAccount) || personInNonCompliance.IsInternalProcess;362 flag = !_003CadminContext_003E5__3;363 if (!flag)364 {365 goto IL_00f1;366 }367 val = IsValidDecisionMakerAsync(_003Clp_003E5__2, uidPerson).ConfigureAwait(false).GetAwaiter();368 if (!val.IsCompleted)369 {370 num = (_003C_003E1__state = 0);371 _003C_003Eu__1 = val;372 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003CMakeDecision_003Ed__6>(ref val, ref this);373 return;374 }375 }376 else377 {378 val = _003C_003Eu__1;379 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);380 num = (_003C_003E1__state = -1);381 }382 flag = !val.GetResult();383 goto IL_00f1;384 IL_00f1:385 if (flag)386 {387 throw new ViException(2127241, ExceptionRelevance.EndUser);388 }389 if (reason != null && reason.Length > entity.Columns["DecisionReason"].MaxLen)390 {391 reason = reason.Substring(0, entity.Columns["DecisionReason"].MaxLen - 3) + "...";392 }393 entity.SetValue("UID_PersonDecisionMade", _003CadminContext_003E5__3 ? "" : uidPerson);394 entity.SetValue("DecisionDate", _003Clp_003E5__2.ServerTime);395 entity.SetValue("IsDecisionMade", true);396 entity.SetValue("DecisionReason", reason);397 entity.SetValue("UID_QERJustification", uidJustfication);398 entity.SetValue("IsExceptionGranted", decision);399 if (!DbVal.IsEmpty(exceptionValidUntil, ValType.Date))400 {401 entity.SetValue("ExceptionValidUntil", exceptionValidUntil);402 }403 result = new MP404 {405 Person = uidPerson,406 Granted = decision,407 Message = reason,408 Update = false,409 ValidUntil = exceptionValidUntil,410 Justification = uidJustfication411 };412 }413 catch (System.Exception exception)414 {415 _003C_003E1__state = -2;416 _003Clp_003E5__2 = null;417 _003C_003Et__builder.SetException(exception);418 return;419 }420 _003C_003E1__state = -2;421 _003Clp_003E5__2 = null;422 _003C_003Et__builder.SetResult(result);423 }424425 [DebuggerHidden]426 private void SetStateMachine(IAsyncStateMachine stateMachine)427 {428 _003C_003Et__builder.SetStateMachine(stateMachine);429 }430 }431432 [StructLayout((LayoutKind)3)]433 [CompilerGenerated]434 private struct _003COnSavingAsync_003Ed__2 : IAsyncStateMachine435 {436 public int _003C_003E1__state;437438 public AsyncTaskMethodBuilder<Diff> _003C_003Et__builder;439440 public IEntity entity;441442 public LogicReadWriteParameters parameters;443444 public CancellationToken cancellationToken;445446 public PersonInNonCompliance _003C_003E4__this;447448 private ConfiguredTaskAwaiter _003C_003Eu__1;449450 private ConfiguredTaskAwaiter<Diff> _003C_003Eu__2;451452 private void MoveNext()453 {454 //IL_0071: Unknown result type (might be due to invalid IL or missing references)455 //IL_0076: Unknown result type (might be due to invalid IL or missing references)456 //IL_007d: Unknown result type (might be due to invalid IL or missing references)457 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)458 //IL_00ac: Unknown result type (might be due to invalid IL or missing references)459 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)460 //IL_00b5: Unknown result type (might be due to invalid IL or missing references)461 //IL_00ba: Unknown result type (might be due to invalid IL or missing references)462 //IL_00e7: Unknown result type (might be due to invalid IL or missing references)463 //IL_00ec: Unknown result type (might be due to invalid IL or missing references)464 //IL_00f4: Unknown result type (might be due to invalid IL or missing references)465 //IL_0025: Unknown result type (might be due to invalid IL or missing references)466 //IL_0035: Unknown result type (might be due to invalid IL or missing references)467 //IL_003a: Unknown result type (might be due to invalid IL or missing references)468 //IL_003e: Unknown result type (might be due to invalid IL or missing references)469 //IL_0043: Unknown result type (might be due to invalid IL or missing references)470 //IL_00cf: Unknown result type (might be due to invalid IL or missing references)471 //IL_00d1: Unknown result type (might be due to invalid IL or missing references)472 //IL_0057: Unknown result type (might be due to invalid IL or missing references)473 //IL_0058: Unknown result type (might be due to invalid IL or missing references)474 int num = _003C_003E1__state;475 PersonInNonCompliance personInNonCompliance = _003C_003E4__this;476 Diff result;477 try478 {479 ConfiguredTaskAwaiter<Diff> val;480 ConfiguredTaskAwaiter val3;481 if (num != 0)482 {483 if (num == 1)484 {485 val = _003C_003Eu__2;486 _003C_003Eu__2 = default(ConfiguredTaskAwaiter<Diff>);487 num = (_003C_003E1__state = -1);488 goto IL_0103;489 }490 ConfiguredTaskAwaitable val2 = _CheckExceptionGranted(new LogicParameter(entity, parameters, cancellationToken)).ConfigureAwait(false);491 val3 = ((ConfiguredTaskAwaitable)(ref val2)).GetAwaiter();492 if (!((ConfiguredTaskAwaiter)(ref val3)).IsCompleted)493 {494 num = (_003C_003E1__state = 0);495 _003C_003Eu__1 = val3;496 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003COnSavingAsync_003Ed__2>(ref val3, ref this);497 return;498 }499 }500 else501 {502 val3 = _003C_003Eu__1;503 _003C_003Eu__1 = default(ConfiguredTaskAwaiter);504 num = (_003C_003E1__state = -1);505 }506 ((ConfiguredTaskAwaiter)(ref val3)).GetResult();507 val = ((StateBasedEntityLogic)personInNonCompliance).OnSavingAsync(entity, parameters, cancellationToken).ConfigureAwait(false).GetAwaiter();508 if (!val.IsCompleted)509 {510 num = (_003C_003E1__state = 1);511 _003C_003Eu__2 = val;512 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Diff>, _003COnSavingAsync_003Ed__2>(ref val, ref this);513 return;514 }515 goto IL_0103;516 IL_0103:517 result = val.GetResult();518 }519 catch (System.Exception exception)520 {521 _003C_003E1__state = -2;522 _003C_003Et__builder.SetException(exception);523 return;524 }525 _003C_003E1__state = -2;526 _003C_003Et__builder.SetResult(result);527 }528529 [DebuggerHidden]530 private void SetStateMachine(IAsyncStateMachine stateMachine)531 {532 _003C_003Et__builder.SetStateMachine(stateMachine);533 }534 }535536 [StructLayout((LayoutKind)3)]537 [CompilerGenerated]538 private struct _003C_CheckExceptionGranted_003Ed__3 : IAsyncStateMachine539 {540 public int _003C_003E1__state;541542 public AsyncTaskMethodBuilder _003C_003Et__builder;543544 public LogicParameter lp;545546 private bool _003CisExceptionGranted_003E5__2;547548 private ConfiguredTaskAwaiter<bool> _003C_003Eu__1;549550 private void MoveNext()551 {552 //IL_006c: Unknown result type (might be due to invalid IL or missing references)553 //IL_0071: Unknown result type (might be due to invalid IL or missing references)554 //IL_0078: Unknown result type (might be due to invalid IL or missing references)555 //IL_0031: Unknown result type (might be due to invalid IL or missing references)556 //IL_0036: Unknown result type (might be due to invalid IL or missing references)557 //IL_0039: Unknown result type (might be due to invalid IL or missing references)558 //IL_003e: Unknown result type (might be due to invalid IL or missing references)559 //IL_0052: Unknown result type (might be due to invalid IL or missing references)560 //IL_0053: Unknown result type (might be due to invalid IL or missing references)561 int num = _003C_003E1__state;562 try563 {564 ConfiguredTaskAwaiter<bool> val;565 if (num != 0)566 {567 _003CisExceptionGranted_003E5__2 = lp.Entity.GetValue<bool>("IsExceptionGranted");568 val = GetIsExceptionAllowed(lp).ConfigureAwait(false).GetAwaiter();569 if (!val.IsCompleted)570 {571 num = (_003C_003E1__state = 0);572 _003C_003Eu__1 = val;573 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, _003C_CheckExceptionGranted_003Ed__3>(ref val, ref this);574 return;575 }576 }577 else578 {579 val = _003C_003Eu__1;580 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<bool>);581 num = (_003C_003E1__state = -1);582 }583 bool result = val.GetResult();584 if (!result & _003CisExceptionGranted_003E5__2)585 {586 throw new ViException(2127238, ExceptionRelevance.EndUser);587 }588 if (!result)589 {590 lp.Entity.SetValue("IsDecisionMade", true);591 lp.Entity.SetValue("IsExceptionGranted", false);592 lp.Entity.SetValue("DecisionDate", lp.ServerTime);593 lp.Entity.SetValue("DecisionReason", "No exception allowed");594 }595 }596 catch (System.Exception exception)597 {598 _003C_003E1__state = -2;599 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);600 return;601 }602 _003C_003E1__state = -2;603 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();604 }605606 [DebuggerHidden]607 private void SetStateMachine(IAsyncStateMachine stateMachine)608 {609 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);610 }611 }612613 public PersonInNonCompliance()614 {615 RegisterExpensive("_IsSA").As<bool>((Func<ISession, IEntity, IEntityWalker, CancellationToken, System.Threading.Tasks.Task<bool>>)((ISession s, IEntity e, IEntityWalker w, CancellationToken ct) => System.Threading.Tasks.Task.FromResult<bool>(QERHelper.IsSystemAccount(s))));616 CanEdit("UID_PersonDecisionMade", "DecisionDate", "IsDecisionMade", "DecisionReason", "IsExceptionGranted", "UID_QERJustification").From("SPECIAL(IsFullSync)", "_IsSA").As<bool, bool>((Func<bool, bool, TryResult<bool>>)((bool isFullSync, bool bSA) => TryResult.FromResult(!isFullSync && !bSA, value: false)));617 Event("Granted", "Denied").CustomGenerated();618 RegisterExtendedMethod("MakeDecision").As<string, bool, string, string, MP>((Func<ISession, IEntity, string, bool, string, string, CancellationToken, System.Threading.Tasks.Task<MP>>)MakeDecision).OnSaving(Decision_OnSaving).Enabled()619 .From("IsDecisionMade")620 .As<bool>((Func<bool, bool>)((bool bDecision) => !bDecision))621 .Description("Method_PersonInNonCompliance_MakeDecision");622 RegisterExtendedMethod("UpdateDecision").As<string, bool, string, string, MP>((Func<ISession, IEntity, string, bool, string, string, CancellationToken, System.Threading.Tasks.Task<MP>>)MakeDecision).OnSaving(Decision_OnSaving).Enabled()623 .From("IsDecisionMade")624 .As<bool>((Func<bool, bool>)((bool bDecision) => bDecision))625 .Description("Method_PersonInNonCompliance_UpdateDecision");626 RegisterExtendedMethod("MakeDecision").As<string, bool, string, System.DateTime, string, MP>((Func<ISession, IEntity, string, bool, string, System.DateTime, string, CancellationToken, System.Threading.Tasks.Task<MP>>)MakeDecision).OnSaving(Decision_OnSaving).Enabled()627 .From("IsDecisionMade")628 .As<bool>((Func<bool, bool>)((bool bDecision) => !bDecision))629 .Description("Method_PersonInNonCompliance_MakeDecision");630 RegisterExtendedMethod("UpdateDecision").As<string, bool, string, System.DateTime, string, MP>((Func<ISession, IEntity, string, bool, string, System.DateTime, string, CancellationToken, System.Threading.Tasks.Task<MP>>)MakeDecision).OnSaving(Decision_OnSaving).Enabled()631 .From("IsDecisionMade")632 .As<bool>((Func<bool, bool>)((bool bDecision) => bDecision))633 .Description("Method_PersonInNonCompliance_UpdateDecision");634 RegisterFunction("IsValidDecisionMaker").As<string, bool>(IsValidDecisionMaker).Enabled().From("IsDecisionMade")635 .As<bool>((Func<bool, bool>)((bool bDecision) => !bDecision))636 .Description("Method_PersonInNonCompliance_IsValidDecisionMaker");637 }638639 [AsyncStateMachine(typeof(_003COnSavingAsync_003Ed__2))]640 public override async System.Threading.Tasks.Task<Diff> OnSavingAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)641 {642 //IL_0002: Unknown result type (might be due to invalid IL or missing references)643 //IL_0007: Unknown result type (might be due to invalid IL or missing references)644 //IL_0026: Unknown result type (might be due to invalid IL or missing references)645 //IL_0027: Unknown result type (might be due to invalid IL or missing references)646 await _CheckExceptionGranted(new LogicParameter(entity, parameters, cancellationToken)).ConfigureAwait(false);647 return await base.OnSavingAsync(entity, parameters, cancellationToken).ConfigureAwait(false);648 }649650 [AsyncStateMachine(typeof(_003C_CheckExceptionGranted_003Ed__3))]651 private static System.Threading.Tasks.Task _CheckExceptionGranted(LogicParameter lp)652 {653 //IL_0002: Unknown result type (might be due to invalid IL or missing references)654 //IL_0007: Unknown result type (might be due to invalid IL or missing references)655 _003C_CheckExceptionGranted_003Ed__3 _003C_CheckExceptionGranted_003Ed__ = default(_003C_CheckExceptionGranted_003Ed__3);656 _003C_CheckExceptionGranted_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();657 _003C_CheckExceptionGranted_003Ed__.lp = lp;658 _003C_CheckExceptionGranted_003Ed__._003C_003E1__state = -1;659 ((AsyncTaskMethodBuilder)(ref _003C_CheckExceptionGranted_003Ed__._003C_003Et__builder)).Start<_003C_CheckExceptionGranted_003Ed__3>(ref _003C_CheckExceptionGranted_003Ed__);660 return ((AsyncTaskMethodBuilder)(ref _003C_CheckExceptionGranted_003Ed__._003C_003Et__builder)).Task;661 }662663 [AsyncStateMachine(typeof(_003CGetIsExceptionAllowed_003Ed__4))]664 protected static async System.Threading.Tasks.Task<bool> GetIsExceptionAllowed(LogicParameter lp)665 {666 //IL_0002: Unknown result type (might be due to invalid IL or missing references)667 //IL_0007: Unknown result type (might be due to invalid IL or missing references)668 ISqlFormatter sqlFormatter = lp.SqlFormatter;669 string value = lp.Entity.GetValue<string>("UID_NonCompliance");670 if (string.IsNullOrEmpty(value))671 {672 return false;673 }674 string whereclause = sqlFormatter.AndRelation(sqlFormatter.UidComparison("UID_NonCompliance", value), sqlFormatter.Comparison("IsWorkingCopy", false, ValType.Bool));675 return await lp.Session.Source().GetSingleValueAsync<bool>("ComplianceRule", "IsExceptionAllowed", whereclause, lp.CancellationToken).ConfigureAwait(false);676 }677678 private System.Threading.Tasks.Task<MP> MakeDecision(ISession session, IEntity entity, string uidPerson, bool decision, string reason, string? uidJustfication = null, CancellationToken ct = default(CancellationToken))679 {680 //IL_0010: Unknown result type (might be due to invalid IL or missing references)681 return MakeDecision(session, entity, uidPerson, decision, reason, DbVal.DefaultValue<System.DateTime>(ValType.Date), uidJustfication, ct);682 }683684 [AsyncStateMachine(typeof(_003CMakeDecision_003Ed__6))]685 private async System.Threading.Tasks.Task<MP> MakeDecision(ISession session, IEntity entity, string uidPerson, bool decision, string reason, System.DateTime exceptionValidUntil, string? uidJustfication = null, CancellationToken ct = default(CancellationToken))686 {687 //IL_0002: Unknown result type (might be due to invalid IL or missing references)688 //IL_0007: Unknown result type (might be due to invalid IL or missing references)689 //IL_0052: Unknown result type (might be due to invalid IL or missing references)690 //IL_0054: Unknown result type (might be due to invalid IL or missing references)691 LogicParameter lp = new LogicParameter(session, null, entity, null, null, ct);692 bool adminContext = (string.Equals(uidPerson, "sa", (StringComparison)5) && lp.Session.User().IsAdministrativeAccount) || base.IsInternalProcess;693 bool flag = !adminContext;694 if (flag)695 {696 flag = !(await IsValidDecisionMakerAsync(lp, uidPerson).ConfigureAwait(false));697 }698 if (flag)699 {700 throw new ViException(2127241, ExceptionRelevance.EndUser);701 }702 if (reason != null && reason.Length > entity.Columns["DecisionReason"].MaxLen)703 {704 reason = reason.Substring(0, entity.Columns["DecisionReason"].MaxLen - 3) + "...";705 }706 entity.SetValue("UID_PersonDecisionMade", adminContext ? "" : uidPerson);707 entity.SetValue("DecisionDate", lp.ServerTime);708 entity.SetValue("IsDecisionMade", true);709 entity.SetValue("DecisionReason", reason);710 entity.SetValue("UID_QERJustification", uidJustfication);711 entity.SetValue("IsExceptionGranted", decision);712 if (!DbVal.IsEmpty(exceptionValidUntil, ValType.Date))713 {714 entity.SetValue("ExceptionValidUntil", exceptionValidUntil);715 }716 return new MP717 {718 Person = uidPerson,719 Granted = decision,720 Message = reason,721 Update = false,722 ValidUntil = exceptionValidUntil,723 Justification = uidJustfication724 };725 }726727 private System.Threading.Tasks.Task<bool> IsValidDecisionMaker(ISession session, IEntity entity, string uidPerson, CancellationToken ct = default(CancellationToken))728 {729 //IL_000a: Unknown result type (might be due to invalid IL or missing references)730 return IsValidDecisionMakerAsync(new LogicParameter(session, session.Resolve<IDbSession>(), entity, null, null, ct), uidPerson);731 }732733 [AsyncStateMachine(typeof(_003CDecision_OnSaving_003Ed__8))]734 private System.Threading.Tasks.Task Decision_OnSaving(IEntity entity, LogicReadWriteParameters parameter, MP mp, CancellationToken ct = default(CancellationToken))735 {736 //IL_0002: Unknown result type (might be due to invalid IL or missing references)737 //IL_0007: Unknown result type (might be due to invalid IL or missing references)738 //IL_0026: Unknown result type (might be due to invalid IL or missing references)739 //IL_0028: Unknown result type (might be due to invalid IL or missing references)740 _003CDecision_OnSaving_003Ed__8 _003CDecision_OnSaving_003Ed__ = default(_003CDecision_OnSaving_003Ed__8);741 _003CDecision_OnSaving_003Ed__._003C_003Et__builder = AsyncTaskMethodBuilder.Create();742 _003CDecision_OnSaving_003Ed__.entity = entity;743 _003CDecision_OnSaving_003Ed__.parameter = parameter;744 _003CDecision_OnSaving_003Ed__.mp = mp;745 _003CDecision_OnSaving_003Ed__.ct = ct;746 _003CDecision_OnSaving_003Ed__._003C_003E1__state = -1;747 ((AsyncTaskMethodBuilder)(ref _003CDecision_OnSaving_003Ed__._003C_003Et__builder)).Start<_003CDecision_OnSaving_003Ed__8>(ref _003CDecision_OnSaving_003Ed__);748 return ((AsyncTaskMethodBuilder)(ref _003CDecision_OnSaving_003Ed__._003C_003Et__builder)).Task;749 }750751 [AsyncStateMachine(typeof(_003CIsValidDecisionMakerAsync_003Ed__9))]752 private static async System.Threading.Tasks.Task<bool> IsValidDecisionMakerAsync(LogicParameter lp, string uidPerson)753 {754 //IL_0002: Unknown result type (might be due to invalid IL or missing references)755 //IL_0007: Unknown result type (might be due to invalid IL or missing references)756 ISqlFormatter fSql = lp.SqlFormatter;757 bool num = DbVal.ConvertTo<bool>(await lp.Session.Config().GetConfigParmAsync("QER\\ComplianceCheck\\DisableSelfExceptionGranting", lp.CancellationToken).ConfigureAwait(false));758 string text = null;759 if (num)760 {761 text = string.Format("and not {0} in ( select UID_Person from {1} )", (object)fSql.FormatUidValue(lp.Entity.GetValue<string>("UID_Person")), (object)fSql.InlineFunctionCall(new SqlFunction("QER", "GGetInfo", "FTPersonsAreMe")762 {763 TableFunction = true764 }, fSql.FormatUidValue(uidPerson)));765 }766 string systemIdentifier = lp.Session.Database().SystemIdentifier;767 global::_003C_003Ey__InlineArray3<object> buffer = default(global::_003C_003Ey__InlineArray3<object>);768 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 0) = fSql.FormatUidValue(lp.Entity.GetValue<string>("UID_NonCompliance"));769 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 1) = fSql.FormatUidValue(uidPerson);770 global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<global::_003C_003Ey__InlineArray3<object>, object>(ref buffer, 2) = text;771 string sqlStatement = SqlStrings.Format(systemIdentifier, "PersonInNonCompliance_IsValidDecisionMaker", global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<global::_003C_003Ey__InlineArray3<object>, object>(in buffer, 3));772 return DbVal.ConvertTo<bool>(await lp.DbSession.SqlExecuteScalarAsync(sqlStatement, lp.CancellationToken).ConfigureAwait(false));773 }774}775