Exemplo n.º 1
0
 private void emptyStoredNotesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Payout != null)
     {
         Payout.EmptyPayoutDevice(textBox1);
     }
 }
Exemplo n.º 2
0
        public async Task <PayoutBatch> CreateAsync(
            string transactionId,
            string email,
            decimal amount,
            string?description   = null,
            string?correlationId = null
            )
        {
            var payout = new Payout
            {
                sender_batch_header = new PayoutSenderBatchHeader
                {
                    email_subject   = Options.Payout.Email.Subject,
                    sender_batch_id = correlationId ?? Guid.NewGuid().ToString(),
                    recipient_type  = PayoutRecipientType.EMAIL
                },
                items = new List <PayoutItem>
                {
                    new PayoutItem
                    {
                        amount = new Currency
                        {
                            currency = Options.Payout.Currency,
                            value    = amount.ToString(CultureInfo.InvariantCulture)
                        },
                        receiver       = email,
                        note           = description ?? Options.Payout.Email.Note,
                        sender_item_id = transactionId
                    }
                }
            };

            return(await Task.FromResult(Payout.Create(Context, payout)));
        }
Exemplo n.º 3
0
        private void recycleBox_CheckedChange(object sender, EventArgs e)
        {
            try
            {
                // Get the sending object as a checkbox
                CheckBox c = sender as CheckBox;

                // Get the data from the payout
                ChannelData d = new ChannelData();
                Payout.GetDataByChannel(Int32.Parse(c.Name), ref d);

                if (c.Checked)
                {
                    Payout.ChangeNoteRoute(d.Value, d.Currency, false, textBox1);
                }
                else
                {
                    Payout.ChangeNoteRoute(d.Value, d.Currency, true, textBox1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "EXCEPTION");
                return;
            }
        }
Exemplo n.º 4
0
        protected NameValueCollection GetPostData()
        {
            var data = new NameValueCollection();

            data[Parameters.GlobalPostbackType] = GlobalPostbackType.ToString();
            data[Parameters.OfferId]            = OfferId.ToString();
            data[Parameters.OfferName]          = OfferName;
            data[Parameters.IpAddress]          = Ip;
            data[Parameters.CountryCode]        = CountryCode;
            data[Parameters.SubId]        = SubId;
            data[Parameters.Payout]       = Payout.ToClearString();
            data[Parameters.CurrencyCode] = CurrencyCode;

            if (Age != -1)
            {
                data[Parameters.Age] = Age.ToString();
            }

            data[Parameters.Gender] = Gender.ToString();
            if (!string.IsNullOrEmpty(SubId2))
            {
                data[Parameters.SubId2] = SubId2;
            }
            if (!string.IsNullOrEmpty(SubId3))
            {
                data[Parameters.SubId3] = SubId3;
            }

            return(data);
        }
Exemplo n.º 5
0
        public static ConfirmPayoutResult ConfirmPayout(string protoIdentity)
        {
            protoIdentity = HttpUtility.UrlDecode(protoIdentity);

            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials, AccessType.Write)))
            {
                throw new SecurityException("Insufficient privileges for operation");
            }

            ConfirmPayoutResult result = new ConfirmPayoutResult();

            Payout payout = Payout.CreateFromProtoIdentity(authData.CurrentUser, protoIdentity);

            PWEvents.CreateEvent(EventSource.PirateWeb, EventType.PayoutCreated,
                                 authData.CurrentUser.Identity, 1, 1, 0, payout.Identity,
                                 protoIdentity);

            // Create result and return it

            result.AssignedId     = payout.Identity;
            result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCreated, payout.Identity,
                                                  payout.Recipient);

            return(result);
        }
        public void PayoutCreateAndGetTest()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var payout = PayoutTest.GetPayout();
                var payoutSenderBatchId = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8);
                payout.sender_batch_header.sender_batch_id = payoutSenderBatchId;
                var createdPayout = payout.Create(apiContext, false);
                this.RecordConnectionDetails();

                Assert.IsNotNull(createdPayout);
                Assert.IsTrue(!string.IsNullOrEmpty(createdPayout.batch_header.payout_batch_id));
                Assert.AreEqual(payoutSenderBatchId, createdPayout.batch_header.sender_batch_header.sender_batch_id);

                var payoutBatchId   = createdPayout.batch_header.payout_batch_id;
                var retrievedPayout = Payout.Get(apiContext, payoutBatchId);
                this.RecordConnectionDetails();

                Assert.IsNotNull(payout);
                Assert.AreEqual(payoutBatchId, retrievedPayout.batch_header.payout_batch_id);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }
