QER.CompositionApi.Server.PlugIn/QER.CompositionApi.ITShop/RequestUnsubscribeApi.cs
Decompiler Source FileQER.CompositionApi.Server.PlugIn.RequestUnsubscribeApiDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- CallMethodAsync: Unsubscribe at line 40
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 IT Shop related markers
Summary: classes RequestUnsubscribeApi; methods Build; references AccProduct, ITShopOrg, Person, PersonWantsOrg, ShoppingCartItem, ShoppingCartOrder; markers reads entity values, references DB/Dialog objects, IT Shop related markers
Classes
RequestUnsubscribeApiMethods
DB/Dialog object references
OIM key/entity markers
UID_PersonInserted UID_ShoppingCartOrder UID_PersonWantsOrg UID_PersonOrdered UID_ITShopOrg UID_Org UID_AccProduct UID_ShoppingCartItemAPI/entity calls
GetValueAsync GetValue StartUnitOfWork From Source User PutValuesAsyncRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections.Generic;3using System.Runtime.CompilerServices;4using System.Threading;5using System.Threading.Tasks;6using System.Web;7using QBM.CompositionApi;8using QBM.CompositionApi.Definition;9using QBM.CompositionApi.Handling;10using QER.CompositionApi.Config;11using QER.CompositionApi.Portal;12using VI.Base;13using VI.DB;14using VI.DB.Entities;1516namespace QER.CompositionApi.ITShop;1718public class RequestUnsubscribeApi : IApiProviderFor<PortalApiProject>, IApiProvider19{20 public void Build(IApiBuilder builder)21 {22 builder.AddMethod(Method.Define("itshop/unsubscribe").Handle<PwoUnsubscribeInput, PwoUnsubscribeResult>("POST", (Func<PwoUnsubscribeInput, IRequest, CancellationToken, System.Threading.Tasks.Task<PwoUnsubscribeResult>>)([AsyncStateMachine(typeof(_003C_003Ec__DisplayClass0_0._003C_003CBuild_003Eb__0_003Ed))] async (PwoUnsubscribeInput input, IRequest qr, CancellationToken ct) =>23 {24 //IL_0002: Unknown result type (might be due to invalid IL or missing references)25 //IL_0007: Unknown result type (might be due to invalid IL or missing references)26 //IL_0026: Unknown result type (might be due to invalid IL or missing references)27 //IL_0027: Unknown result type (might be due to invalid IL or missing references)28 bool withoutCart = builder.Resolver.Resolve<QerProjectConfig>().ITShopConfig.VI_ITShop_ProlongateOrCancel_Without_ShoppingCartOrder;29 AsyncLazy<string> uidCartOrder = new AsyncLazy<string>([AsyncStateMachine(typeof(_003C_003Ec__DisplayClass0_1._003C_003CBuild_003Eb__1_003Ed))] async (CancellationToken cx) => await new CartSelection().GetOrCreateCartAsync(qr.Session, cx).ConfigureAwait(false), (LazyThreadSafetyMode)2);30 List<string> cartItems = new List<string>();31 using (IUnitOfWork u = qr.Session.StartUnitOfWork())32 {33 string[] uidPwo = input.UidPwo;34 foreach (string primaryKeyValue in uidPwo)35 {36 Query query = Query.From("PersonWantsOrg").SelectAll().Where((IDbObjectKey)new DbObjectKey("PersonWantsOrg", primaryKeyValue));37 IEntity pwo = await qr.Session.Source().GetAsync(query, EntityLoadType.Interactive, ct).ConfigureAwait(false);38 if (withoutCart)39 {40 await pwo.CallMethodAsync("Unsubscribe", qr.Session.User().Uid, input.Reason, input.UidJustification, input.UnsubscribeFrom.GetValueOrDefault(), ct).ConfigureAwait(false);41 await u.PutAsync(pwo, ct).ConfigureAwait(false);42 }43 else44 {45 if (!RequestHistoryApi.IsUnsubscribeRequestAllowed(pwo, qr.Session))46 {47 throw new HttpException(400, "This method cannot be called for this request.");48 }49 IEntity cartItem = await qr.Session.Source().CreateNewAsync("ShoppingCartItem", null, ct).ConfigureAwait(false);50 string text;51 string[] array;52 if (input.UidJustification == null && !input.UnsubscribeFrom.HasValue)53 {54 text = "UnSubscribe(string, string)";55 array = new string[2]56 {57 qr.Session.User().Uid,58 input.Reason59 };60 }61 else62 {63 text = "UnSubscribe(string, string, string, DateTime)";64 array = new string[4]65 {66 qr.Session.User().Uid,67 input.Reason,68 input.UidJustification,69 input.UnsubscribeFrom.GetValueOrDefault().ToString((IFormatProvider)(object)IsoInvariantCulture.Culture)70 };71 }72 IEntity entity = cartItem;73 ValueTuple<string, object> val = new ValueTuple<string, object>("UID_PersonInserted", (object)qr.Session.User().Uid);74 ValueTuple<string, object> val2 = new ValueTuple<string, object>("MethodName", (object)text);75 ValueTuple<string, object> val3 = new ValueTuple<string, object>("MethodParameters", (object)string.Join("\a", array));76 string text2 = await uidCartOrder.GetValueAsync(ct).ConfigureAwait(false);77 await entity.PutValuesAsync(new ValueTuple<string, object>[8]78 {79 val,80 val2,81 val3,82 new ValueTuple<string, object>("UID_ShoppingCartOrder", (object)text2),83 new ValueTuple<string, object>("UID_PersonWantsOrg", (object)pwo.GetValue("UID_PersonWantsOrg")),84 new ValueTuple<string, object>("UID_PersonOrdered", (object)pwo.GetValue("UID_PersonOrdered")),85 new ValueTuple<string, object>("UID_ITShopOrg", (object)pwo.GetValue("UID_Org")),86 new ValueTuple<string, object>("UID_AccProduct", (object)pwo.GetValue("FK(UID_Org).UID_AccProduct"))87 }, ct).ConfigureAwait(false);88 await u.PutAsync(cartItem, ct).ConfigureAwait(false);89 cartItems.Add((string)cartItem.GetValue("UID_ShoppingCartItem"));90 }91 }92 await u.CommitAsync(ct).ConfigureAwait(false);93 }94 return new PwoUnsubscribeResult95 {96 UidCartItem = cartItems.ToArray()97 };98 })));99 }100}101