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;
                }
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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 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 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 OnDefinedPIN(object sender, EventArgs e)
 {
     // MyRegionManager.CloseAllViewsInRegion(RegionNames.UserProfileContentRegion);
     PrinterHandler.InitPrinter(true);
     if (StationRepository.PrinterStatus == 0)
     {
         ShowPrinterErrorMessage();
         return;
     }
     MyRegionManager.NavigateUsingViewModel <PinInsertingViewModel>(RegionNames.UsermanagementContentRegion);
 }
 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());
     }
 }
        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 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);
        }
        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);
        }
Beispiel #13
0
        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);
        }
        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;
        }
Beispiel #16
0
        private void ProduceSettlement(object sender, EventArgs e)
        {
            if (SelectedOperator == null)
            {
                return;
            }

            //produce settlement and reload page
            PrinterHandler.InitPrinter(true);
            if (StationRepository.PrinterStatus == 0)
            {
                ShowPrinterErrorMessage();
                return;
            }

            int      operatorID   = SelectedOperator.id; //should be selected operator ID
            string   opName       = "";
            string   opLName      = "";
            string   frName       = "";
            string   locName      = "";
            string   locOwnerName = "";
            DateTime stDate;
            DateTime enDate;

            CheckpointSlip[]       cpArray;
            TotalSettlementSection totSection = new TotalSettlementSection();

            ProduceOperatorSettlementResponse opSett = new ProduceOperatorSettlementResponse();

            try
            {
                WsdlRepository.ProduceOperatorSettlement(ref operatorID, (int)ChangeTracker.CurrentUser.AccountId, out opName, out opLName, out frName, out locName, out locOwnerName, out stDate, out enDate, out cpArray, out totSection);
                opSett.checkpoints               = cpArray;
                opSett.currentDate               = DateTime.Now;
                opSett.franchisorName            = frName;
                opSett.locationName              = locName;
                opSett.operatorFirstName         = opName;
                opSett.operatorLastName          = opLName;
                opSett.settlementPeriodEndDate   = enDate;
                opSett.settlementPeriodStartDate = stDate;
                opSett.total             = totSection;
                opSett.operatorId        = operatorID;
                opSett.LocationOwnerName = locOwnerName;
            }
            catch (System.ServiceModel.FaultException <HubServiceException> ex)
            {
                System.ServiceModel.FaultException <HubServiceException> exep = (System.ServiceModel.FaultException <HubServiceException>)ex;
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_SETTLEMENT_NO_SHIFTS).ToString(), onLoadData, false);
                return;
            }
            WaitOverlayProvider.ShowWaitOverlay();

            //print
            if (opSett.checkpoints != null)
            {
                bool isPrinted = PrinterHandler.PrintOperatorSettlementResponce(opSett);
                if (!isPrinted)
                {
                    ShowPrinterErrorMessage();
                }

                isPrinted = PrinterHandler.PrintOperatorSettlementResponce(opSett);
                if (!isPrinted)
                {
                    ShowPrinterErrorMessage();
                }
            }
            onLoadData(null, null);
        }
        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();
                }
            }));
        }