Exemplo n.º 7
0
        public static UndoPayoutResult UndoPayout(int databaseId)
        {
            AuthenticationData authData = GetAuthenticationDataAndCulture();
            UndoPayoutResult   result   = new UndoPayoutResult();

            Payout payout = Payout.FromIdentity(databaseId);

            if (!payout.Open)
            {
                // this payout has already been settled, or picked up for settling

                result.Success        = false;
                result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCannotUndo,
                                                      databaseId);

                return(result);
            }

            payout.UndoPayout();

            result.DisplayMessage =
                HttpUtility.UrlEncode(String.Format(Resources.Pages.Financial.PayOutMoney_PayoutUndone, databaseId))
                .Replace("+", "%20");
            result.Success = true;
            return(result);
        }
Exemplo n.º 8
0
        public static UndoPayoutResult UndoPayout(int databaseId)
        {
            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials)))
            {
                throw new SecurityException("Insufficient privileges for operation");
            }

            UndoPayoutResult result = new UndoPayoutResult();
            Payout           payout = Payout.FromIdentity(databaseId);

            if (!payout.Open)
            {
                // this payout has already been settled, or picked up for settling

                result.Success        = false;
                result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCannotUndo,
                                                      databaseId);

                return(result);
            }

            payout.UndoPayout();

            result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutUndone, databaseId);
            result.Success        = true;
            return(result);
        }
Exemplo n.º 9
0
    void Roll()
    {
        Payout payout = rng.GetRandomChanceObject(payouts.Cast <IChanceObject <Payout> >().ToList());

        if (payout.type == Payout.Type.none)
        {
            cost          += cost_growth;
            cost_text.text = "$" + cost;
        }
        else if (payout.type == Payout.Type.item)
        {
            ItemPedastal new_item = Instantiate(pedastal);
            new_item.transform.position = chest_spawn_point.position;

            new_item.SetItem(ItemListSingleton.instance.GetRandomItem(RNGSingleton.instance.random_item_rng), true);

            PaidOut();
        }
        else if (payout.type == Payout.Type.pickups)
        {
            Utilities.Utilities.ThrowObjects(payout.pickups_to_spawn, pickup_spawn_point);

            PaidOut();
        }
    }
