Example #1
0
        public virtual bool addRequestToBatch(DestroyRequest request, RequestTutor tutor, RequestListener listener)
        {
            if (this.batchType != CONTROL)
            {
                log.Error("Unexpected request type was given to batch");
                return(false);
            }

            string key = request.Session;

            RequestObjects requestObj = new RequestObjects(request, tutor, listener);

            RequestObjects queuedRequest = null;

            keys.TryGetValue(key, out queuedRequest);

            if (queuedRequest != null)
            {
                log.Debug("Substituting DESTROY request");
                queuedRequest.tutor.notifyAbort();
                this.substituteRequest(key, requestObj);
            }
            else
            {
                this.addRequestInternal(key, requestObj);
            }

            return(true);
        }
Example #2
0
        public async Task <IActionResult> Destroy([FromBody] DestroyRequest model)
        {
            if (model.Amount <= 0)
            {
                throw new BackendException("Amount can't be less or equal to zero", ErrorCode.BadInputParameter);
            }

            await ValidateAddress(model.Address);

            var asset = await _assetRepository.GetItemAsync(model.Asset);

            if (asset == null)
            {
                throw new BackendException("Provided Asset is missing in database", ErrorCode.AssetNotFound);
            }

            var transactionId = await _builder.AddTransactionId(model.TransactionId, $"Destroy: {model.ToJson()}");

            await _transactionQueueWriter.AddCommand(transactionId, TransactionCommandType.Destroy, new DestroyCommand
            {
                Amount  = model.Amount,
                Asset   = model.Asset,
                Address = model.Address,
            }.ToJson());

            return(Ok(new TransactionIdResponse
            {
                TransactionId = transactionId
            }));
        }
        public void DeleteObjects <T>(List <T> lstObj) where T : class, new()
        {
            List <GenericObject> lstgenericObject = new List <GenericObject>();

            foreach (T sam in lstObj)
            {
                ID autoID = new ID();

                Type objType      = typeof(T);
                var  objAttribute = objType.GetCustomAttributes(typeof(RightNowCustomObjectAttribute), true).FirstOrDefault() as RightNowCustomObjectAttribute;
                if (objAttribute == null)
                {
                    throw new InvalidOperationException("The type provided is not a RightNow custom object type. Please use the RightNowObjectAttribute to associate the proper metadata with the type");
                }

                GenericObject genericObject = new GenericObject();
                RNObjectType  rnObjType     = new RNObjectType()
                {
                    Namespace = objAttribute.PackageName, TypeName = objAttribute.ObjectName
                };
                genericObject.ObjectType = rnObjType;

                List <GenericField> genericFields = new List <GenericField>();
                PropertyInfo[]      properties    = objType.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    RightNowCustomObjectFieldAttribute attribute = property.GetCustomAttributes(typeof(RightNowCustomObjectFieldAttribute), true).FirstOrDefault() as RightNowCustomObjectFieldAttribute;
                    if (attribute != null && attribute.CanUpdate)
                    {
                        var propValue = property.GetValue(sam, null);
                        //if (!string.IsNullOrWhiteSpace(propValue.ToString())) && !string.IsNullOrWhiteSpace(propValue.ToString())
                        if (propValue != null && !string.IsNullOrWhiteSpace(propValue.ToString()))
                        {
                            genericFields.Add(createGenericField(attribute, propValue));
                        }
                    }
                    else
                    {
                        if (attribute.Name == "ID")
                        {
                            var propValue = property.GetValue(sam, null);
                            autoID.id = Convert.ToInt64(propValue);
                        }
                    }
                }

                genericObject.GenericFields = genericFields.ToArray();

                autoID.idSpecified = true;
                genericObject.ID   = autoID;
                lstgenericObject.Add(genericObject);
            }
            DestroyProcessingOptions options = new DestroyProcessingOptions();

            options.SuppressExternalEvents = false;
            options.SuppressRules          = false;
            RNObject[]      rnobj           = lstgenericObject.ToArray <RNObject>();
            DestroyRequest  destroyRequest  = new DestroyRequest(getClientInfoHeader(), rnobj, options);
            DestroyResponse destroyResponse = getChannel().Destroy(destroyRequest);
        }
        public void DeleteObject <T>(long uniqueId) where T : class, new()
        {
            Type objType      = typeof(T);
            var  objAttribute = objType.GetCustomAttributes(typeof(RightNowCustomObjectAttribute), true).FirstOrDefault() as RightNowCustomObjectAttribute;

            if (objAttribute == null)
            {
                throw new InvalidOperationException("The type provided is not a RightNow custom object type. Please use the RightNowObjectAttribute to associate the proper metadata with the type");
            }

            GenericObject genericObject = new GenericObject();
            RNObjectType  rnObjType     = new RNObjectType()
            {
                Namespace = objAttribute.PackageName, TypeName = objAttribute.ObjectName
            };

            genericObject.ObjectType = rnObjType;

            List <GenericField> genericFields = new List <GenericField>();

            genericObject.GenericFields = genericFields.ToArray();
            ID autoID = new ID();

            autoID.id          = uniqueId;
            autoID.idSpecified = true;
            genericObject.ID   = autoID;

            DestroyProcessingOptions options = new DestroyProcessingOptions();

            options.SuppressExternalEvents = false;
            options.SuppressRules          = false;
            DestroyRequest  destroyRequest  = new DestroyRequest(getClientInfoHeader(), new RNObject[] { genericObject }, options);
            DestroyResponse destroyResponse = getChannel().Destroy(destroyRequest);
        }
        public async Task <string> Destroy()
        {
            var request = new DestroyRequest();
            var result  = await SendJanusRequest <SuccessJanus>(request, false);

            return(result.Janus);
        }
        public async Task <OnchainResponse> DestroyAsync(DestroyData data)
        {
            var request = new DestroyRequest(data.TransactionId, data.Address, data.AssetId, (decimal)data.Amount);

            var response = await _apiClient.ApiEnqueueTransactionDestroyPostAsync(request);

            return(PrepareOnchainResult(response));
        }
