Beispiel #1
0
        private async Task <OperationResult <PushTransactionResults> > BulkTransfer(AccountDump[] accounts, CancellationToken token)
        {
            var actions = new BaseAction[accounts.Length];

            for (int i = 0; i < accounts.Length; i++)
            {
                var account = accounts[i];
                actions[i] = new TransferAction
                {
                    Account = TransferAction.ContractName,
                    Args    = new Transfer
                    {
                        From     = _login,
                        To       = account.AccountName,
                        Quantity = account.Airdrop,
                        Memo     = string.Empty
                    },
                    Authorization = new[]
                    {
                        new PermissionLevel
                        {
                            Actor      = _login,
                            Permission = "active"
                        }
                    }
                };
            }
            return(await Api.BroadcastActions(actions, _privateKeys, token));
        }
        public SerializationTransferAction(TransferAction transferAction)
        {
            AmountOfMoney = transferAction.AmountOfMoney;
            TransferType  = transferAction.GetStringType();

            Date = transferAction.Date.Json();
        }
Beispiel #3
0
 public InnerTransferPromptFilterWorker(TransferPromptModel model, TransferPromptController controller,
                                        Transfer transfer, TransferAction action, TransferItemCache cache)
     : base(transfer, action, cache, controller)
 {
     _model      = model;
     _controller = controller;
 }
Beispiel #4
0
        public ActionResult StartTransfer(int regId)
        {
            if (!IsRegistrationAlreadyInCart(regId))
            {
                var itemId    = Guid.NewGuid();
                var newAction = new TransferAction
                {
                    RegistrationId = regId
                };
                var newCartItem = new ActionItem
                {
                    ActionType           = CartActionType.TransferRregistration,
                    ActionObject         = newAction,
                    ItemReadyForCheckout = false
                };

                SessionManager.CurrentCart.ActionItems.Add(itemId, newCartItem);
                SessionManager.CurrentCart.CheckOutFocus = CartFocusType.TransferEvent;

                return(RedirectToAction("transfer", "registration", new { itemId }));
            }
            SessionManager.CurrentCart.CheckOutFocus = CartFocusType.CancelEvent;

            return(RedirectToAction("checkout", "cart"));
        }
Beispiel #5
0
        private void Space_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                foreach (var file in files)
                {
                    FileAttributes attr = File.GetAttributes(file);

                    if (!((attr & FileAttributes.Directory) == FileAttributes.Directory))
                    {
                        this.lastSent.Content = file;
                        TransferAction.Invoke(file);
                    }
                }
            }
            if (e.Data.GetDataPresent(DataFormats.Text))
            {
                string text = (string)e.Data.GetData(DataFormats.Text);
                //Sending text function here if first if doesn't work for text as well
                this.lastSent.Content = text;
                //TransferAction.Invoke(text);
            }

            FinishAction("Finished adding files");
            var tsPanel = sender as StackPanel;

            tsPanel.Background = Brushes.Gray;
        }
Beispiel #6
0
        public TransferAction Transfer()
        {
            var transferAction = new TransferAction(this);

            Console.WriteLine("Select card for transfer. Press 0 to select another action");
            var input = Console.ReadLine();

            if (string.IsNullOrEmpty(input))
            {
                return(transferAction);
            }

            int selected;

            while (!int.TryParse(input, out selected))
            {
                Console.WriteLine("Incorrect input, please reneter");
            }
            if (selected <= 0)
            {
                return(null);
            }


            if (!transferAction.SelectTransferCard(Hand[selected - 1]))
            {
                Console.WriteLine("You can select this card. Please try again");
                return(Transfer());
            }
            return(transferAction);
        }
Beispiel #7
0
        public decimal GetTransferQuantity(TransferAction action, IUserSettings userSettings)
        {
            var transfers = Operations
                            .Where(o =>
                                   o.TransferAction == action &&
                                   o.Contract.Address == ContractAddress);

            var pricePerToken = default(decimal?);

            switch (action)
            {
            case TransferAction.Inbound:
                pricePerToken = transfers
                                .Where(x => x.Recipient.Equals(userSettings.WalletAddress, StringComparison.OrdinalIgnoreCase))
                                .Sum(x => x.Quantity);
                break;

            case TransferAction.Outbound:
                pricePerToken = transfers
                                .Where(x => x.Sender.Equals(userSettings.WalletAddress, StringComparison.OrdinalIgnoreCase))
                                .Sum(x => x.Quantity);
                break;
            }

            if (!pricePerToken.HasValue)
            {
                pricePerToken = transfers.Sum(x => x.Quantity);
            }

            return(pricePerToken ?? decimal.Zero);
        }
