Common.Customizer/VI.Common.Customizer/DialogSchedule.cs
Decompiler Source FileCommon.Customizer.DialogScheduleDecompiled 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: StartNow at line 101
- Function registration: GetReferences at line 116
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 DialogSchedule; methods _CheckFrequency, _GetFrequencyType; references DialogSchedule; markers reads entity values, references DB/Dialog objects
Classes
DialogScheduleDB/Dialog object references
OIM key/entity markers
UID_DialogScheduleAPI/entity calls
TryResult GetValueAsyncRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections.Generic;3using System.Data;4using System.Linq;5using System.Runtime.CompilerServices;6using System.Threading;7using VI.Base;8using VI.DB;9using VI.DB.DataAccess;10using VI.DB.Entities;1112namespace VI.Common.Customizer;1314public class DialogSchedule : StateLessEntityLogic15{16 private enum _FrequencyType17 {18 None,19 Min,20 Hour,21 Day,22 Week,23 Month,24 Year,25 WD_Mo,26 WD_Tu,27 WD_Th,28 WD_We,29 WD_Fr,30 WD_Sa,31 WD_Su32 }3334 public DialogSchedule()35 {36 CanSee("FrequencySubType").Default(value: false);37 CanSee("StartTime").Default(value: false);38 CanEdit("LastRun").Default(value: false);39 CanEdit("NextRun").From("[IsLoaded]").As<bool>((Func<bool, bool>)((bool l) => !l));40 CanEdit("FrequencySubType").From("FrequencyType").As<string>((Func<string, bool>)((string ft) => _GetFrequencyType(ft) >= _FrequencyType.Week)).ClearValueOnFalse()41 .HiddenWhenDisabled();42 MinLen("FrequencySubType").Except("SPECIAL(IsTransport)").From("FrequencyType").As<string>((Func<string, int>)delegate(string fts)43 {44 _FrequencyType frequencyType = _GetFrequencyType(fts);45 return (frequencyType == _FrequencyType.Week || frequencyType == _FrequencyType.Month || frequencyType == _FrequencyType.Year) ? 1 : 0;46 });47 CanEdit("StartTime").From("FrequencyType").As<string>((Func<string, bool>)((string ft) => _GetFrequencyType(ft) >= _FrequencyType.Day)).ClearValueOnFalse()48 .MandatoryWhenEnabled()49 .HiddenWhenDisabled();50 Value("StartTime").From("StartTime").As<string, TryResult<string>>((string st) => (!string.IsNullOrEmpty(st)) ? TryResult<string>.Failed : TryResult.FromResult("00:00"));51 Value("Frequency").Default(1);52 Value("Frequency").From("Frequency", "FrequencyType").As<int, string, TryResult<int>>((int f, string ft) => (!_CheckFrequency(ft, f, bThrow: false)) ? TryResult.FromResult(1) : TryResult.FromResult(f));53 Check("Frequency").With("FrequencyType").As<int, string>((Func<int, string, bool>)delegate(int f, string ft)54 {55 _CheckFrequency(ft, f, bThrow: true);56 return true;57 });58 Value("FrequencySubType").From("FrequencySubType", "FrequencyType").As<string, string, TryResult<int>>(delegate(string st, string ft)59 {60 _FrequencyType frequencyType = _GetFrequencyType(ft);61 return ((uint)(frequencyType - 4) <= 2u) ? ((!string.IsNullOrEmpty(st)) ? TryResult<int>.Failed : TryResult.FromResult(1)) : TryResult<int>.Failed;62 });63 Value("FrequencySubType").From("FrequencySubType", "FrequencyType").As<string, string, TryResult<string>>(delegate(string st, string ft)64 {65 int num = -1;66 switch (_GetFrequencyType(ft))67 {68 case _FrequencyType.Week:69 num = 7;70 break;71 case _FrequencyType.Month:72 num = 31;73 break;74 case _FrequencyType.Year:75 num = 366;76 break;77 }78 if (num == -1)79 {80 return TryResult<string>.Failed;81 }82 MultiValueProperty multiValueProperty = new MultiValueProperty(st);83 bool flag = false;84 for (int i = 0; i < multiValueProperty.Count; i++)85 {86 int num2 = int.Parse(multiValueProperty[i]);87 if (num2 < 1)88 {89 multiValueProperty[i] = 1.ToString();90 flag = true;91 }92 if (num2 > num)93 {94 multiValueProperty[i] = num.ToString();95 flag = true;96 }97 }98 MultiValueProperty multiValueProperty2 = new MultiValueProperty(Enumerable.Distinct<string>((System.Collections.Generic.IEnumerable<string>)multiValueProperty, (IEqualityComparer<string>)(object)StringComparer.Ordinal));99 return (!flag && multiValueProperty2.Count == multiValueProperty.Count) ? TryResult<string>.Failed : TryResult.FromResult(multiValueProperty2.Value);100 });101 RegisterMethod("StartNow").As([AsyncStateMachine(typeof(_003C_003Ec._003C_003C_002Dctor_003Eb__1_9_003Ed))] (ISession s, IEntity e, CancellationToken ct) =>102 {103 //IL_0002: Unknown result type (might be due to invalid IL or missing references)104 //IL_0007: Unknown result type (might be due to invalid IL or missing references)105 //IL_001e: Unknown result type (might be due to invalid IL or missing references)106 //IL_001f: Unknown result type (might be due to invalid IL or missing references)107 _003C_003Ec._003C_003C_002Dctor_003Eb__1_9_003Ed _003C_003C_002Dctor_003Eb__1_9_003Ed = default(_003C_003Ec._003C_003C_002Dctor_003Eb__1_9_003Ed);108 _003C_003C_002Dctor_003Eb__1_9_003Ed._003C_003Et__builder = AsyncTaskMethodBuilder.Create();109 _003C_003C_002Dctor_003Eb__1_9_003Ed.s = s;110 _003C_003C_002Dctor_003Eb__1_9_003Ed.e = e;111 _003C_003C_002Dctor_003Eb__1_9_003Ed.ct = ct;112 _003C_003C_002Dctor_003Eb__1_9_003Ed._003C_003E1__state = -1;113 ((AsyncTaskMethodBuilder)(ref _003C_003C_002Dctor_003Eb__1_9_003Ed._003C_003Et__builder)).Start<_003C_003Ec._003C_003C_002Dctor_003Eb__1_9_003Ed>(ref _003C_003C_002Dctor_003Eb__1_9_003Ed);114 return ((AsyncTaskMethodBuilder)(ref _003C_003C_002Dctor_003Eb__1_9_003Ed._003C_003Et__builder)).Task;115 }).Behavior(MethodBehavior.ChangesExternalState).Description("Method_DialogSchedule_StartNow");116 RegisterFunction("GetReferences").As<string[][]>([AsyncStateMachine(typeof(_003C_003Ec._003C_003C_002Dctor_003Eb__1_10_003Ed))] async (ISession s, IEntity e, CancellationToken ct) =>117 {118 //IL_0002: Unknown result type (might be due to invalid IL or missing references)119 //IL_0007: Unknown result type (might be due to invalid IL or missing references)120 //IL_001e: Unknown result type (might be due to invalid IL or missing references)121 //IL_001f: Unknown result type (might be due to invalid IL or missing references)122 IDbSession dbSession = s.Resolve<IDbSession>();123 ISqlFormatter f = dbSession.SqlFormatter;124 string value = await e.GetValueAsync<string>("UID_DialogSchedule", ct).ConfigureAwait(false);125 string systemIdentifier = s.Database().SystemIdentifier;126 object obj = f.FormatUidValue(value);127 string sqlStatement = SqlStrings.Format(systemIdentifier, "QBM_DialogSchedule_GetReferences", new System.ReadOnlySpan<object>(ref obj));128 List<string[]> lResult = new List<string[]>();129 IDataReader val = (IDataReader)(object)(await dbSession.SqlExecuteAsync(sqlStatement, ct).ConfigureAwait(false));130 try131 {132 while (val.Read())133 {134 string[] array = new string[3]135 {136 ((IDataRecord)val).GetString(0),137 ((IDataRecord)val).GetString(1),138 ((IDataRecord)val).GetString(2)139 };140 lResult.Add(array);141 }142 }143 finally144 {145 ((System.IDisposable)val)?.Dispose();146 }147 return ((System.Collections.Generic.IEnumerable<string[]>)lResult).ToArraySmart();148 }).Description("Method_DialogSchedule_GetReferences");149 }150151 private static bool _CheckFrequency(string ft, int f, bool bThrow)152 {153 int num = 1;154 int num2 = 2147483647;155 _FrequencyType frequencyType = _GetFrequencyType(ft);156 if ((uint)(frequencyType - 7) <= 6u)157 {158 num = -2;159 num2 = 4;160 if (f == 0)161 {162 if (bThrow)163 {164 throw new ViException(882135, ExceptionRelevance.EndUser, "Frequency", "0");165 }166 return false;167 }168 }169 if (f < num)170 {171 if (bThrow)172 {173 throw new ViException(882128, ExceptionRelevance.EndUser, "Frequency", num - 1);174 }175 return false;176 }177 if (f > num2)178 {179 if (bThrow)180 {181 throw new ViException(882132, ExceptionRelevance.EndUser, "Frequency", num2 + 1);182 }183 return false;184 }185 return true;186 }187188 private static _FrequencyType _GetFrequencyType(string type)189 {190 if (string.IsNullOrEmpty(type))191 {192 return _FrequencyType.None;193 }194 return (_FrequencyType)System.Enum.Parse(typeof(_FrequencyType), type, true);195 }196}197