Example #7
0
 public override void OnEvent(DestroyRequest evnt)
 {
     if (evnt.Entity.IsOwner)
     {
         //evnt.Entity.GetState<ICustomCapsule>().OnDead();
         BoltNetwork.Destroy(evnt.Entity.gameObject);
     }
 }
Example #8
0
        public async void RequestsDestroyContainerFromManager()
        {
            container.GetInfoAsync().ReturnsTask(new ContainerInfo()
            {
                State = ContainerState.Active
            });

            var request = new DestroyRequest()
            {
                Handle = "containerHandle",
            };

            var handler = new DestroyRequestHandler(manager, request);

            var response = await handler.HandleAsync();

            manager.Received(1, x => x.DestroyContainerAsync(Arg.Is <ContainerHandle>(h => h.ToString() == "containerHandle")));
        }
Example #9
0
    void Awake()
    {
        Joystick          = transform.Find("Joystick").GetComponent <ETCJoystick>();
        showTimerRequest  = GetComponent <ShowTimerRequest>();
        startPlayRequest  = GetComponent <StartPlayRequest>();
        gameOverRequest   = GetComponent <GameOverRequest>();
        quitBattleRequest = GetComponent <QuitBattleRequest>();
        quitGameRequest   = GetComponent <QuitGameRequest>();
        destroyRequest    = GetComponent <DestroyRequest>();
        gameChatRequest   = GetComponent <GameChatRequest>();
        knapsack          = transform.Find("KnapsackPanel").GetComponent <Knapsack>();
        for (int i = 0; i < 3; i++)
        {
            skillPos.Add(transform.Find("Skill" + i));
        }

        roleSelectPanel = transform.Find("RoleSelectPanel");

        timer        = transform.Find("TimerPanel/Time").GetComponent <Text>();
        gameOverText = transform.Find("GameOverPanel/GameOver").GetComponent <Text>();
        closeButton  = transform.Find("GameOverPanel/CloseButton").GetComponent <Button>();
        closeButton.onClick.AddListener(OnCloseClick);

        EffectDict    = facade.GetEffectDict();
        SkillItemDict = facade.GetSkillItemDict();

        transform.Find("SettingPanel/QuitGameButton").GetComponent <Button>().onClick.AddListener(OnQuitGameClick);

        chatDialog = transform.Find("ChatDialog");
        sendButton = transform.Find("ChatDialog/InputPanel/SendButton");
        chatButton = transform.Find("ChatDialog/ChatButton").GetComponent <Button>();
        inputField = transform.Find("ChatDialog/InputPanel/InputField").GetComponent <InputField>();
        sendButton.GetComponent <Button>().onClick.AddListener(OnSendClick);
        chatButton.onClick.AddListener(OnChatClick);
        inputField.onEndEdit.AddListener(x => OnSendClick());

        OtherPlayerChatMsgItem = Resources.Load <GameObject>("UIItem/Chat/OtherPlayerChatMsgItem");
        LocalPlayerChatMsgItem = Resources.Load <GameObject>("UIItem/Chat/LocalPlayerChatMsgItem");
        ChangeSeatItem         = Resources.Load <GameObject>("UIItem/ChangeSeatItem");
    }
        public void DestroyReasoncodes(long config)
        {
            List <RNObject> destroyfields = new List <RNObject>();

            List <ScreenPopOptions> profiledata = new List <ScreenPopOptions>(GetObjects <ScreenPopOptions>(string.Format(" where ScreenPopConfigID={0}", config)));

            foreach (ScreenPopOptions rn in profiledata)
            {
                _icGenericObject            = new GenericObject();
                _rnObjType.Namespace        = OracleCtiObjectStrings.ScreenPopPackageName;
                _rnObjType.TypeName         = OracleCtiObjectStrings.ScreenPopOptions;
                _icGenericObject.ObjectType = _rnObjType;
                NamedID relationid = new NamedID();
                ID      incID      = new ID();
                incID.id          = config;
                incID.idSpecified = true;
                relationid.ID     = incID;

                ID rowid = new ID();
                rowid.id            = rn.ID;
                rowid.idSpecified   = true;
                _icGenericObject.ID = rowid;

                List <GenericField> gfs = new List <GenericField>();
                //gfs.Add(createGenericField("AgentEntityID", ItemsChoiceType.NamedIDValue, relationid));
                _icGenericObject.GenericFields = gfs.ToArray();
                destroyfields.Add(_icGenericObject);
            }

            if (destroyfields.Count() > 0)
            {
                DestroyProcessingOptions drop = new DestroyProcessingOptions();
                drop.SuppressExternalEvents = false;
                drop.SuppressRules          = false;
                DestroyRequest  destroyReq = new DestroyRequest(getClientInfoHeader(), destroyfields.ToArray(), drop);
                DestroyResponse destroyRes = getChannel().Destroy(destroyReq);
            }
        }
