Ejemplo n.º 1
0
 public ActionResult Withdraw(string cisloUctu, string kodBanky, string castka)
 {
     if (ModelState.IsValid)
     {
         decimal castkaInt = 0;
         if (!string.IsNullOrEmpty(cisloUctu) && !string.IsNullOrEmpty(kodBanky) && decimal.TryParse(castka, out castkaInt))
         {
             var user = Session["user"] as User;
             if (user != null)
             {
                 var withdraw = new Cashout()
                 {
                     AccountNumber = cisloUctu,
                     Amount        = castkaInt,
                     Apply         = DateTime.Now,
                     BankCode      = kodBanky,
                     IsPaid        = false,
                     UserId        = user.UserId
                 };
                 using (var db = new Database())
                 {
                     db.Cashouts.Add(withdraw);
                     var usr = db.Users.FirstOrDefault(x => x.UserId == user.UserId);
                     Session["user"] = usr;
                     usr.Balance    -= castkaInt;
                     db.SaveChanges();
                 }
             }
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
        private async Task ProcessMessageAsync(CashOutEvent message)
        {
            var fees = message.CashOut.Fees;
            var fee  = fees?.FirstOrDefault()?.Transfer;

            var entity = new Cashout()
            {
                //BlockchainHash = ,
                FeeSize   = ParseNullabe(fee?.Volume),
                State     = HistoryState.Finished,
                Id        = Guid.Parse(message.Header.RequestId),
                WalletId  = Guid.Parse(message.CashOut.WalletId),
                AssetId   = message.CashOut.AssetId,
                Timestamp = message.Header.Timestamp,
                Volume    = -Math.Abs(decimal.Parse(message.CashOut.Volume))
            };

            if (!await _historyRecordsRepository.TryInsertAsync(entity))
            {
                _log.Warning($"Skipped duplicated cashout record", context: new
                {
                    id = message.Header.RequestId
                });
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (address != null)
            {
                address.Dispose();
                address = null;
            }

            if (APNSSummary != null)
            {
                APNSSummary.Dispose();
                APNSSummary = null;
            }

            if (AppValue != null)
            {
                AppValue.Dispose();
                AppValue = null;
            }

            if (Cashout != null)
            {
                Cashout.Dispose();
                Cashout = null;
            }

            if (Comparebook != null)
            {
                Comparebook.Dispose();
                Comparebook = null;
            }

            if (ExpDate != null)
            {
                ExpDate.Dispose();
                ExpDate = null;
            }

            if (VehicleDetails != null)
            {
                VehicleDetails.Dispose();
                VehicleDetails = null;
            }
        }
Ejemplo n.º 4
0
        protected void BtnProcessReport_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnProcessReport_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                CalculteMethod();
                object[] args    = { DateTime.Parse(Request.QueryString["selectedDate"].ToString()), Convert.ToInt32(Request.QueryString["location"].ToString()) };
                Cashout  cashout = R.CallSelectedCashoutToReturn(args, objPageDetails);

                //Creates new cashout
                cashout.fltManuallyCountedBasedOnReceiptsTradeIn    = Convert.ToDouble(txtTradeIn.Text);
                cashout.fltManuallyCountedBasedOnReceiptsGiftCard   = Convert.ToDouble(txtGiftCard.Text);
                cashout.fltManuallyCountedBasedOnReceiptsCash       = Convert.ToDouble(txtCash.Text);
                cashout.fltManuallyCountedBasedOnReceiptsDebit      = Convert.ToDouble(txtDebit.Text);
                cashout.fltManuallyCountedBasedOnReceiptsMastercard = Convert.ToDouble(txtMasterCard.Text);
                cashout.fltManuallyCountedBasedOnReceiptsVisa       = Convert.ToDouble(txtVisa.Text);
                cashout.fltCashDrawerOverShort = double.Parse(lblOverShortFinal.Text, NumberStyles.Currency);
                cashout.bitIsCashoutProcessed  = true;
                cashout.bitIsCashoutFinalized  = false;
                cashout.intEmployeeID          = CU.employee.intEmployeeID;

                R.CallUpdateCashout(cashout, objPageDetails);

                MessageBoxCustom.ShowMessage("Cashout has been processed", this);
                btnPrint.Enabled         = true;
                BtnProcessReport.Enabled = false;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Ejemplo n.º 5
0
 private void AddToView(CashOutData cd)
 {
     Dispatcher.Invoke(() =>
     {
         PreviousGames.Items.Add(cd);
         if (PreviousGames.Items.Count > 5)
         {
             PreviousGames.Items.RemoveAt(0);
         }
         var dbCashOut = new Cashout
         {
             GameId       = cd.game_id,
             GameLink     = cd.gameLink,
             Id           = _gameDataContext.Cashout.NextId(),
             LastUpdate   = DateTime.Now.ToFileTime(),
             Mines        = cd.mines,
             RandomString = cd.random_string,
             Win          = (long)cd.win,
             BalanceAfter = (GetBalance().balance *ConvertMultiplier).ToString("0.0", new CultureInfo("en-US"))
         };
         _gameDataContext.Cashout.Insert(dbCashOut);
     });
 }
Ejemplo n.º 6
0
        void ReleaseDesignerOutlets()
        {
            if (address != null)
            {
                address.Dispose();
                address = null;
            }

            if (apnsAlert != null)
            {
                apnsAlert.Dispose();
                apnsAlert = null;
            }

            if (apnsCloseButton != null)
            {
                apnsCloseButton.Dispose();
                apnsCloseButton = null;
            }

            if (APNSDone != null)
            {
                APNSDone.Dispose();
                APNSDone = null;
            }

            if (APNSMessage != null)
            {
                APNSMessage.Dispose();
                APNSMessage = null;
            }

            if (APNSSummary != null)
            {
                APNSSummary.Dispose();
                APNSSummary = null;
            }

            if (AppValue != null)
            {
                AppValue.Dispose();
                AppValue = null;
            }

            if (Cashout != null)
            {
                Cashout.Dispose();
                Cashout = null;
            }

            if (CloseBtn != null)
            {
                CloseBtn.Dispose();
                CloseBtn = null;
            }

            if (Comparebook != null)
            {
                Comparebook.Dispose();
                Comparebook = null;
            }

            if (ExpDate != null)
            {
                ExpDate.Dispose();
                ExpDate = null;
            }

            if (VehicleDetails != null)
            {
                VehicleDetails.Dispose();
                VehicleDetails = null;
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "Page_Load";

            Session["currPage"] = "SalesCashOut.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //checks if the user has logged in
                if (Session["currentUser"] == null)
                {
                    //Go back to Login to log in
                    Server.Transfer("LoginPage.aspx", false);
                }
                else
                {
                    CU = (CurrentUser)Session["currentUser"];
                    if (!IsPostBack)
                    {
                        Cashout cashout = new Cashout();
                        //Gathering the start and end dates
                        DateTime selectedDate = DateTime.Parse(Request.QueryString["selectedDate"].ToString());
                        int      locationID   = Convert.ToInt32(Request.QueryString["location"].ToString());
                        object[] args         = { selectedDate, locationID };
                        lblCashoutDate.Text = "Cashout on: " + selectedDate.ToString("dd/MMM/yy") + " for " + LM.CallReturnLocationName(locationID, objPageDetails);
                        if (R.CallCashoutExists(args, objPageDetails))
                        {
                            cashout = R.CallSelectedCashoutToReturn(args, objPageDetails);

                            lblTradeInDisplay.Text    = cashout.fltSystemCountedBasedOnSystemTradeIn.ToString("C");
                            lblGiftCardDisplay.Text   = cashout.fltSystemCountedBasedOnSystemGiftCard.ToString("C");
                            lblCashDisplay.Text       = cashout.fltSystemCountedBasedOnSystemCash.ToString("C");
                            lblDebitDisplay.Text      = cashout.fltSystemCountedBasedOnSystemDebit.ToString("C");
                            lblMasterCardDisplay.Text = cashout.fltSystemCountedBasedOnSystemMastercard.ToString("C");
                            lblVisaDisplay.Text       = cashout.fltSystemCountedBasedOnSystemVisa.ToString("C");

                            lblPreTaxDisplay.Text = (cashout.fltSalesSubTotal + cashout.fltSystemCountedBasedOnSystemTradeIn).ToString("C");
                            lblGSTDisplay.Text    = cashout.fltGovernmentTaxAmount.ToString("C");
                            lblPSTDisplay.Text    = cashout.fltProvincialTaxAmount.ToString("C");
                            lblLCTDisplay.Text    = cashout.fltLiquorTaxAmount.ToString("C");

                            lblTotalDisplay.Text = (cashout.fltSystemCountedBasedOnSystemTradeIn + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemCash
                                                    + cashout.fltSystemCountedBasedOnSystemDebit + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemVisa).ToString("C");

                            txtTradeIn.Text    = cashout.fltManuallyCountedBasedOnReceiptsTradeIn.ToString("#0.00");
                            txtGiftCard.Text   = cashout.fltManuallyCountedBasedOnReceiptsGiftCard.ToString("#0.00");
                            txtCash.Text       = cashout.fltManuallyCountedBasedOnReceiptsCash.ToString("#0.00");
                            txtDebit.Text      = cashout.fltManuallyCountedBasedOnReceiptsDebit.ToString("#0.00");
                            txtMasterCard.Text = cashout.fltManuallyCountedBasedOnReceiptsMastercard.ToString("#0.00");
                            txtVisa.Text       = cashout.fltManuallyCountedBasedOnReceiptsVisa.ToString("#0.00");

                            lblReceiptsFinal.Text = (cashout.fltManuallyCountedBasedOnReceiptsTradeIn + cashout.fltManuallyCountedBasedOnReceiptsGiftCard + cashout.fltManuallyCountedBasedOnReceiptsCash
                                                     + cashout.fltManuallyCountedBasedOnReceiptsDebit + cashout.fltManuallyCountedBasedOnReceiptsMastercard + cashout.fltManuallyCountedBasedOnReceiptsVisa).ToString("C");
                            lblTotalFinal.Text = (cashout.fltSystemCountedBasedOnSystemTradeIn + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemCash
                                                  + cashout.fltSystemCountedBasedOnSystemDebit + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemVisa).ToString("C");
                            lblOverShortFinal.Text = cashout.fltCashDrawerOverShort.ToString("C");
                        }
                        else
                        {
                            //Creating a cashout list and calling a method that grabs all mops and amounts paid
                            cashout                   = R.CreateNewCashout(selectedDate, locationID, objPageDetails);
                            lblVisaDisplay.Text       = cashout.fltSystemCountedBasedOnSystemVisa.ToString("C");
                            lblMasterCardDisplay.Text = cashout.fltSystemCountedBasedOnSystemMastercard.ToString("C");
                            lblCashDisplay.Text       = cashout.fltSystemCountedBasedOnSystemCash.ToString("C");
                            lblGiftCardDisplay.Text   = cashout.fltSystemCountedBasedOnSystemGiftCard.ToString("C");
                            lblDebitDisplay.Text      = cashout.fltSystemCountedBasedOnSystemDebit.ToString("C");
                            lblTradeInDisplay.Text    = cashout.fltSystemCountedBasedOnSystemTradeIn.ToString("C");
                            lblTotalDisplay.Text      = (cashout.fltSystemCountedBasedOnSystemVisa + cashout.fltSystemCountedBasedOnSystemMastercard + cashout.fltSystemCountedBasedOnSystemCash
                                                         + cashout.fltSystemCountedBasedOnSystemGiftCard + cashout.fltSystemCountedBasedOnSystemDebit + (cashout.fltSystemCountedBasedOnSystemTradeIn)).ToString("C");
                            lblGSTDisplay.Text    = cashout.fltGovernmentTaxAmount.ToString("C");
                            lblPSTDisplay.Text    = cashout.fltProvincialTaxAmount.ToString("C");
                            lblLCTDisplay.Text    = cashout.fltLiquorTaxAmount.ToString("C");
                            lblPreTaxDisplay.Text = (cashout.fltSalesSubTotal + cashout.fltSystemCountedBasedOnSystemTradeIn).ToString("C");

                            cashout.fltManuallyCountedBasedOnReceiptsTradeIn    = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsGiftCard   = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsCash       = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsDebit      = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsMastercard = 0;
                            cashout.fltManuallyCountedBasedOnReceiptsVisa       = 0;
                            cashout.fltCashDrawerOverShort = 0;
                            R.CallInsertCashout(cashout, objPageDetails);
                        }
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        private async Task <(Guid, List <BaseHistoryRecord>)> GenerateData(string[] pairs, string[] assets)
        {
            var walletId = Guid.NewGuid();
            var random   = new Random();

            const int cashinsCount  = 5;
            const int cashoutsCount = 3;
            const int tradesCount   = 20;

            var list = new List <BaseHistoryRecord>();

            for (var i = 0; i < cashinsCount; i++)
            {
                var cashin = new Cashin
                {
                    Id        = Guid.NewGuid(),
                    WalletId  = walletId,
                    AssetId   = assets[random.Next(assets.Length)],
                    State     = HistoryState.Finished,
                    Timestamp = DateTime.UtcNow,
                    Volume    = random.Next(1, 100)
                };

                list.Add(cashin);
            }

            for (var i = 0; i < cashoutsCount; i++)
            {
                var cashout = new Cashout
                {
                    Id        = Guid.NewGuid(),
                    WalletId  = walletId,
                    AssetId   = assets[random.Next(assets.Length)],
                    State     = HistoryState.Finished,
                    Timestamp = DateTime.UtcNow,
                    Volume    = -random.Next(1, 100)
                };

                list.Add(cashout);
            }

            for (var i = 0; i < tradesCount; i++)
            {
                var cashout = new Trade
                {
                    Id             = Guid.NewGuid(),
                    WalletId       = walletId,
                    BaseAssetId    = assets[random.Next(assets.Length)],
                    Timestamp      = DateTime.UtcNow,
                    BaseVolume     = -random.Next(1, 100),
                    QuotingAssetId = assets[random.Next(assets.Length)],
                    QuotingVolume  = random.Next(1, 50),
                    AssetPairId    = pairs[random.Next(pairs.Length)],
                    OrderId        = Guid.NewGuid(),
                    Price          = random.Next() * 100
                };

                list.Add(cashout);
            }

            var repo = _container.Resolve <IHistoryRecordsRepository>();

            await repo.InsertBulkAsync(list);

            return(walletId, list);
        }