private void OnNewPin() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { //Mediator.SendMessage<double>(0, MsgTag.PrinterNotReady); ShowPrinterErrorMessage(); return; } Random RandNum = new Random(); int RandomNumber = RandNum.Next(1000, 9999); string pin = RandomNumber.ToString(); try { WsdlRepository.ChangeIDCardPin(StationRepository.GetUid(new LoggedInUser(EditUser.AccountId, null, 0)), ref pin); PrinterHandler.PrintPinNote(pin); } catch (System.ServiceModel.FaultException <HubServiceException> exception) { switch (exception.Detail.code) { case 162: ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_CARD) as string); break; } } }
private void OnPrintTickets() { WaitOverlayProvider.ShowWaitOverlay(true); int amount = 0; int.TryParse(AmountNumber, out amount); if (amount > PrinterHandler.PrintedTicketsCount || amount > 20) { int maxAmount = PrinterHandler.PrintedTicketsCount > 20 ? 20 : PrinterHandler.PrintedTicketsCount; ShowError(TranslationProvider.Translate(MultistringTags.DUBLICATES_AMOUNT, maxAmount)); return; } PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } if (!PrinterHandler.PrintLastTickets(amount)) { Log.Error("printing ticket duplicate failed", new Exception()); } WaitOverlayProvider.DisposeAll(); }
private void Command_Print(object sender, ExecutedRoutedEventArgs e) { MainVM.MarginVisibility = Visibility.Hidden; SliderCanvasZoom.Value = 1; Canvas root = new Canvas(); root.Width = MainCanvas.Width; root.Height = MainCanvas.Height; root.UseLayoutRounding = true; foreach (UIElement child in MainCanvas.Children) { var xaml = System.Windows.Markup.XamlWriter.Save(child); if (xaml.Contains("PreviewMouseLeftButtonDown")) { continue; } var deepCopy = System.Windows.Markup.XamlReader.Parse(xaml) as UIElement; root.Children.Add(deepCopy); } PrinterHandler.Print(root, MainVM.SelectedPrinter); //PrinterHandler.PrintFixed(root, MainVM.SelectedPrinter); MainVM.MarginVisibility = Visibility.Visible; }
private void DoRandomPin() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { //Mediator.SendMessage<double>(0, MsgTag.PrinterNotReady); //ShowPrinterErrorMessage(); return; } Random RandNum = new Random(); int RandomNumber = RandNum.Next(1000, 9999); string pin = RandomNumber.ToString(); try { WsdlRepository.ChangeOperatorIDCardPin((int)ChangeTracker.CurrentUser.AccountId, ref pin); PrinterHandler.PrintPinNote(pin); } catch (System.ServiceModel.FaultException <HubServiceException> exception) { switch (exception.Detail.code) { case 162: if (StationRepository.IsIdCardEnabled) { ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_CARD) as string); } else { ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_BARCODECARD) as string); } break; } } }
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); }
private void OnSavePinCommand() { string pin = NewPin.Value.ToString(); try { if (ChangeTracker.CurrentUser is OperatorUser) { WsdlRepository.ChangeOperatorIDCardPin((int)ChangeTracker.CurrentUser.AccountId, ref pin); } else { WsdlRepository.ChangeIDCardPin(StationRepository.GetUid(ChangeTracker.CurrentUser), ref pin); } PrinterHandler.PrintPinNote(pin); NewPin.Value = NewPinConfirmed.Value = string.Empty; NewPin.ValueMasked = NewPinConfirmed.ValueMasked = string.Empty; } catch (System.ServiceModel.FaultException <HubServiceException> exception) { switch (exception.Detail.code) { case 162: if (StationRepository.IsIdCardEnabled) { ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_CARD)); } else { ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_BARCODECARD)); } break; } } }
public void PleaseWaitPrintInfo() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage("info"); return; } long checkpointStart = CashOperations.OrderBy(x => x.CashOutId).Select(x => x.CashOutId).FirstOrDefault(); long checkpointEnd = CashOperations.OrderBy(x => x.CashOutId).Select(x => x.CashOutId).LastOrDefault(); if (checkpointEnd == 0) { checkpointEnd = long.MaxValue; } var end = EndDate; if (end == DateTime.MinValue) { end = DateTime.Now; } Dictionary <Decimal, int> cashinNotes = GetNotesValuesAndCountFromCollection(CashOperations.ToList()); PrinterHandler.PrintCashBalance(cashinNotes, StartDate, end, CashInOperationsNum, CashOutOperationsNum, 0, false, true, "", 0); }
private void PleaseWaitPrintAccountReceipt(string type) { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(type); return; } //get data for report AccountingRecieptWS accReciept; if (type == "location") { accReciept = WsdlRepository.GetAccountingRecieptData(StartDate, EndDate, StationRepository.StationNumber, StationRepository.LocationID); } else { accReciept = WsdlRepository.GetAccountingRecieptData(StartDate, EndDate, StationRepository.StationNumber, null); } if (accReciept != null) { bool result = PrinterHandler.PrintAccountReceipt(type, accReciept, StartDate, EndDate); if (!result) { ShowPrinterErrorMessage(type); } } }
private void LoadLabels() { var printerSettings = PrinterHandler.GetPrinterSettings(SelectedPrinter); PaperSizes = printerSettings.PaperSizes; //DPI = printerSettings.PrinterResolutions.Cast<PrinterResolution>().OrderByDescending(pr => pr.X).First().X; }
private void WczytajUstawieniaDrukarki() { var printerSettings = PrinterHandler.PobierzUstawieniaDrukarki(WybranaDrukarka); RozmiaryPapieru = printerSettings.PaperSizes; //RozdzielczosciDrukarki = printerSettings.PrinterResolutions; RozdzielczosciDrukarki = (from w in printerSettings.PrinterResolutions.Cast <PrinterResolution>() where w.X > 0 select w).ToList(); //DPI = printerSettings.PrinterResolutions.Cast<PrinterResolution>().OrderByDescending(pr => pr.X).First().X; }
private void OnDefinedPIN(object sender, EventArgs e) { // MyRegionManager.CloseAllViewsInRegion(RegionNames.UserProfileContentRegion); PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } MyRegionManager.NavigateUsingViewModel <PinInsertingViewModel>(RegionNames.UsermanagementContentRegion); }
public void PrintPaymentNoteReceptTest() { IoCContainer.Kernel.Bind <IStationRepository>().To <StationRepository>().InSingletonScope(); var PrinterHandler = new PrinterHandler(); var rep = IoCContainer.Kernel.Get <IStationRepository>(); rep.Init(); rep.UsePrinter = true; PrinterHandler.PrintPaymentRecept("999933333333333333", "", 200, false); }
private void PleaseWaitPrintTestPage() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { //Mediator.SendMessage<double>(0, MsgTag.PrinterNotReady); ShowPrinterErrorMessage("test page"); return; } PrinterHandler.PrintTestString(); }
private void OnPrintDublicate() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage("ticket"); return; } if (!PrinterHandler.PrintLastObject(PrinterHandler.NotPrintedItemsCount)) { Log.Error("printing ticket duplicate failed", new Exception()); } }
private void PrintReport() { if (SelectedCheckpoint == null) { return; } bool isPrinted = PrinterHandler.PrintOperatorShiftReport(SelectedCheckpoint, Balance); if (!isPrinted) { ShowPrinterErrorMessage(); } }
public void PrinterLanguageDefaultSelectedLanguageTest() { var rep = IoCContainer.Kernel.Get <IStationRepository>(); IoCContainer.Kernel.Rebind <ITranslationProvider>().To <DBTranslationProvider>().InSingletonScope(); var translationProvider = IoCContainer.Kernel.Get <ITranslationProvider>(); translationProvider.CurrentLanguage = "Fr"; StationRepository.Setup(x => x.PrintingLanguageSetting).Returns(2); StationRepository.Setup(x => x.DefaultDisplayLanguage).Returns("It"); rep.Init(); rep.UsePrinter = true; var PrinterHandler = new PrinterHandler(); var printer = PrinterHandler.InitPrinter(true); Assert.AreEqual("Fr", translationProvider.PrintingLanguage); }
public void askWindow_YesClick(object sender, EventArgs e) { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } DateTime startdate; DateTime enddate; Dictionary <decimal, int> cashinNotes; var amount = RegisterAndGetCashInfo(out startdate, out enddate, out cashinNotes); PrintBalancePleaseWait(cashinNotes, amount); UpdateCashSummary(); Mediator.SendMessage("", MsgTag.RefreshCashOperations); }
public void PleaseWaitPrintInfo() { PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage("info"); return; } var end = EndDate; if (end == DateTime.MinValue) { end = DateTime.Now; } Dictionary <Decimal, int> cashinNotes = GetNotesValuesAndCountFromCollection(CashOperations.ToList()); PrinterHandler.PrintCashBalance(cashinNotes, StartDate, end, CashInOperationsNum, CashOutOperationsNum, 0, false, true, "", 0); }
public void PrintBarcodeTest() { StationSettings settings = new StationSettings(); Kernel.Rebind <IStationSettings>().ToConstant(settings); settings.ReadPrefFileData(); var PrinterHandler = new PrinterHandler(); var printer = PrinterHandler.InitPrinter(true); TranslationProvider.Setup(x => x.TranslateForPrinter(It.IsAny <MultistringTag>())).Returns("123"); var str = "123456789012345"; for (int i = 15; i < 25; i++) { str = str + i.ToString(); PrinterHandler.WriteBarcodeCardNumber(str); } //Thread.Sleep(1000000); }
private void PrintReportForTerminal() { if (SelectedCheckpoint == null) { return; } PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { ShowPrinterErrorMessage(); return; } bool isPrinted = PrinterHandler.PrintChechpointForTerminal(SelectedCheckpoint.ProfitAccountingCheckpoint, ChangeTracker.CurrentUser.ShopPaymentsReadLocationOwner); if (!isPrinted) { ShowPrinterErrorMessage(); } }
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 void OnResetDBPleaseWait() { ThreadHelper.StopAll(); var serviceRuntimeUserCertificateStore = new X509Store(StoreName.My); serviceRuntimeUserCertificateStore.Open(OpenFlags.ReadWrite); for (int i = 0; i < serviceRuntimeUserCertificateStore.Certificates.Count;) { var certificate = serviceRuntimeUserCertificateStore.Certificates[i]; if (certificate.Subject.Contains("Sportradar AG")) { serviceRuntimeUserCertificateStore.Remove(certificate); continue; } i++; } PrinterHandler.DeleteAllPrinterObjects(); ConnectionManager.CloseAll(); DatabaseManager.DropDatabase(false); System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0"); }
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; }
private void YesOnClickCont() { if (Amount == "" || Amount == null) { return; } decimal amount = 0; bool result = decimal.TryParse(Amount, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo, out amount); if (!result) { ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NONDECIMAL_VALUE_ERROR_BODY).ToString(), null, false, 5); return; } string type = ChangeTracker.PaymentFlowOperationType; PaymentFlowData request = new PaymentFlowData(); if (type == "credit") { request.type = "CREDIT"; } else { request.type = "PAYMENT"; } //decimal tempAmount = 0; //Decimal.TryParse(Amount, NumberStyles.AllowDecimalPoint, NumberFormatInfo.InvariantInfo, out tempAmount); request.amount = amount; request.comment = Comment; request.stationNumber = StationRepository.StationNumber; if (ChangeTracker.CurrentUser is OperatorUser) { request.operatorName = ((OperatorUser)ChangeTracker.CurrentUser).Username; } else { request.operatorName = ""; } try { WsdlRepository.AddPaymentFlow(request); bool isPrinted = PrinterHandler.PrintShopPaymentReciept(ChangeTracker.PaymentFlowOperationType, amount, ChangeTracker.CurrentUser.AccountId, ChangeTracker.CurrentUser.Username); if (!isPrinted) { ShowPrinterErrorMessage(); } } catch (Exception ex) { ShowError(ex.Message); } MyRegionManager.NavigatBack(RegionNames.UsermanagementContentRegion); }
void messageWindow_YesClick(object sender, EventArgs e) { var amount = WithdrawBut ? (Cashpool - Amount) : Amount; PrinterHandler.InitPrinter(true); if (StationRepository.PrinterStatus == 0) { //Mediator.SendMessage<double>(0, MsgTag.PrinterNotReady); ShowPrinterErrorMessage(); return; } bool Valid = true; string errormessage = ""; string code = ""; try { DateTime expiration = DateTime.Now; bool money_withdraw = false; var uid = StationRepository.GetUid(ChangeTracker.CurrentUser); if (!(ChangeTracker.CurrentUser is LoggedInUser)) { uid = StationRepository.GetUid(new LoggedInUser(EditUserId.AccountId, "", 0, 0, 0, 0)); } string number; bool withdrawFrombalance; var amountRef = amount; code = WsdlRepository.RegisterPaymentNote(uid, ref amountRef, out expiration, out money_withdraw, out number, out withdrawFrombalance); if (string.IsNullOrEmpty(code)) { Valid = false; errormessage = TranslationProvider.Translate(MultistringTags.TERMINAL_CONNECTION_LOST_LOGGEDIN).ToString(); } } catch (FaultException <HubServiceException> ex) { Valid = false; errormessage = ex.Detail.message; } if (Valid) { PrinterHandler.PrintPaymentNote(amount, code, DateTime.Now); } else { ShowError(errormessage); } ChangeTracker.CurrentUser.Withdrawmoney(-amount); Amount = 0; OnPropertyChanged("CashpoolDescription"); Dispatcher.Invoke((Action)(() => { var window = (Window)GetActiveWindow(); if (window != null) { window.Focus(); } })); }
private void CreateCheckpoint() { OperatorShiftCheckpoint checkpoint = new OperatorShiftCheckpoint(); DateTime stDate; DateTime enDate; int ebTN; int pTN; decimal ebTA; decimal pTA; decimal tempBalance; string operatorName; if (CheckForEmptyBox()) { ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_PLEASE_EMPTY_BOX).ToString(), null, false); return; } try { OperatorShiftData data = WsdlRepository.CreateOperatorShiftCheckpoint(StationRepository.LocationID, Int16.Parse(StationRepository.GetUid(ChangeTracker.CurrentUser).account_id)); stDate = data.startDate; enDate = data.endDate; ebTA = data.emptyBoxTotalAmount; pTA = data.payoutTotalAmount; ebTN = data.emptyBoxTotalNumber; pTN = data.payoutTotalNumber; tempBalance = data.balance; operatorName = data.operatorName; } catch (Exception ex) { if (ex is System.ServiceModel.FaultException <HubServiceException> ) { System.ServiceModel.FaultException <HubServiceException> exep = (System.ServiceModel.FaultException <HubServiceException>)ex; ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NO_EMPTY_BOXES).ToString(), null, false); } return; } checkpoint.startDate = stDate; checkpoint.endDate = enDate; checkpoint.emptyBoxTotalAmount = ebTA; checkpoint.emptyBoxTotalNumber = ebTN; checkpoint.payoutTotalAmount = pTA; checkpoint.payoutTotalNumber = pTN; checkpoint.operatorName = operatorName; checkpoint.operatorId = (int)ChangeTracker.CurrentUser.AccountId; ObservableCollection <OperatorShiftCheckpoint> tempCollection = new ObservableCollection <OperatorShiftCheckpoint>(); globalCollection.Insert(0, checkpoint); if ((currentPosition + pageSize) < globalCollection.Count) { for (int i = currentPosition; i < pageSize; i++) { tempCollection.Add(globalCollection[i]); } } else { for (int i = currentPosition; i < globalCollection.Count; i++) { tempCollection.Add(globalCollection[i]); } } SelectedCheckpoint = tempCollection[0]; //recalculate balance //CalculateBalance(); _Checkpoints = new ObservableCollection <OperatorShiftCheckpoint>(tempCollection); EnabledPrintCheckpoint = _Checkpoints.Count > 0 && SelectedCheckpoint != null && SelectedCheckpoint.id != -1000; OnPropertyChanged("Checkpoints"); OnPropertyChanged("EnabledPrintCheckpoint"); Balance = tempBalance; OnPropertyChanged("Balance"); CurrentShiftReport(); //printout bool isPrinted = PrinterHandler.PrintOperatorShiftReport(checkpoint, tempBalance); if (!isPrinted) { ShowPrinterErrorMessage(); } ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_SHIFT_REPORT_CREATED).ToString() + "\n\n" + SelectedCheckpoint.startDate.ToString() + " - " + SelectedCheckpoint.endDate.ToString(), null, false, 15); }
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); }
void PleaseWaitmodel_YesClick(object sender, EventArgs e) { try { decimal amount = 0; bool withFrombalance; WsdlRepository.WithdrawByPaymentNote(PaymentNoteNumber, StationRepository.GetUid(ChangeTracker.CurrentUser), out amount, out withFrombalance); PrinterHandler.PrintPaymentRecept(PaymentNoteNumber, "", amount, false); ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_DONE) as string); PaymentNoteNumber = ""; } catch (FaultException <HubServiceException> error) { switch (error.Detail.code) { case 150: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.NOT_ENOUGHT_MONEY_TO_WITHDRAW).ToString()); break; case 179: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_NOTE_INVALIDLOCATION).ToString()); break; case 1791: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NOTE_INVALIDFRANCHISOR).ToString()); break; case 170: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENTNOTE_NOTFOUND).ToString()); break; case 171: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_NOTE_EXPIRED).ToString()); break; case 174: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_NOTE_PAID).ToString()); break; case 401: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.CREDIT_NOTE_ALREADY_EXISTS).ToString()); break; case 402: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_CREDIT_NOTE_NOT_ACTIVE).ToString()); break; case 403: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_CREDIT_NOTE_INVALID_AMOUNT).ToString()); break; case 404: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_PAID_CREDITNOTE).ToString()); break; case 405: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.CREDIT_NOTE_EXPIRED).ToString()); break; default: ErrorWindowService.ShowError(error.Detail.message); break; } } }
private void modelCreditNote_YesClickPleaseWait(object sender, EventArgs e, bool immediatelyPaid = false) { try { bool result = WsdlRepository.PayCreditNote(StationRepository.GetUid(ChangeTracker.CurrentUser), PaymentNoteNumber.Substring(0, PaymentNoteNumber.Length - 4), PaymentNoteNumber.Substring(PaymentNoteNumber.Length - 4), ChangeTracker.CurrentUser.AccountId.ToString(), StationRepository.StationNumber); if (!result) { ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.CANT_WITHDRAW_MONEY_FROM_PAID_CREDIT_NOTE) as string); } else { if (immediatelyPaid) { ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.REGISTER_PAYMENT_DONE, PaymentNoteNumber), null, false, 3); } else { PrinterHandler.PrintPaymentRecept(PaymentNoteNumber.Substring(0, PaymentNoteNumber.Length - 4), PaymentNoteNumber.Substring(PaymentNoteNumber.Length - 4), amount, true); ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_DONE) as string); } } PaymentNoteNumber = ""; } catch (FaultException <HubServiceException> error) { switch (error.Detail.code) { case 150: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.NOT_ENOUGHT_MONEY_TO_WITHDRAW).ToString()); break; case 179: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NOTE_INVALIDLOCATION).ToString()); break; case 1791: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NOTE_INVALIDFRANCHISOR).ToString()); break; case 404: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_PAID_CREDITNOTE).ToString()); break; case 170: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENTNOTE_NOTFOUND).ToString()); break; case 171: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_NOTE_EXPIRED).ToString()); break; case 174: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.PAYMENT_NOTE_PAID).ToString()); break; case 401: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.CREDIT_NOTE_ALREADY_EXISTS).ToString()); break; case 402: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_CREDIT_NOTE_NOT_ACTIVE).ToString()); break; case 403: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_CREDIT_NOTE_INVALID_AMOUNT).ToString()); break; case 405: ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.CREDIT_NOTE_EXPIRED).ToString()); break; default: ErrorWindowService.ShowError(error.Detail.message); break; } } }
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")); } }