public void CreditNoteAnonymousUserCashpoolEnabledTest() { StationRepository.Setup(x => x.GetUid(It.IsAny <User>())).Returns(new uid()); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); StationRepository.Setup(x => x.SetCashInDefaultState(It.IsAny <decimal>())); StationRepository.Setup(x => x.DisableCashIn()); decimal reserved; decimal factor; WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out reserved, out factor)).Returns(10m); StationRepository.Setup(x => x.AllowAnonymousBetting).Returns(true); TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>()); TicketHandler.Object.TicketsInBasket.Add(new Ticket()); TicketHandler.Object.TicketsInBasket[0].MaxBet = 1000; WsdlRepository.Setup(x => x.DepositByCreditNote(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true); ChangeTracker.Setup(x => x.CurrentUser).Returns(new AnonymousUser("1", 1)); var model = new BaseViewModel(); model.GetMoneyFromCreditNote(new CreditNoteWS() { amount = 10 }); Assert.AreEqual(ChangeTracker.Object.CurrentUser.Cashpool, 10); Assert.AreEqual(TicketHandler.Object.TicketsInBasket[0].Stake, 0); }
private void PrintCreditNoteFromTicketPleaseWait() { string error = ""; var number = BusinessPropsHelper.GenerateNextCreditNoteNumber(); var checkSum = new PasswordGenerator().Generate(4, 4, true); var result = TransactionQueueHelper.TryDepositByTicketMoneyOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(ChangeTracker.CurrentUser), CurrentTicket.ticketNbr, CurrentTicket.checkSum, number, checkSum, ref error); if (!result) { ShowError(error); } else { var sucess = PrinterHandler.PrintCreditNote(CurrentTicket.wonAmount, number, checkSum, false, DateTime.MinValue, DateTime.MinValue); if (!sucess) { GetMoneyFromCreditNote(new CreditNoteWS() { amount = CurrentTicket.wonAmount, number = number, code = checkSum }); ShowError(TranslationProvider.Translate(MultistringTags.UNABLE_TO_PRINT_CREDITNOTE) + "\r\n" + TranslationProvider.Translate(MultistringTags.SHOP_FORM_CREDITNOTE) + ": " + number + " " + checkSum); } } Log.Error(error, new Exception(error)); CurrentTicket = WsdlRepository.LoadTicket(CurrentTicket.ticketNbr, CurrentTicket.checkSum, StationRepository.StationNumber, SelectedLanguage, SelectedLanguage, true); ReloadTicket(CurrentTicket); }
public void CreditNoteLoggedInUserCashpoolDisabledTest() { decimal amount = 0; decimal factor; StationRepository.Setup(x => x.AllowAnonymousBetting).Returns(true); StationRepository.Setup(x => x.GetUid(It.IsAny <User>())).Returns(new uid()); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>()); TicketHandler.Object.TicketsInBasket.Add(new Ticket()); WsdlRepository.Setup(x => x.DepositByCreditNote(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true); WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out amount, out factor)).Returns(1010); ChangeTracker.Setup(x => x.CurrentUser).Returns(new LoggedInUser(1, "1", 1000, 10, 10, 10)); string error = ""; TransactionQueueHelper.Setup(x => x.TryDepositByCreditNoteMoneyOnHub(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <string>(), It.IsAny <string>(), ref error)).Returns(true); var model = new BaseViewModel(); model.GetMoneyFromCreditNote(new CreditNoteWS() { amount = 10 }); WsdlRepository.Verify(x => x.GetBalance(It.IsAny <uid>(), out amount, out factor));; Assert.AreEqual(ChangeTracker.Object.CurrentUser.Cashpool, 1010); Assert.AreEqual(TicketHandler.Object.TicketsInBasket[0].Stake, 0); }
public int StoreTicket(User uid, TicketWS TicketDataWS, string StationNumber, bool IsOffLineTicket, string pin, bool livebet) { StationRepository.SetStationAppConfigValue("LastTicketNbr", TicketDataWS.ticketNbr + " " + TicketDataWS.checkSum); int iResult = TransactionQueueHelper.TryStoreTicketOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(uid), TicketDataWS, StationNumber, IsOffLineTicket, pin); return(iResult); }
public void AddMoney(object sender, CashInEventArgs e) { ChangeTracker.CurrentUser.DailyLimit -= e.MoneyIn; ChangeTracker.CurrentUser.MonthlyLimit -= e.MoneyIn; ChangeTracker.CurrentUser.WeeklyLimit -= e.MoneyIn; Exception error = null; var balance = TransactionQueueHelper.TryDepositMoneyOnHub(BusinessPropsHelper.GetNextTransactionId(), StationRepository.GetUid(ChangeTracker.CurrentUser), e.MoneyIn, true, ref error, e.IsCoin ? CashAcceptorType.CoinAcceptor : CashAcceptorType.BillValidator); AddMoneyToTerminal(e.MoneyIn, error == null ? "" : error.ToString(), balance); }
public void CloseBalance() { decimal cashoutCurrentAmount = 0; BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount); var text = TranslationProvider.Translate(MultistringTags.TERMINAL_COLLECT_CASH, _cashinCurrentAmount, StationRepository.Currency); QuestionWindowService.ShowMessage(text, null, null, askWindow_YesClick, null); }
private void OnTestModeCommand() { decimal cashoutCurrentAmount = 0; BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount); if (_cashinCurrentAmount - cashoutCurrentAmount > 0) { ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_PRODUCE_EMPTY_BOX).ToString(), null, false, 3); } else { Mediator.SendMessage("testmode", MsgTag.RestartInTestMode); } }
public void CreditNoteAnonymousUserCashpoolDisabledTest() { //StationRepository.BackToRecord(); IoCContainer.Kernel.Unbind <IChangeTracker>(); IoCContainer.Kernel.Bind <IChangeTracker>().To <ChangeTracker>().InSingletonScope(); var ChangeTracker = IoCContainer.Kernel.Get <IChangeTracker>(); TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>()); TicketHandler.Object.TicketsInBasket.Add(new Ticket()); StationRepository.Setup(x => x.GetUid(It.IsAny <User>())).Returns(new uid()); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); StationRepository.Setup(x => x.SetCashInDefaultState(It.IsAny <decimal>())); StationRepository.Setup(x => x.DisableCashIn()); decimal reserved; decimal factor; WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out reserved, out factor)).Returns(10m); StationRepository.Setup(x => x.AllowAnonymousBetting).Returns(true); TicketHandler.Object.TicketsInBasket[0] = new Ticket(); TicketHandler.Object.TicketsInBasket[0].MaxBet = 1000; TicketHandler.Object.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 1, OddId = { Value = 1 }, BetDomain = new TestBetDomain() { BetDomainId = 1, Match = new TestMatchLn() { MatchId = 1 } }, Value = { Value = 1.9M } })); WsdlRepository.Setup(x => x.DepositByCreditNote(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true); //StationRepository.Replay(); ChangeTracker.CurrentUser = new AnonymousUser("1", 1); var model = new BaseViewModel(); model.GetMoneyFromCreditNote(new CreditNoteWS() { amount = 10 }); Assert.AreEqual(ChangeTracker.CurrentUser.Cashpool, 10); Assert.AreEqual(TicketHandler.Object.TicketsInBasket[0].Stake, 0); }
private void OnVerifyStation() { decimal cashoutCurrentAmount = 0; decimal cashinCurrentAmount = 0; BusinessPropsHelper.GetAccountingAmount(out cashinCurrentAmount, out cashoutCurrentAmount); if (cashinCurrentAmount - cashoutCurrentAmount > 0) { var text = TranslationProvider.Translate(MultistringTags.TERMINAL_EMPTY_BOX_BEFORE_VALIDATION).ToString(); var yesButtonText = TranslationProvider.Translate(MultistringTags.SHOP_FORM_OK) as string; var noButtonText = TranslationProvider.Translate(MultistringTags.SHOP_FORM_CANCEL) as string; QuestionWindowService.ShowMessage(text, yesButtonText, noButtonText, OnCloseBalance, null); return; } OnAcceptCommand(); }
private bool CheckForEmptyBox() { bool result = false; decimal cashoutCurrentAmount = 0; decimal _cashinCurrentAmount = 0; if (ChangeTracker.CurrentUser.ViewEmptyBox) { BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount); if (_cashinCurrentAmount - cashoutCurrentAmount > 0) { result = true; } } return(result); }
public void CreditNoteLoggedInUserCashpoolEnabledTest() { BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); StationRepository.Setup(x => x.AllowAnonymousBetting).Returns(true); StationRepository.Setup(x => x.GetUid(It.IsAny <User>())).Returns(new uid()); TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>()); TicketHandler.Object.TicketsInBasket.Add(new Ticket()); WsdlRepository.Setup(x => x.DepositByCreditNote(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true); ChangeTracker.Setup(x => x.CurrentUser).Returns(new LoggedInUser(1, "1", 0, 10, 10, 10)); var model = new BaseViewModel(); model.GetMoneyFromCreditNote(new CreditNoteWS() { amount = 10 }); Assert.AreEqual(ChangeTracker.Object.CurrentUser.Cashpool, 0); Assert.AreEqual(TicketHandler.Object.TicketsInBasket[0].Stake, 0); }
public AccountingBaseViewModel() { ShowCommand = new Command(ShowOverview); //CloseCommand = new Command(CloseWindow); CreateCheckpointCommand = new Command(OnCheckPoint); ShowCreditCommand = new Command(OnCredit); ShowCheckPointsCommand = new Command(OnShowCheckPoints); CheckPointsCommand = new Command(OnCheckPoints); BackCommand = new Command(OnBackCommand); EnabledCheckPoint = ChangeTracker.CurrentUser.CloseBalance; EnabledShowCheckPoints = ChangeTracker.CurrentUser.ViewStationBalance; EnabledCredit = ChangeTracker.CurrentUser.Credit; if (ChangeTracker.CurrentUser != null) { decimal cashinCurrentAmount, cashoutCurrentAmount; BusinessPropsHelper.GetAccountingAmount(out cashinCurrentAmount, out cashoutCurrentAmount); IsEnabledCloseBalance = cashinCurrentAmount - cashoutCurrentAmount > 0 && ChangeTracker.CurrentUser.EmptyBox; } }
public void PleaseWaitCloseBalance() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } long cashoutId = GetLastCashoutId() + 1; Dictionary <Decimal, int> CashinNotes = GetNotesValuesAndCount(cashoutId); decimal cashoutCurrentAmount = 0; TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), ref _cashinCurrentAmount, false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true); foreach (var cashinNote in CashinNotes) { Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value); } PrinterHandler.PrintCashBalance(CashinNotes, StartDate, DateTime.Now, _cashinCurrentAmount, 0, _cashinCurrentAmount, false, false, ChangeTracker.CurrentUser.Username, GetNumberOfCheckpoints() + 1); BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount); IsEnabledCloseBalance = _cashinCurrentAmount - cashoutCurrentAmount > 0; }
public void MultyTicketWsAndPrintTest() { IoCContainer.Kernel.Unbind <IConfidenceFactor>(); IoCContainer.Kernel.Bind <IConfidenceFactor>().ToConstant <IConfidenceFactor>(ConfidenceFactor.Object).InSingletonScope(); ConfidenceFactor.Setup(x => x.CalculateFactor(It.IsAny <Ticket>())).Returns(1000000); IoCContainer.Kernel.Unbind <IStationRepository>(); IoCContainer.Kernel.Unbind <IChangeTracker>(); IoCContainer.Kernel.Bind <IChangeTracker>().To <ChangeTracker>().InSingletonScope(); var ChangeTracker = IoCContainer.Kernel.Get <IChangeTracker>(); IoCContainer.Kernel.Unbind <ITicketHandler>(); IoCContainer.Kernel.Bind <ITicketHandler>().To <TicketHandler>().InSingletonScope(); var TicketHandler = IoCContainer.Kernel.Get <ITicketHandler>(); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); IoCContainer.Kernel.Unbind <IDataBinding>(); var DataBinding = new DataBinding(); IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope(); var stationRepository = new StationRepository(); IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(stationRepository).InSingletonScope(); stationRepository.MaxOdd = 1000; stationRepository.MaxCombination = 1000; stationRepository.MaxStakeSystemBet = 1000; stationRepository.MaxStakeCombi = 1000; stationRepository.MaxSystemBet = 1000; stationRepository.MaxWinSystemBet = 10000; stationRepository.IsReady = true; stationRepository.BonusFromOdd = 3.0m; long[] tipLock; long[] tournamentlock; WsdlRepository.Setup(x => x.SaveTicket(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <TicketWS>(), It.IsAny <bool>(), It.IsAny <string>(), out tipLock, out tournamentlock)).Returns("1"); TicketHandler.TicketsInBasket.Add(new Ticket()); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 1, OddId = { Value = 1 }, OddView = new TestOddVw() { Value = 1 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 1, Match = new TestMatchLn { MatchId = 1, Code = { Value = 1 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 2.80M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 2, OddId = { Value = 2 }, OddView = new TestOddVw() { Value = 2 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 2, Match = new TestMatchLn { MatchId = 2, Code = { Value = 2 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 2.10M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 3, OddId = { Value = 3 }, OddView = new TestOddVw() { Value = 3 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 3, Match = new TestMatchLn { MatchId = 3, Code = { Value = 3 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 3.30M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 4, OddId = { Value = 4 }, OddView = new TestOddVw() { Value = 4 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 4, Match = new TestMatchLn { MatchId = 4, Code = { Value = 4 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 2.70M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 5, OddId = { Value = 5 }, OddView = new TestOddVw() { Value = 5 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 5, Match = new TestMatchLn { MatchId = 5, Code = { Value = 5 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 3.10M } })); TicketHandler.TicketsInBasket[0].Stake = 10; stationRepository.BonusRangeList.Add(new BonusRangeWS { tipSize = 1, bonus = 5 }); stationRepository.BonusRangeList.Add(new BonusRangeWS { tipSize = 2, bonus = 10 }); ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10); TicketHandler.TicketState = TicketStates.Multy; TicketHandler.TicketsInBasket[0].Stake = 10; TicketHandler.UpdateTicket(); Assert.AreEqual(10m, TicketHandler.Stake); Assert.AreEqual(1786.52628000000m, TicketHandler.CurrentTicketPossibleWin); Assert.AreEqual(10m, TicketHandler.BonusPercentage); Assert.AreEqual(162.41148000000m, TicketHandler.BonusValue); var ticketActions = new TicketActions(); TicketWS ticket = ticketActions.CreateNewTicketWS(TicketHandler.TicketsInBasket[0]); ticketActions.SaveTicket(ref ticket, ChangeTracker.CurrentUser); Assert.AreEqual(5, ticket.bets[0].bankTips.Length); Assert.AreEqual(10m, ticket.stake); Assert.AreEqual(1.1m, ticket.superBonus); stationRepository.UsePrinter = true; Repository.Expect(x => x.GetOddBySvrId(It.IsAny <long>())).Returns(new OddVw(new OddLn { NameTag = { Value = "test" } })); TranslationProvider.Object.PrintingLanguage = "EN"; TranslationProvider.Setup(x => x.Translate(It.IsAny <MultistringTag>())).Returns("{0}"); PrinterHandler printerHandler = new PrinterHandler(); var xml = printerHandler.CreateTicketXmlForPrinting(ticket, false, null); var stringxml = xml.ToString(); if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ".") { Assert.IsTrue(stringxml.Contains("162.4")); } if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",") { Assert.IsTrue(stringxml.Contains("162,4")); } }
public void PrintdublicateTest() { IoCContainer.Kernel.Rebind <IStationRepository>().To <StationRepository>().InSingletonScope(); var rep = IoCContainer.Kernel.Get <IStationRepository>(); //rep.Init(); rep.UsePrinter = true; IoCContainer.Kernel.Unbind <IConfidenceFactor>(); IoCContainer.Kernel.Bind <IConfidenceFactor>().ToConstant <IConfidenceFactor>(ConfidenceFactor.Object).InSingletonScope(); ConfidenceFactor.Setup(x => x.CalculateFactor(It.IsAny <Ticket>())).Returns(1000000); IoCContainer.Kernel.Unbind <IStationRepository>(); IoCContainer.Kernel.Unbind <IChangeTracker>(); var ChangeTracker = new ChangeTracker(); IoCContainer.Kernel.Bind <IChangeTracker>().ToConstant <IChangeTracker>(ChangeTracker).InSingletonScope(); IoCContainer.Kernel.Unbind <IDataBinding>(); var DataBinding = new DataBinding(); IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope(); IoCContainer.Kernel.Unbind <ITicketHandler>(); var TicketHandler = new TicketHandler(); IoCContainer.Kernel.Bind <ITicketHandler>().ToConstant <ITicketHandler>(TicketHandler).InSingletonScope(); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); var stationRepository = new StationRepository(); IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(stationRepository).InSingletonScope(); stationRepository.MaxOdd = 1000; stationRepository.MaxCombination = 1000; stationRepository.MaxStakeSystemBet = 1000; stationRepository.MaxStakeCombi = 1000; stationRepository.MaxSystemBet = 1000; stationRepository.MaxWinSystemBet = 10000; stationRepository.MaxWinSingleBet = 10000; stationRepository.IsReady = true; stationRepository.BonusFromOdd = 1.30m; stationRepository.UsePrinter = true; StationSettings.Setup(x => x.UsePrinter).Returns(true); long[] tipLock; long[] tournamentlock; TicketHandler.TicketsInBasket.Add(new Ticket()); WsdlRepository.Setup(x => x.SaveTicket(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <TicketWS>(), It.IsAny <bool>(), It.IsAny <string>(), out tipLock, out tournamentlock)).Returns("1"); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 1, OddId = { Value = 1 }, OddView = new TestOddVw() { Value = 1 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 1, Match = new TestMatchLn { MatchId = 1, Code = { Value = 1 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.14M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 2, OddId = { Value = 2 }, OddView = new TestOddVw() { Value = 2 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 2, Match = new TestMatchLn { MatchId = 2, Code = { Value = 2 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.40M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 3, OddId = { Value = 3 }, OddView = new TestOddVw() { Value = 3 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 3, Match = new TestMatchLn { MatchId = 3, Code = { Value = 3 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.50M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 4, OddId = { Value = 4 }, OddView = new TestOddVw() { Value = 4 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 4, Match = new TestMatchLn { MatchId = 4, Code = { Value = 4 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.25M } })); stationRepository.BonusRangeList.Add(new BonusRangeWS { tipSize = 1, bonus = 3 }); TicketHandler.TicketsInBasket[0].Stake = 10; ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10); TicketHandler.TicketState = TicketStates.System; TicketHandler.TicketsInBasket[0].SystemX = 2; TicketHandler.TicketsInBasket[0].Stake = 5; TicketHandler.UpdateTicket(); var ticketActions = new TicketActions(); TicketWS ticket = ticketActions.CreateNewTicketWS(TicketHandler.TicketsInBasket[0]); ticketActions.SaveTicket(ref ticket, ChangeTracker.CurrentUser); var PrinterHandler = new PrinterHandler(); stationRepository.UsePrinter = true; PrinterHandler.PrintTicket(ticket, false); Assert.AreEqual(PrinterHandler.NotPrintedItemsCount, 1); PrinterHandler.PrintTicket(ticket, false); Assert.AreEqual(PrinterHandler.NotPrintedItemsCount, 2); PrinterHandler.DeleteAllPrinterObjects(); Assert.AreEqual(0, PrinterHandler.NotPrintedItemsCount); }
public void CreateTicketWsTest() { IoCContainer.Kernel.Unbind <IConfidenceFactor>(); IoCContainer.Kernel.Bind <IConfidenceFactor>().ToConstant <IConfidenceFactor>(ConfidenceFactor.Object).InSingletonScope(); ConfidenceFactor.Expect(x => x.CalculateFactor(It.IsAny <Ticket>())).Returns(1000000); IoCContainer.Kernel.Unbind <IStationRepository>(); IoCContainer.Kernel.Unbind <IChangeTracker>(); var ChangeTracker = new ChangeTracker(); IoCContainer.Kernel.Bind <IChangeTracker>().ToConstant <IChangeTracker>(ChangeTracker).InSingletonScope(); IoCContainer.Kernel.Unbind <IDataBinding>(); var DataBinding = new DataBinding(); IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope(); IoCContainer.Kernel.Unbind <ITicketHandler>(); var TicketHandler = new TicketHandler(); IoCContainer.Kernel.Bind <ITicketHandler>().ToConstant <ITicketHandler>(TicketHandler).InSingletonScope(); BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123"); var stationRepository = new StationRepository(); IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(stationRepository).InSingletonScope(); stationRepository.MaxOdd = 1000; stationRepository.MaxCombination = 1000; stationRepository.MaxStakeSystemBet = 1000; stationRepository.MaxStakeCombi = 1000; stationRepository.MaxSystemBet = 1000; stationRepository.MaxWinSystemBet = 10000; stationRepository.MaxWinSingleBet = 10000; stationRepository.IsReady = true; stationRepository.BonusFromOdd = 1.30m; long[] tipLock; long[] tournamentlock; TicketHandler.TicketsInBasket.Add(new Ticket()); WsdlRepository.Setup(x => x.SaveTicket(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <TicketWS>(), It.IsAny <bool>(), It.IsAny <string>(), out tipLock, out tournamentlock)).Returns("1"); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 1, OddId = { Value = 1 }, OddView = new TestOddVw() { Value = 1 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 1, Match = new TestMatchLn { MatchId = 1, Code = { Value = 1 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.14M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 2, OddId = { Value = 2 }, OddView = new TestOddVw() { Value = 2 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 2, Match = new TestMatchLn { MatchId = 2, Code = { Value = 2 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.40M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 3, OddId = { Value = 3 }, OddView = new TestOddVw() { Value = 3 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 3, Match = new TestMatchLn { MatchId = 3, Code = { Value = 3 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.50M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd { OutcomeId = 4, OddId = { Value = 4 }, OddView = new TestOddVw() { Value = 4 }, BetDomain = new TestBetDomain { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 4, Match = new TestMatchLn { MatchId = 4, Code = { Value = 4 }, MatchView = new TestMatchVw { LineObject = new MatchLn() } } }, Value = { Value = 1.25M } })); stationRepository.BonusRangeList.Add(new BonusRangeWS { tipSize = 1, bonus = 3 }); TicketHandler.TicketsInBasket[0].Stake = 10; ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10); TicketHandler.TicketState = TicketStates.System; TicketHandler.TicketsInBasket[0].SystemX = 2; TicketHandler.TicketsInBasket[0].Stake = 5; TicketWS newticket = new TicketWS(); TicketActions.Setup(x => x.CreateNewTicketWS(It.IsAny <Ticket>())).Returns(newticket); TicketHandler.UpdateTicket(); Assert.AreEqual(2, TicketHandler.TicketsInBasket[0].SystemX); Assert.AreEqual(3, TicketHandler.TicketsInBasket[0].SystemY); Assert.AreEqual(5m, TicketHandler.Stake); Assert.AreEqual(11.203824999999999999999999999m, TicketHandler.CurrentTicketPossibleWin); var ticketActions = new TicketActions(); TicketWS ticket = ticketActions.CreateNewTicketWS(TicketHandler.TicketsInBasket[0]); ticketActions.SaveTicket(ref ticket, ChangeTracker.CurrentUser); Assert.AreEqual(1.03m, ticket.superBonus); Assert.AreEqual(5m, ticket.stake); Assert.AreEqual(2.17m, ticket.bets[0].maxOdd); Assert.AreEqual(11.203824999999999999999999999m, TicketHandler.CurrentTicketPossibleWin); Assert.AreEqual(11.203824999999999999999999999m, ticket.bets[0].maxWin); Assert.AreEqual(3m, TicketHandler.BonusPercentage); if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ".") { Assert.AreEqual("0.32", SportBetting.WPF.Prism.OldCode.PrinterHandler.Decimal2String(TicketHandler.BonusValue, 2)); } if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",") { Assert.AreEqual("0,32", SportBetting.WPF.Prism.OldCode.PrinterHandler.Decimal2String(TicketHandler.BonusValue, 2)); } }
public void CreateTicketWsTest() { DatabaseManager.EnsureDatabase(false); IoCContainer.Kernel.Unbind <IConfidenceFactor>(); IoCContainer.Kernel.Bind <IConfidenceFactor>().ToConstant <IConfidenceFactor>(ConfidenceFactor.Object).InSingletonScope(); ConfidenceFactor.Expect(x => x.CalculateFactor(It.IsAny <Ticket>())).Returns(1000000); IoCContainer.Kernel.Rebind <IChangeTracker>().To <ChangeTracker>().InSingletonScope(); var ChangeTracker = IoCContainer.Kernel.Get <IChangeTracker>(); IoCContainer.Kernel.Rebind <ITicketHandler>().To <TicketHandler>().InSingletonScope(); var TicketHandler = IoCContainer.Kernel.Get <ITicketHandler>(); BusinessPropsHelper.Expect(x => x.GetNextTransactionId()).Returns("123"); var DataBinding = new DataBinding(); IoCContainer.Kernel.Rebind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope(); var stationRepository = new StationRepository(); IoCContainer.Kernel.Rebind <IStationRepository>().ToConstant <IStationRepository>(stationRepository).InSingletonScope(); stationRepository.MaxOdd = 1000; stationRepository.MaxCombination = 1000; stationRepository.MaxStakeSystemBet = 1000; stationRepository.MaxSystemBet = 1000; stationRepository.MaxWinSystemBet = 10000; stationRepository.IsReady = true; stationRepository.BonusFromOdd = 3.0m; TicketHandler.TicketsInBasket.Add(new Ticket()); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 1, OddId = { Value = 1 }, OddView = new TestOddVw() { Value = 1 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 1, Match = new TestMatchLn() { MatchId = 1, MatchView = new TestMatchVw() { LineObject = new MatchLn() } } }, Value = { Value = 2.80M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 2, OddId = { Value = 2 }, OddView = new TestOddVw() { Value = 2 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 2, Match = new TestMatchLn() { MatchId = 2, MatchView = new TestMatchVw() { LineObject = new MatchLn() } } }, Value = { Value = 2.10M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 3, OddId = { Value = 3 }, OddView = new TestOddVw() { Value = 3 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 3, Match = new TestMatchLn() { MatchId = 3, MatchView = new TestMatchVw() { LineObject = new MatchLn() } } }, Value = { Value = 3.30M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 4, OddId = { Value = 4 }, OddView = new TestOddVw() { Value = 4 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 4, Match = new TestMatchLn() { MatchId = 4, MatchView = new TestMatchVw() { LineObject = new MatchLn() } } }, Value = { Value = 2.70M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 5, OddId = { Value = 5 }, OddView = new TestOddVw() { Value = 5 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 5, Match = new TestMatchLn() { MatchId = 5, MatchView = new TestMatchVw() { LineObject = new MatchLn() } } }, Value = { Value = 3.10M } })); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 6, OddId = { Value = 6 }, OddView = new TestOddVw() { Value = 6 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 6, Match = new TestMatchLn() { MatchId = 6 } }, Value = { Value = 1.80M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 7, OddId = { Value = 7 }, OddView = new TestOddVw() { Value = 7 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 7, Match = new TestMatchLn() { MatchId = 7 } }, Value = { Value = 1.70M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 8, OddId = { Value = 8 }, OddView = new TestOddVw() { Value = 8 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 8, Match = new TestMatchLn() { MatchId = 8 } }, Value = { Value = 3.20M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 9, OddId = { Value = 9 }, OddView = new TestOddVw() { Value = 9 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 9, Match = new TestMatchLn() { MatchId = 8 } }, Value = { Value = 2.10M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 10, OddId = { Value = 10 }, OddView = new TestOddVw() { Value = 10 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 10, Match = new TestMatchLn() { MatchId = 9 } }, Value = { Value = 5.60M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 11, OddId = { Value = 11 }, OddView = new TestOddVw() { Value = 11 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 11, Match = new TestMatchLn() { MatchId = 9 } }, Value = { Value = 3.70M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd() { OutcomeId = 12, OddId = { Value = 12 }, OddView = new TestOddVw() { Value = 12 }, BetDomain = new TestBetDomain() { BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 12, Match = new TestMatchLn() { MatchId = 9 } }, Value = { Value = 1.55M } }) { IsBank = true }); TicketHandler.TicketsInBasket[0].Stake = 10; stationRepository.BonusRangeList.Add(new BonusRangeWS() { tipSize = 1, bonus = 5 }); stationRepository.BonusRangeList.Add(new BonusRangeWS() { tipSize = 2, bonus = 10 }); ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10); TicketHandler.TicketState = TicketStates.System; TicketHandler.TicketsInBasket[0].Stake = 10; TicketHandler.TicketsInBasket[0].SystemX = 2; TicketHandler.UpdateTicket(); Assert.AreEqual(10m, TicketHandler.Stake); Assert.AreEqual(783.9422976000000m, TicketHandler.CurrentTicketPossibleWin); Assert.AreEqual(10m, TicketHandler.BonusPercentage); Assert.AreEqual(71.2674816000000m, TicketHandler.BonusValue); var ticketActions = new TicketActions(); TicketWS ticket = ticketActions.CreateNewTicketWS(TicketHandler.TicketsInBasket[0]); ticketActions.SaveTicket(ref ticket, ChangeTracker.CurrentUser); Assert.AreEqual(10m, ticket.stake); Assert.AreEqual(1.1m, ticket.superBonus); }
public TicketWS CreateNewTicketWS(Ticket newticket) { var rTicketWs = new TicketWS(); List <ITipItemVw> ti = newticket.TipItems.ToSyncList().Where(x => x.IsChecked).ToList(); try { PasswordGenerator PWGen = new PasswordGenerator(); //if (string.IsNullOrEmpty(rTicketWs.TicketNbr)) //try //{ // long number, creditnumber, transactionnumber; // creditnumber = WsdlRepository.GetBusinessProps(StationRepository.StationNumber, out number, out transactionnumber); // BusinessPropsHelper.Initialize(StationRepository.StationNumber, new BusinessProps(number, creditnumber, transactionnumber)); //} //catch (Exception excp) //{ // Log.Error(ExcpHelper.FormatException(excp, "Initialize(sStationNumber = '{0}', {1}) ERROR", StationRepository.StationNumber, "")); //} rTicketWs.ticketNbr = BusinessPropsHelper.GenerateNextTicketNumber(); //rTicketWs.TicketNbr = StationSettings.GetSettings.StationNumber+DateTime.Now.ToString("yy")+StationSettings.GetSettings.NewTicketNumber.ToString("0000000"); //rTicketWs.TicketNbr = PWGen.Generate(14, 14, true); rTicketWs.checkSum = PWGen.Generate(4, 4, true); rTicketWs.paidBy = StationTyp; rTicketWs.paidTime = DateTime.Now; rTicketWs.paid = false; rTicketWs.acceptedBy = StationTyp; rTicketWs.acceptedTime = DateTime.Now; rTicketWs.stake = newticket.Stake; rTicketWs.cancelledTime = DateTimeUtils.DATETIMENULL; rTicketWs.enablePayTime = DateTime.MaxValue; rTicketWs.wonExpireTime = DateTimeUtils.DATETIMENULL; rTicketWs.userId = (int)ChangeTracker.CurrentUser.AccountId; //string bonusX = newticket.BonusValue.ToString(CultureInfo.InvariantCulture); //string manFeeX = newticket.ManipulationFeeValue.ToString(CultureInfo.InvariantCulture); //string a = Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator; //if (bonusX.IndexOf(a) != -1) //{ // bonusX = bonusX.Substring(0, bonusX.IndexOf(a) + 3); // newticket.BonusValue = Decimal.Parse(bonusX, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture); //} //if (manFeeX.IndexOf(a) != -1) //{ // manFeeX = manFeeX.Substring(0, manFeeX.IndexOf(a) + 3); // newticket.ManipulationFeeValue = Decimal.Parse(manFeeX, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture); //} newticket.BonusValue = ChangeTracker.TruncateDecimal(newticket.BonusValue); newticket.ManipulationFeeValue = ChangeTracker.TruncateDecimal(newticket.ManipulationFeeValue); rTicketWs.manipulationFeeValue = ChangeTracker.TruncateDecimal(newticket.ManipulationFeeValue);// newticket.ManipulationFeeValue; rTicketWs.superBonusValue = ChangeTracker.TruncateDecimal(newticket.BonusValue); BetWS bets = new BetWS(); bets.systemX = bets.systemY = newticket.NumberOfBets; switch (newticket.TicketState) { case TicketStates.Multy: var dup = newticket.TipItems.ToSyncList().GroupBy(x => new { x.Match.MatchId }).Select(group => new { Name = group.Key, Count = group.Count() }).OrderByDescending(x => x.Count); int duplicatesCount = 0; foreach (var x in dup) { if (x.Count > 1) { duplicatesCount += x.Count; } } int baseSize = newticket.NumberOfBets - duplicatesCount; if (duplicatesCount > 0 && baseSize > 0) //means there are ways { bets.systemX = bets.systemY = baseSize; } bets.betType = Bet.BET_TYPE_COMBI; break; case TicketStates.System: bets.betType = Bet.BET_TYPE_SYSTEM; bets.systemX = newticket.SystemX; bets.systemY = newticket.SystemY; break; default: bets.betType = Bet.BET_TYPE_SINGLE; break; } bets.maxOdd = newticket.TotalOddDisplay; //bets.MaxWin = rTicketWs.Stake * bets.MaxOdd; bets.maxWin = newticket.CurrentTicketPossibleWin; bets.stake = rTicketWs.stake; bets.isMaxOddBet = newticket.IsMaxOddBet; rTicketWs.bets = new BetWS[] { bets }; rTicketWs.superBonus = StationRepository.GetBonusValueForBets(newticket) / 100 + 1; rTicketWs.manipulationFee = StationRepository.GetManipulationFeePercentage(newticket); Dictionary <long, int> matchIDCountDictionary = new Dictionary <long, int>(); foreach (TipItemVw t in ti) { long iMatchCode = t.Match.MatchId; if (matchIDCountDictionary.ContainsKey(iMatchCode)) { matchIDCountDictionary[iMatchCode]++; } else { matchIDCountDictionary.Add(iMatchCode, 1); } } int liveBetTipCount = 0; int sportBetTipCount = 0; var tips2BetMulti = new ObservableCollection <TipWS>(); var bankTips = new ObservableCollection <TipWS>(); foreach (TipItemVw t in ti) { if (t.Odd != null) { if (t.Odd.IsLiveBet.Value) { liveBetTipCount++; } else { sportBetTipCount++; } } TipWS tip = new TipWS(); tip.bank = t.IsBank; if (t.Odd != null) { tip.odd = t.Value; tip.svrOddID = t.Odd.OutcomeId; //TODO: Wurde auf ServerOddID umgewandelt *g* 05.03.2008 by GMU SportRadar.DAL.OldLineObjects.eServerSourceType sType = t.Odd.BetDomain.Match.SourceType; if (sType == SportRadar.DAL.OldLineObjects.eServerSourceType.BtrLive || sType == SportRadar.DAL.OldLineObjects.eServerSourceType.BtrVfl || sType == SportRadar.DAL.OldLineObjects.eServerSourceType.BtrVhc) { tip.svrOddID = tip.svrOddID * -1; } tip.betDomainNumber = t.Odd.BetDomain.BetDomainNumber.Value; tip.matchCode = t.Odd.BetDomain.Match.Code.Value; tip.oddTag = t.Odd.OddTag.Value; } if (tip.bank || matchIDCountDictionary[t.Match.MatchId] != 1) { tip.bankGroupID = t.Match.MatchId; tip.bank = matchIDCountDictionary[t.Match.MatchId] == 1; //Mehrwege haben kein Bank-Flag if (newticket.TicketState == TicketStates.Multy && matchIDCountDictionary[t.Match.MatchId] != 1) { bets.betType = Bet.BET_TYPE_COMBIPATH; } else if (newticket.TicketState == TicketStates.System && matchIDCountDictionary[t.Match.MatchId] != 1) { bets.betType = Bet.BET_TYPE_SYSTEMPATH; } tips2BetMulti.Add(tip); //banken von system mit banken } else { bankTips.Add(tip); //system, kombi, einzeln } } bets.tips2BetMulti = tips2BetMulti.ToArray(); bets.bankTips = bankTips.ToArray(); if (newticket.TipItems[0].Match.MatchView.LineObject.SourceType == SportRadar.DAL.OldLineObjects.eServerSourceType.BtrVfl) { rTicketWs.ticketTyp = Ticket.TICKET_TYP_VFL; } else if (newticket.TipItems[0].Match.MatchView.LineObject.SourceType == SportRadar.DAL.OldLineObjects.eServerSourceType.BtrVhc) { rTicketWs.ticketTyp = Ticket.TICKET_TYP_VHC; } else if (liveBetTipCount > 0 && sportBetTipCount == 0) { rTicketWs.ticketTyp = Ticket.TICKET_TYP_LIVEBET; } else if (liveBetTipCount == 0 && sportBetTipCount > 0) { rTicketWs.ticketTyp = Ticket.TICKET_TYP_SPORTBET; } else { rTicketWs.ticketTyp = Ticket.TICKET_TYP_BOTH; } int rowCount = 1; int[,] temp; if (newticket.TicketState == TicketStates.System) { OddUtilities.SetPermutations(out temp, bets.systemY, bets.systemX); rowCount = temp.GetLength(0); } Dictionary <int, int> tempMatchCodeCountDict = new Dictionary <int, int>(); foreach (TipWS t in bets.tips2BetMulti) { if (tempMatchCodeCountDict.ContainsKey(t.matchCode)) { tempMatchCodeCountDict[t.matchCode]++; } else { tempMatchCodeCountDict.Add(t.matchCode, 1); } } foreach (int curCount in tempMatchCodeCountDict.Values) { rowCount *= curCount; } bets.rows = rowCount; return(rTicketWs); } catch (Exception ex) { WriteRemoteError2Log(ex.Message, 1, ex.GetType().ToString(), NbtLogSr.MSG_TERMINAL); return(null); } }
public void askWindow_YesClick(object sender, EventArgs e) { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } long cashoutId = GetLastCashoutId() + 1; Dictionary <Decimal, int> CashinNotes = GetNotesValuesAndCount(cashoutId); TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), ref _cashinCurrentAmount, false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true); foreach (var cashinNote in CashinNotes) { Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value); } PrinterHandler.PrintCashBalance(CashinNotes, ChangeTracker.LastCashoutDate, DateTime.Now, _cashinCurrentAmount, 0, _cashinCurrentAmount, false, false, ChangeTracker.CurrentUser.Username, GetNumberOfCheckpoints() + 1); UpdateCashSummary(); Mediator.SendMessage("", MsgTag.RefreshCashOperations); }
private decimal RegisterAndGetCashInfo(out DateTime startdate, out DateTime enddate, out Dictionary <decimal, int> cashinNotes) { var amount = TransactionQueueHelper.TryRegisterMoneyOnHub(StationRepository.GetUid(ChangeTracker.CurrentUser), BusinessPropsHelper.GetNextTransactionId(), false, "STATION_CASH_OUT", (int)ChangeTracker.CurrentUser.AccountId, true, out startdate, out enddate); if (enddate - startdate < new TimeSpan(0, 0, 5)) { startdate = DateTime.MinValue; } cashinNotes = GetNotesValuesAndCount(startdate, enddate); amount = 0; foreach (var cashinNote in cashinNotes) { amount += cashinNote.Key * cashinNote.Value; } foreach (var cashinNote in cashinNotes) { Log.Debug("cashin notes:" + cashinNote.Key + " amount: " + cashinNote.Value); } return(amount); }