Exemplo n.º 10
0
        public async Task <IActionResult> Edit(int id, [Bind("RecipientType,Note,ID,Receiver,PayoutBatchId,Money,Currency")] Payout payout)
        {
            if (id != payout.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payout);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PayoutExists(payout.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PayoutBatchId"] = new SelectList(_context.PayoutBatches, "ID", "EmailMessage", payout.PayoutBatchId);
            return(View(payout));
        }
Exemplo n.º 11
0
        private void DoPayPalPayment(double price)
        {
            var config      = ConfigManager.Instance.GetProperties();
            var accessToken = new OAuthTokenCredential(config).GetAccessToken();
            var apiContext  = new APIContext(accessToken);

            var payout = new Payout
            {
                sender_batch_header = new PayoutSenderBatchHeader
                {
                    sender_batch_id = "batch_" + Guid.NewGuid().ToString().Substring(0, 8),
                    email_subject   = "You have payment",
                    recipient_type  = PayoutRecipientType.EMAIL
                },

                items = new List <PayoutItem>
                {
                    new PayoutItem
                    {
                        recipient_type = PayoutRecipientType.EMAIL,
                        amount         = new Currency {
                            value = price.ToString(), currency = "USD"
                        },
                        receiver       = "*****@*****.**",
                        note           = "Thank you",
                        sender_item_id = "item_1"
                    }
                }
            };

            var created = payout.Create(apiContext, false);
        }
Exemplo n.º 12
0
        private decimal GetFirstPlacePay(Payout payout)
        {
            switch (payout)
            {
            case Payout.Two:
                return(2m);

            case Payout.Five:
                return(3.5m);

            case Payout.Ten:
                return(6m);

            case Payout.Hundred:
                return(60m);

            case Payout.Thousand:
                return(600m);

            case Payout.TenThousand:
                return(6000m);
            }

            return(0m);
        }
        public void UpsertPayoutHeader(Payout payout)
        {
            var existingPayout = _persistRepository.RetrievePayout(payout.id);

            if (existingPayout != null)
            {
                _persistRepository
                .UpdatePayoutHeader(
                    payout.id, payout.SerializeToJson(), payout.status);

                _logger.Debug($"Shopify Payout Header {payout.id} found - updating status and skipping!");
                return;
            }
            else
            {
                _logger.Debug($"Creating record for Shopify Payout Header {payout.id}");

                var newPayout = new ShopifyPayout()
                {
                    ShopifyPayoutId   = payout.id,
                    ShopifyLastStatus = payout.status,
                    Json               = payout.SerializeToJson(),
                    CreatedDate        = DateTime.UtcNow,
                    LastUpdated        = DateTime.UtcNow,
                    AllTransDownloaded = false,
                };

                _persistRepository.InsertPayoutHeader(newPayout);
            }
        }
Exemplo n.º 14
0
        public Game()
        {
            Payout = Payout.Ten;

            p1 = 1503;
            p2 = 1499;
            p3 = 1499;
            p4 = 1499;

            Players = new List <Player>()
            {
                new Player {
                    Name = $"Player1({p1})"
                },
                new Player {
                    Name = $"Player2({p2})"
                },
                new Player {
                    Name = $"Player3({p3})"
                },
                new Player {
                    Name = $"Player4({p4})"
                },
            };

            SetupGame();
        }
Exemplo n.º 15
0
        protected override void RunSample()
        {
            // ### Api Context
            // Pass in a `APIContext` object to authenticate
            // the call and to send a unique request id
            // (that ensures idempotency). The SDK generates
            // a request id if you do not pass one explicitly.
            // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext.
            var apiContext = Configuration.GetAPIContext();

            // ### Batch Payout ID
            // The ID of the batch payout to lookup.
            var payoutBatchId = "6L3FZTTJE2NR8";

            // ^ Ignore workflow code segment
            #region Track Workflow
            this.flow.AddNewRequest("Retrieve payout details", description: "ID: " + payoutBatchId);
            #endregion

            // ### Payout.Get()
            // Retrieves the details of the specified batch payout.
            var payout = Payout.Get(apiContext, payoutBatchId);

            // ^ Ignore workflow code segment
            #region Track Workflow
            this.flow.RecordResponse(payout);
            #endregion

            // For more information, please visit [PayPal Developer REST API Reference](https://developer.paypal.com/docs/api/).
        }
Exemplo n.º 16
0
    protected void ButtonExecute_Click(object sender, EventArgs e)
    {
        if (!_authority.HasPermission(Permission.CanDoEconomyTransactions, thisPayout.OrganizationId, -1, Authorization.Flag.ExactOrganization))
        {
            throw new UnauthorizedAccessException("Access Denied");
        }

        if (this.RadioManualMap.Checked)
        {
            int transactionId = Int32.Parse(this.DropTransactions.SelectedValue);
            FinancialTransaction transaction = FinancialTransaction.FromIdentity(transactionId);

            thisPayout.BindToTransactionAndClose(transaction, _currentUser);
        }
        else if (this.RadioManualMerge.Checked)
        {
            int    otherPayoutId = Int32.Parse(this.DropPayouts.SelectedValue);
            Payout otherPayout   = Payout.FromIdentity(otherPayoutId);

            otherPayout.MigrateDependenciesTo(thisPayout);
            otherPayout.Open     = false;
            thisPayout.Reference = GetDependencyString(thisPayout);
        }
        else if (this.RadioUndoPayout.Checked)
        {
            thisPayout.UndoPayout();
        }

        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
    }
Exemplo n.º 17
0
 private void btnReset_Click(object sender, EventArgs e)
 {
     Payout.Reset(textBox1);
     // Shut port to force reconnect
     Payout.SSPComms.CloseComPort();
     ClearCheckBoxes();
 }
Exemplo n.º 18
0
        public decimal TestSimplePayout(string wheelString)
        {
            var wheel  = Encoding(wheelString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
            var result = Payout.Calculate(wheel, 1);

            return(result.win);
        }
Exemplo n.º 19
0
        public void TestPayoutAsMerchant_CreateBankAccount()
        {
            OpenpayAPI  openpayAPI  = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            BankAccount bankAccount = new BankAccount();

            bankAccount.CLABE      = "012298026516924616";
            bankAccount.HolderName = "Testing";

            PayoutRequest request = new PayoutRequest();

            request.Method      = "bank_account";
            request.BankAccount = bankAccount;
            request.Amount      = 8.5m;
            request.Description = "Payout test";
            Payout payout = openpayAPI.PayoutService.Create(request);

            Assert.IsNotNull(payout.Id);
            Assert.IsNotNull(payout.CreationDate);
            Assert.IsNotNull(payout.BankAccount);

            Payout payoutGet = openpayAPI.PayoutService.Get(payout.Id);

            Assert.AreEqual(payout.Amount, payoutGet.Amount);
            Assert.AreEqual(payout.BankAccount.CLABE, payoutGet.BankAccount.CLABE);
        }
Exemplo n.º 20
0
        public void TestPayoutAsCustomer_CreateCard()
        {
            OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            Card       card       = new Card();

            card.CardNumber = "4111111111111111";
            card.BankCode   = "002";
            card.HolderName = "Payout User";


            PayoutRequest request = new PayoutRequest();

            request.Method      = "card";
            request.Card        = card;
            request.Amount      = 5.5m;
            request.Description = "Payout test";
            Payout payout = openpayAPI.PayoutService.Create(customer_id, request);

            Assert.IsNotNull(payout.Id);
            Assert.IsNotNull(payout.CreationDate);
            Assert.IsNotNull(payout.Card);
            Assert.IsNull(payout.BankAccount);

            Payout payoutGet = openpayAPI.PayoutService.Get(customer_id, payout.Id);

            Assert.AreEqual(payout.Amount, payoutGet.Amount);
        }
        public PayoutBatchHeader SendPayment(string reciverEmail, decimal amount, string note)
        {
            var apiContext = PaypalConfiguration.GetAPIContext();
            var payout     = new Payout
            {
                sender_batch_header = new PayoutSenderBatchHeader
                {
                    sender_batch_id = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8),
                    email_subject   = "You have redeem points payment"
                },

                items = new List <PayoutItem>
                {
                    new PayoutItem
                    {
                        recipient_type = PayoutRecipientType.EMAIL,
                        amount         = new Currency
                        {
                            value    = decimal.Round(amount, 2).ToString(),
                            currency = "USD"
                        },
                        receiver       = reciverEmail,
                        note           = note,
                        sender_item_id = "item_1"
                    }
                }
            };

            PayoutBatch createdPayout = payout.Create(apiContext, false);

            return(createdPayout.batch_header);
        }
Exemplo n.º 22
0
        public void TestPayoutAsCustomer_CreateWithNewBankAccount()
        {
            OpenpayAPI  openpayAPI  = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            BankAccount bankAccount = new BankAccount();

            bankAccount.CLABE      = "012212000000000019";
            bankAccount.HolderName = "Testing";

            bankAccount = openpayAPI.BankAccountService.Create(customer_id, bankAccount);

            PayoutRequest request = new PayoutRequest();

            request.Method        = "bank_account";
            request.DestinationId = bankAccount.Id;
            request.Amount        = 8.5m;
            request.Description   = "Payout test";
            Payout payout = openpayAPI.PayoutService.Create(customer_id, request);

            Assert.IsNotNull(payout.Id);
            Assert.IsNotNull(payout.CreationDate);
            Assert.IsNotNull(payout.BankAccount);

            Payout payoutGet = openpayAPI.PayoutService.Get(customer_id, payout.Id);

            Assert.AreEqual(payout.Amount, payoutGet.Amount);
            Assert.AreEqual(payout.BankAccount.CLABE, payoutGet.BankAccount.CLABE);

            openpayAPI.BankAccountService.Delete(customer_id, bankAccount.Id);
        }
Exemplo n.º 23
0
        public static void SendMoney()
        {
            var apiContext = Configuration.GetAPIContext();

            var paymentList = Payment.List(apiContext);
            var payout      = new Payout
            {
                sender_batch_header = new PayoutSenderBatchHeader
                {
                    sender_batch_id = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8),
                    email_subject   = "You have a payment"
                },
                items = new List <PayoutItem>
                {
                    new PayoutItem
                    {
                        recipient_type = PayoutRecipientType.EMAIL,
                        amount         = new Currency
                        {
                            value    = "8.99",
                            currency = "EUR"
                        },
                        receiver       = "*****@*****.**",
                        note           = "Thank you.",
                        sender_item_id = "item_1"
                    }
                }
            };


            var createdPayout = payout.Create(apiContext);
        }