Beispiel #8
0
        public void Test_Execute()
        {
            IIntrusionDetector detector = Esapi.IntrusionDetector;

            string         url    = Guid.NewGuid().ToString();
            TransferAction action = new TransferAction(url);

            // Set context
            MockHttpContext.InitializeCurrentContext();
            SurrogateWebPage page = new SurrogateWebPage();

            HttpContext.Current.Handler = page;

            // Block
            try {
                Assert.AreNotEqual(HttpContext.Current.Request.RawUrl, action.Url);
                action.Execute(ActionArgs.Empty);

                Assert.Fail("Request not terminated");
            }
            catch (Exception exp) {
                // FIXME : so far there is no other way to test the transfer except to check
                // the stack of the exception. Ideally we should be able to mock the request
                // transfer itself
                Assert.IsTrue(exp.StackTrace.Contains("at System.Web.HttpServerUtility.TransferRequest(String path)"));
            }
        }
Beispiel #9
0
        public virtual TransferAction prompt()
        {
            Log.debug("prompt:" + Transfer);
            for (int i = 0; i < Transfer.getRoots().size(); i++)
            {
                Path next = (Path)Transfer.getRoots().get(i);
                if (TransferPromptModel.Filter().accept(next))
                {
                    TransferPromptModel.Add(next);
                }
            }

            AsyncDelegate wireAction = delegate
            {
                Transfer.getSession().addProgressListener(
                    _progressListener = new StatusLabelProgressListener(this));

                View.ToggleDetailsEvent += View_ToggleDetailsEvent;
                View.DetailsVisible      = Preferences.instance().getBoolean(
                    "transfer.toggle.details");

                View.ChangedActionEvent    += View_ChangedActionEvent;
                View.ChangedSelectionEvent += View_ChangedSelectionEvent;

                View.ModelCanExpandDelegate      = TransferPromptModel.CanExpand;
                View.ModelChildrenGetterDelegate = TransferPromptModel.ChildrenGetter;
                View.ModelCheckStateGetter       = TransferPromptModel.GetCheckState;
                View.ModelCheckStateSetter       = TransferPromptModel.SetCheckState;
                View.ModelSizeGetter             = TransferPromptModel.GetSize;
                View.ModelSizeAsStringGetter     = TransferPromptModel.GetSizeAsString;
                View.ModelFilenameGetter         = TransferPromptModel.GetName;
                View.ModelIconGetter             = TransferPromptModel.GetIcon;
                View.ModelWarningGetter          = TransferPromptModel.GetWarningImage;
                View.ModelCreateGetter           = TransferPromptModel.GetCreateImage;
                View.ModelSyncGetter             = TransferPromptModel.GetSyncGetter;
                View.ModelActiveGetter           = TransferPromptModel.IsActive;

                View.ItemsChanged += UpdateStatusLabel;
                View.SetModel(TransferPromptModel.GetEnumerator());

                //select first one if there is any
                IEnumerator <TreePathReference> en =
                    TransferPromptModel.GetEnumerator().GetEnumerator();
                if (en.MoveNext())
                {
                    View.SelectedPath = en.Current;
                }

                DialogResult result = View.ShowDialog(_parent.View);

                if (result == DialogResult.Cancel)
                {
                    Action = TransferAction.ACTION_CANCEL;
                }
            };

            _parent.Invoke(wireAction, true);
            return(Action);
        }
Beispiel #10
0
        public void TransferAction(IInBitStream bitstream, ref TransferAction data)
        {
            data.participant = bitstream.ReadIntegerRange(15, -9999);



            data.accepted = bitstream.ReadBool();
        }
Beispiel #11
0
 public FilterAction(TransferPromptModel model, TransferPromptController controller,
                     SessionPool source, SessionPool destination,
                     Transfer transfer, TransferAction action, TransferItemCache cache)
     : base(
         controller, source,
         new InnerTransferPromptFilterWorker(model, controller, transfer, action, cache))
 {
 }