Example #11
0
 public DestroyRequestHandler(IContainerManager containerManager, Request request)
     : base(containerManager, request)
 {
     this.request = (DestroyRequest)request;
 }
 protected override void forwardDestroyRequest(DestroyRequest request, RequestTutor tutor, RequestListener reqListener)
 {
     // don't send destroy request when transport is http
 }
Example #13
0
 protected override void forwardDestroyRequest(DestroyRequest request, RequestTutor tutor, RequestListener reqListener)
 {
     wsRequestManager.addRequest(request, tutor, reqListener);
 }
 /// <summary>
 /// Add destroy transaction to queue for building
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task <object> ApiEnqueueTransactionDestroyPostAsync(this IBitcoinApi operations, DestroyRequest model = default(DestroyRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.ApiEnqueueTransactionDestroyPostWithHttpMessagesAsync(model, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Add destroy transaction to queue for building
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 public static object ApiEnqueueTransactionDestroyPost(this IBitcoinApi operations, DestroyRequest model = default(DestroyRequest))
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IBitcoinApi)s).ApiEnqueueTransactionDestroyPostAsync(model), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public DestroyRequestHandler(IContainerManager containerManager, Request request)
     : base(containerManager, request)
 {
     this.request = (DestroyRequest)request;
 }
 /// <summary>
 /// Add destroy transaction to queue for building
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 public static object ApiEnqueueTransactionDestroyPost(this IBitcoinApi operations, DestroyRequest model = default(DestroyRequest))
 {
     return(operations.ApiEnqueueTransactionDestroyPostAsync(model).GetAwaiter().GetResult());
 }