Exemplo n.º 24
0
        public static AjaxCallResult UndoPayout(int databaseId)
        {
            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials)))
            {
                throw new UnauthorizedAccessException("Insufficient privileges for operation");
            }

            Payout payout = Payout.FromIdentity(databaseId);

            if (!payout.Open)
            {
                // this payout has already been settled, or picked up for settling. This is a concurrency error, detected before actually trying to change it.

                return(new AjaxCallResult
                {
                    Success = false,
                    DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCannotUndo,
                                                   databaseId)
                });
            }

            payout.UndoPayout();   // TODO: catch ConcurrencyException

            return(new AjaxCallResult
            {
                DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutUndone, databaseId),
                Success = true
            });
        }
 public static PayoutBatch CreateSingleSynchronousPayoutBatch(APIContext apiContext)
 {
     return(Payout.Create(apiContext, new Payout
     {
         sender_batch_header = new PayoutSenderBatchHeader
         {
             sender_batch_id = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8),
             email_subject = "You have a Payout!"
         },
         items = new List <PayoutItem>
         {
             new PayoutItem
             {
                 recipient_type = PayoutRecipientType.EMAIL,
                 amount = new Currency
                 {
                     value = "1.0",
                     currency = "USD"
                 },
                 note = "Thanks for the payment!",
                 sender_item_id = "2014031400023",
                 receiver = "*****@*****.**"
             }
         }
     },
                          true));
 }