Beispiel #12
0
        public void Test_Create()
        {
            string url = Guid.NewGuid().ToString();

            TransferAction action = new TransferAction(url);

            Assert.AreEqual(action.Url, url);
        }
        public void TransferAction(IOutBitStream bitstream, TransferAction data)
        {
            bitstream.WriteIntegerRange(data.participant, 15, -9999);



            bitstream.WriteBool(data.accepted);
        }
        public virtual TransferAction prompt(TransferItem file)
        {
            if (Log.isDebugEnabled())
            {
                Log.debug(String.Format("Prompt for transfer action of {0}", Transfer));
            }
            for (int i = 0; i < Transfer.getRoots().size(); i++)
            {
                TransferItem next = (TransferItem)Transfer.getRoots().get(i);
                TransferPromptModel.Add(next);
            }

            AsyncDelegate wireAction = delegate
            {
                View.ToggleDetailsEvent += View_ToggleDetailsEvent;
                View.DetailsVisible      = PreferencesFactory.get().getBoolean("transfer.toggle.details");

                View.ChangedActionEvent    += View_ChangedActionEvent;
                View.ChangedSelectionEvent += View_ChangedSelectionEvent;

                View.ModelCanExpandDelegate      = TransferPromptModel.CanExpand;
                View.ModelChildrenGetterDelegate = TransferPromptModel.ChildrenGetter;
                View.ModelCheckStateGetter       = TransferPromptModel.GetCheckState;
                View.ModelCheckStateSetter       = TransferPromptModel.SetCheckState;
                View.ModelSizeGetter             = TransferPromptModel.GetSize;
                View.ModelSizeAsStringGetter     = TransferPromptModel.GetSizeAsString;
                View.ModelFilenameGetter         = TransferPromptModel.GetName;
                View.ModelIconGetter             = TransferPromptModel.GetIcon;
                View.ModelWarningGetter          = TransferPromptModel.GetWarningImage;
                View.ModelCreateGetter           = TransferPromptModel.GetCreateImage;
                View.ModelSyncGetter             = TransferPromptModel.GetSyncGetter;
                View.ModelActiveGetter           = TransferPromptModel.IsActive;

                View.ItemsChanged += UpdateStatusLabel;

                View.ViewShownEvent += delegate
                {
                    View.SetModel(TransferPromptModel.ChildrenGetter(null));
                    //select first one if there is any
                    IEnumerator <TransferItem> en = TransferPromptModel.ChildrenGetter(null).GetEnumerator();
                    if (en.MoveNext())
                    {
                        View.SelectedItem = en.Current;
                    }
                };
                DialogResult result = View.ShowDialog(_parent.View);

                if (result == DialogResult.Cancel)
                {
                    Action = TransferAction.cancel;
                }
            };

            _parent.Invoke(wireAction, true);
            return(Action);
        }
Beispiel #15
0
 internal NetworkClient()
 {
     TransferEvent = new TransferEvents();
     DefaultAction = TransferAction.Replace;
     _encoding     = Encoding.ASCII;
     BufferSize    = BUFFER_SIZE;
     IsDisposed    = false;
     DisplayEvents = true;
     IsConnected   = false;
 }
Beispiel #16
0
 protected TransferPromptModel(TransferPromptController controller, SessionPool source, SessionPool destination, Transfer transfer)
 {
     _controller  = controller;
     _source      = source;
     _destination = destination;
     Transfer     = transfer;
     _action      =
         TransferAction.forName(
             PreferencesFactory.get()
             .getProperty(String.Format("queue.prompt.{0}.action.default", transfer.getType().name())));
 }
Beispiel #17
0
        public ContentResult Transfer([FromForm] TransferAction action, [FromForm] string orderId, [FromForm] decimal money)
        {
            TransferResult result = APIAgent.Instance().Transfer(this.SiteInfo, this.GameInfo, this.UserInfo, action, orderId, money);

            return(new ContentResult()
            {
                ContentType = "application/json",
                StatusCode = 200,
                Content = result.ToString()
            });
        }
Beispiel #18
0
 /// <summary>
 /// 转账成功
 /// </summary>
 public QueryTransferResult(decimal money, DateTime createAt,
                            string userName, TransferAction action, Currency currency, Dictionary <string, object> data = null) : this()
 {
     this.Status   = ResultStatus.Success;
     this.Money    = money;
     this.CreateAt = createAt;
     this.UserName = userName;
     this.Action   = action;
     this.Currency = currency;
     this.Data     = data;
 }
        private void PopulateActions()
        {
            View.PopulateActions(GetTransferActions());
            TransferAction defaultAction =
                TransferAction.forName(
                    PreferencesFactory.get()
                    .getProperty(String.Format("queue.prompt.{0}.action.default", Transfer.getType().name())));

            View.SelectedAction = defaultAction;
            Action = defaultAction;
        }
Beispiel #20
0
        protected virtual void View_ChangedActionEvent()
        {
            TransferAction selected = View.SelectedAction;

            if (Action.equals(selected))
            {
                return;
            }
            Preferences.instance().setProperty("queue.prompt.action.default", selected.toString());
            Action = selected;
            ReloadData();
        }
Beispiel #21
0
        //С САМОЛЁТОМ
        private void TakeOrGiveBaggageFromPlane(string planeId, string carId, TransferAction action, int baggageCount)
        {
            BaggageTransferRequest btr = new BaggageTransferRequest()
            {
                PlaneId      = planeId,
                BaggageCarId = carId,
                Action       = action,
                BaggageCount = baggageCount
            };

            mqClient.Send(queueToAirPlane, btr); //отправляем сообщение самолёту о переданном багаже или о том, сколько вмещается в машину
        }
Beispiel #22
0
        protected override void View_ChangedActionEvent()
        {
            TransferAction selected = View.SelectedAction;

            if (Action.equals(selected))
            {
                return;
            }
            Preferences.instance().setProperty("queue.sync.action.default", selected.toString());
            ((SyncTransfer)Transfer).setTransferAction(selected);
            ReloadData();
        }
 void RequestMoveBaggage(TransferAction action, int baggageCount)
 {
     mqClient.Send <BaggageServiceCommand>(GroundServiceComponent.ComponentName + Component.Baggage,
                                           new BaggageServiceCommand()
     {
         PlaneLocationVertex = this.PlaneLocationVertex,
         PlaneId             = this.PlaneId,
         FlightId            = this.FlightId,
         Action       = action,
         BaggageCount = baggageCount
     });
     logger?.Info($"{GroundServiceComponent.ComponentName}: Send request to Baggage (PlaneId: {PlaneId}, FlightId: {FlightId}, BaggageCount: {baggageCount})");
 }
Beispiel #24
0
        protected override void PopulateActions()
        {
            IDictionary <TransferAction, string> actions = new Dictionary <TransferAction, string>();

            TransferAction defaultAction = ((SyncTransfer)Transfer).getAction();

            actions.Add(SyncTransfer.ACTION_DOWNLOAD, SyncTransfer.ACTION_DOWNLOAD.getLocalizableString());
            actions.Add(SyncTransfer.ACTION_UPLOAD, SyncTransfer.ACTION_UPLOAD.getLocalizableString());
            actions.Add(SyncTransfer.ACTION_MIRROR, SyncTransfer.ACTION_MIRROR.getLocalizableString());
            View.PopulateActions(actions);

            View.SelectedAction = defaultAction;
        }
 void RequestMovePassengers(TransferAction action, int passengerCount)
 {
     mqClient.Send <PassengersServiceCommand>(GroundServiceComponent.ComponentName + Component.Bus,
                                              new PassengersServiceCommand()
     {
         PlaneLocationVertex = this.PlaneLocationVertex,
         PlaneId             = this.PlaneId,
         FlightId            = this.FlightId,
         Action          = action,
         PassengersCount = passengerCount
     });
     logger?.Info($"{GroundServiceComponent.ComponentName}: Send request to Bus (PlaneId: {PlaneId}, FlightId: {FlightId}, Passengers Count: {passengerCount})");
 }
Beispiel #26
0
        public void AddFiles(List <string> files)
        {
            foreach (var file in files)
            {
                FileAttributes attr = File.GetAttributes(file);

                if (!((attr & FileAttributes.Directory) == FileAttributes.Directory))
                {
                    this.lastSent.Content = file;
                    TransferAction.Invoke(file);
                }
            }
            FinishAction("Finished adding files");
        }
        protected virtual void View_ChangedActionEvent()
        {
            TransferAction selected = View.SelectedAction;

            if (Action.equals(selected))
            {
                return;
            }
            PreferencesFactory.get()
            .setProperty(String.Format("queue.prompt.{0}.action.default", Transfer.getType().name()),
                         selected.toString());
            Action = selected;
            TransferPromptModel.SetAction(selected);
            ReloadData();
        }