Exemplo n.º 26
0
        private PayoutBatch CreatePayout()
        {
            var        payout     = new Payout();
            APIContext ApiContext = Configuration.GetAPIContext();

            var sender_batch_header = new PayoutSenderBatchHeader()
            {
                email_subject   = "You have a payout!",
                sender_batch_id = "Payouts_2018_" + Convert.ToString((new Random()).Next(100000))
            };
            var amount = new Currency()
            {
                currency = "USD",
                value    = "100"
            };
            var payoutitem = new List <PayoutItem>();
            var item       = new PayoutItem()
            {
                recipient_type = PayoutRecipientType.PHONE,
                amount         = amount,
                note           = "Học phí",
                sender_item_id = Convert.ToString((new Random()).Next(100000)),
                receiver       = "408-491-2437"
            };

            payoutitem.Add(item);
            payout.items = payoutitem;
            payout.sender_batch_header = sender_batch_header;
            return(Payout.Create(ApiContext, payout));
        }
Exemplo n.º 27
0
        public static void MatchTransactionOpenPayout(int transactionId, int payoutId)
        {
            if (transactionId == 0 || payoutId == 0)
            {
                return;
            }

            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization,
                                                         AccessAspect.BookkeepingDetails)))
            {
                throw new UnauthorizedAccessException();
            }

            FinancialTransaction transaction = FinancialTransaction.FromIdentity(transactionId);
            Payout payout = Payout.FromIdentity(payoutId);

            if (transaction.OrganizationId != authData.CurrentOrganization.Identity || payout.OrganizationId != authData.CurrentOrganization.Identity)
            {
                throw new UnauthorizedAccessException();
            }

            if (transaction.Rows.AmountCentsTotal != -payout.AmountCents)
            {
                throw new InvalidOperationException();
            }

            payout.BindToTransactionAndClose(transaction, authData.CurrentUser);
        }
Exemplo n.º 28
0
        private void recycleBoxPayout_CheckedChange(object sender, EventArgs e)
        {
            CheckBox chkbox = sender as CheckBox;

            try
            {
                ChannelData d = new ChannelData();
                Payout.GetDataByChannel(Int32.Parse(chkbox.Name), ref d);

                if (chkbox.Checked)
                {
                    Payout.ChangeNoteRoute(d.Value, d.Currency, false, textBox1);
                }
                else
                {
                    Payout.ChangeNoteRoute(d.Value, d.Currency, true, textBox1);
                }

                // Ensure payout ability is enabled in the validator
                Payout.EnablePayout();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }
        }
Exemplo n.º 29
0
        public ActionResult Payout(PayoutVM payoutVM)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            if (payoutVM.Id == 0)
            {
                Payout payout = new Models.Payout()
                {
                    Date     = payoutVM.Date,
                    Amount   = payoutVM.Amount,
                    SellerId = payoutVM.UserId
                };
                db.PayOuts.Add(payout);
                db.SaveChanges();

                var items = db.PayOuts.Where(c => c.SellerId == payoutVM.UserId).OrderByDescending(c => c.Date).ToList();
                return(PartialView("_Payout", items));
            }
            else
            {
                Payout payout = db.PayOuts.FirstOrDefault(p => p.Id == payoutVM.Id);
                if (payout != null)
                {
                    payout.Date   = payoutVM.Date;
                    payout.Amount = payoutVM.Amount;
                    db.SaveChanges();
                    return(PartialView("_PayoutListItem", payout));
                }
            }
            return(View());
        }
        public Payout GetPayout(Strategy strategy, int outcome)
        {
            Payout payout = new Payout()
            {
                WinningBets = new List <Guid>(),
                LosingBets  = new List <Guid>()
            };

            List <Classification> classifications = _classifier.ClassifyResult(outcome);

            foreach (Bet bet in strategy.Bets)
            {
                if (classifications.Contains(bet.Class))
                {
                    payout.Amount += (bet.Amount * bet.Class.PayoutMultiplier);
                    payout.WinningBets.Add(bet.Id);
                }
                else
                {
                    payout.LosingBets.Add(bet.Id);
                }
            }

            return(payout);
        }