Beispiel #28
0
        private void Transfer(TransferAction transferAction)
        {
            int passiveIndex   = Players.IndexOf(PassivePlayer);
            int neighbourIndex = Players.IndexOf(NeighbourPlayer);

            ActivePlayer    = Players[passiveIndex % Players.Count];
            PassivePlayer   = Players[neighbourIndex % Players.Count];
            NeighbourPlayer = Players[(Players.IndexOf(PassivePlayer) + 1) % Players.Count];

            transferAction.Player.Hand.Remove(transferAction.TransferCard);
            Table.NotCoveredCards.Add(transferAction.TransferCard);
            Table.OpenedCards.Add(transferAction.TransferCard);
            Table.AttackCardsCount++;

            UpdateVisiblePlayers();
        }
        public async Task <IActionResult> Send(TransferAction model)
        {
            var sender = GetUserId();

            if (Invalid(model.Amount, sender))
            {
                return(BadRequest());
            }

            var receiverExists = _accountDbContext.Accounts.Any(x => x.Id == model.Receiver);

            if (model.Receiver == sender || !receiverExists)
            {
                return(BadRequest());
            }

            using (var transaction = await _accountDbContext.Database.BeginTransactionAsync())
            {
                var actionLog = _accountDbContext.ActionLogs.Add(new ActionLog
                {
                    Sender   = sender,
                    Receiver = model.Receiver,
                    Amount   = model.Amount,
                    DateUtc  = DateTime.UtcNow
                });

                _accountDbContext.LastAccountChanges.Add(new AccountChange
                {
                    AccountId = sender,
                    Value     = -model.Amount,
                    ActionLog = actionLog.Entity
                });

                _accountDbContext.LastAccountChanges.Add(new AccountChange
                {
                    AccountId = model.Receiver,
                    Value     = model.Amount,
                    ActionLog = actionLog.Entity
                });

                await _accountDbContext.SaveChangesAsync();

                transaction.Commit();

                return(Ok());
            }
        }
Beispiel #30
0
        public void AbiJsonToBinTest()
        {
            TransferAction action = new TransferAction()
            {
                Account = "eosio.token",
                Data    = new TransferData()
                {
                    From     = "dmitrychegod",
                    To       = "bitsumbridge",
                    Quantity = new Currency("1.0000 EOS"),
                    Memo     = "1"
                }
            };

            client.AbiJsonToBin(action).Wait();

            Trace.WriteLine(action.ToJson());
        }
 public void TransferCall(TransferAction action)
 {
     switch (action)
     {
         case TransferAction.Conference:
             _connection.SendCommand(new Commands.TransferCall(""));
             break;
         case TransferAction.Release:
             MoveToState(AgentState.Updating);
             break;
         default:
             break;
     }
 }
 public TrayTransferRobotModule()
 {
     ActionQueue = new Queue<TransferAction>();
     CurrentAction = new TransferAction { ActionType = EActionType.SupplyEmptyTray, ProductInfo = new FAProductInfo(), TrayCount = 1 };
 }
 public void AddAction(TransferAction action)
 {
     ActionQueue.Enqueue(action);
 }
Beispiel #34
0
        private void TransferFolder(string source, string target, TransferAction transferAction)
        {
            Ensure.That(source, () => source).IsValidPath();
            Ensure.That(target, () => target).IsValidPath();

            Logger.Debug("{0} {1} -> {2}", transferAction, source, target);

            var sourceFolder = new DirectoryInfo(source);
            var targetFolder = new DirectoryInfo(target);

            if (!targetFolder.Exists)
            {
                targetFolder.Create();
            }

            foreach (var subDir in sourceFolder.GetDirectories())
            {
                TransferFolder(subDir.FullName, Path.Combine(target, subDir.Name), transferAction);
            }

            foreach (var sourceFile in sourceFolder.GetFiles("*.*", SearchOption.TopDirectoryOnly))
            {
                var destFile = Path.Combine(target, sourceFile.Name);

                Logger.Debug("{0} {1} -> {2}", transferAction, sourceFile, destFile);

                switch (transferAction)
                {
                    case TransferAction.Copy:
                        {
                            sourceFile.CopyTo(destFile, true);
                            break;
                        }
                    case TransferAction.Move:
                        {
                            MoveFile(sourceFile.FullName, destFile);
                            break;
                        }
                }
            }
        }