Exemplo n.º 31
0
    protected void Page_Load (object sender, EventArgs e)
    {
        // Get account

        int thisPayoutId = Int32.Parse(Request.QueryString["PayoutId"]);
        thisPayout = Payout.FromIdentity(thisPayoutId);
        int year = DateTime.Today.Year;

        if (!_authority.HasPermission(Permission.CanDoEconomyTransactions, thisPayout.OrganizationId, -1, Authorization.Flag.ExactOrganization))
        {
            throw new UnauthorizedAccessException("Access Denied");
        }

        if (!Page.IsPostBack)
        {
            // Populate all data

            this.LabelHeader.Text = String.Format("Editing Payout #{0} ({1:N2})", thisPayout.Identity, thisPayout.Amount);
            PopulateDropTransactions();
            PopulateDropPayouts();
        }
    }
 public static Payout CreatePayout(int payoutID, int customerID, global::System.DateTime payoutDate, int payoutTypeID, decimal amount, bool isTaxable, int bankAccountID, global::System.DateTime createdDate, global::System.DateTime modifiedDate)
 {
     Payout payout = new Payout();
     payout.PayoutID = payoutID;
     payout.CustomerID = customerID;
     payout.PayoutDate = payoutDate;
     payout.PayoutTypeID = payoutTypeID;
     payout.Amount = amount;
     payout.IsTaxable = isTaxable;
     payout.BankAccountID = bankAccountID;
     payout.CreatedDate = createdDate;
     payout.ModifiedDate = modifiedDate;
     return payout;
 }
    private void AddPayoutEvent (int parentId, Payout payout)
    {
        int newId = transactionEvents.Count + 1;

        transactionEvents.Add(new TransactionEvent(newId, parentId, "This is Payout #" + payout.Identity.ToString() + "."));
        transactionEvents.Add(
            new TransactionEvent(newId + 1, newId,
                                 "Performed by " + Person.FromIdentity(payout.CreatedByPersonId).Canonical + " at " +
                                 payout.CreatedDateTime.ToString("yyyy-MM-dd HH:mm")));

        foreach (ExpenseClaim claim in payout.DependentExpenseClaims)
        {
            AddExpenseClaimEvent(newId, claim);
        }
        foreach (InboundInvoice invoice in payout.DependentInvoices)
        {
            AddInboundInvoiceEvent(newId, invoice);
        }
        foreach (Salary salary in payout.DependentSalariesNet)
        {
            AddSalaryEvent(newId, salary, false);
        }
        foreach (Salary salary in payout.DependentSalariesTax)
        {
            AddSalaryEvent(newId, salary, true);
        }
    }
 public void CancelPayout(PolicyNo policyNo, Payout payout)
 {
     //do nothing
 }
Exemplo n.º 35
0
 public void ParsePayouts(IList payoutArray)
 {
     m_payouts = new List<Payout>();
     for(var i = 0; i < payoutArray.Count; i++) {
         var jd = (JsonData)payoutArray[i];
         var payout = new Payout(jd);
         //Debug.Log ("Adding payout: " + payout.ToString());
         m_payouts.Add (payout);
     }
 }
Exemplo n.º 36
0
 int SortByCredits(Payout a, Payout b)
 {
     if(a.credits > b.credits) {
       return -1;
     }
     else if(a.credits < b.credits) {
       return 1;
     }
     else {
       return 0;
     }
 }
Exemplo n.º 37
0
 public void AddPayout(Payout toAdd)
 {
     m_payouts.Add (toAdd);
 }
 public void AddToPayouts(Payout payout)
 {
     base.AddObject("Payouts", payout);
 }
 public void ProcessPayout(PolicyNo policy, Payout payout)
 {
     //do nothing
 }