예제 #1
0
        private void CreateCheckpoint()
        {
            WsdlRepository.CreateProfitAccountingCheckpoint(Int32.Parse(StationRepository.GetUid(ChangeTracker.CurrentUser).location_id.ToString()), StationRepository.StationNumber);

            var lastcheckpoint = _Checkpoints.FirstOrDefault(x => x.IsLastCheckpoint);



            var errorWindowSettings = new ErrorSettings();

            errorWindowSettings.ErrorLevel        = ErrorLevel.Critical;
            errorWindowSettings.HideButtons       = true;
            errorWindowSettings.WarningVisibility = Visibility.Collapsed;
            errorWindowSettings.TextAligment      = TextAlignment.Center;
            ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.SETTLEMENT_PROCESSING), errorWindowSettings);
            while (true)
            {
                Thread.Sleep(5000);
                OnLoadData();
                var newCheckpoint = _Checkpoints.FirstOrDefault(x => x.IsLastCheckpoint);
                if (newCheckpoint != null && lastcheckpoint == null)
                {
                    break;
                }
                if (lastcheckpoint != null && newCheckpoint != null && newCheckpoint.ProfitAccountingCheckpoint.general.endDate > lastcheckpoint.ProfitAccountingCheckpoint.general.endDate)
                {
                    break;
                }
            }
            ErrorWindowService.Close();

            SelectedCheckpoint = _Checkpoints.ElementAt(0);

            OnPropertyChanged("Checkpoints");
            TryUpdateLocationTotals();
        }
예제 #2
0
        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;
                }
            }
        }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
        private void OnLoadPaymentNote(string paymentNoteNumber)
        {
            Log.Debug("BARCODE: LoadPaymentNote(2)");
            Blur();
            PaymentNoteNumber = paymentNoteNumber;
            if (_paymentNoteChecked)
            {
                Log.Debug("Paymentnote number:" + PaymentNoteNumber);
            }
            else
            {
                Log.Debug("Credit number:" + PaymentNoteNumber);
            }
            try
            {
                if (_paymentNoteChecked)
                {
                    amount = 0;

                    if (StationRepository.IsImmediateWithdrawEnabled)
                    {
                        OnRegisterPaymentNote();
                    }
                    else
                    {
                        var userData = WsdlRepository.LoadPaymentNote(PaymentNoteNumber, StationRepository.GetUid(ChangeTracker.CurrentUser), out amount);
                        //var username = userData.fields.Where(x => x.name == "username").Select(x => x.value).FirstOrDefault();
                        var firstname      = "";
                        var lastname       = "";
                        var documentType   = "";
                        var documentNumber = "";


                        foreach (var formField in userData.fields)
                        {
                            if (formField.name == "firstname")
                            {
                                firstname = formField.value ?? "";
                            }
                            if (formField.name == "lastname")
                            {
                                lastname = formField.value ?? "";
                            }
                            if (formField.name == "document_type")
                            {
                                documentType = formField.value ?? "";
                            }
                            if (formField.name == "document_number")
                            {
                                documentNumber = formField.value ?? "";
                            }
                        }
                        var amountEuros = (int)amount;
                        int amountCents = (int)((amount - amountEuros) * 100);

                        var text = TranslationProvider.Translate(MultistringTags.PAY_PAYMENTNOTE, amount, StationRepository.Currency, firstname, lastname) + "\r\n";
                        text += TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_DOCUMENT_TYPE, TranslationProvider.Translate(MultistringTag.Assign(documentType, documentType)).ToString()) + "\r\n";
                        text += TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_DOCUMENT_NUMBER, documentNumber) + "\r\n";

                        var yesButtonText = TranslationProvider.Translate(MultistringTags.PAYMENT_DONE).ToString();
                        var noButtonText  = TranslationProvider.Translate(MultistringTags.SHOP_FORM_CANCEL).ToString();

                        QuestionWindowService.ShowMessage(text, yesButtonText, noButtonText, model_YesClick, model_NoClick);
                    }
                }
                else
                {
                    if (!StationRepository.AllowAnonymousBetting)
                    {
                        UnBlur();
                        ShowError(TranslationProvider.Translate(MultistringTags.ANONYMOUS_BETTING_IS_DISABLED_CREDITNOTE) as string);
                        return;
                    }
                    if (StationRepository.IsCreditNoteImmediatelyPaid)
                    {
                        OnRegisterCreditNote();
                    }
                    else
                    {
                        var creditNote =
                            WsdlRepository.LoadCreditNote(PaymentNoteNumber.Substring(0, PaymentNoteNumber.Length - 4),
                                                          PaymentNoteNumber.Substring(PaymentNoteNumber.Length - 4),
                                                          StationRepository.StationNumber);

                        amount      = creditNote.amount;
                        _expiryDate = creditNote.expireDate;
                        var    amountEuros = (int)creditNote.amount;
                        int    amountCents = (int)((creditNote.amount - amountEuros) * 100);
                        string text        = null;

                        var yesButtonText = TranslationProvider.Translate(MultistringTags.PAYMENT_DONE).ToString();
                        var noButtonText  = TranslationProvider.Translate(MultistringTags.SHOP_FORM_CANCEL).ToString();

                        if (_expiryDate < DateTime.Now && StationRepository.PayoutExpiredPaymentCreditNotes)
                        {
                            text =
                                string.Format(
                                    TranslationProvider.Translate(MultistringTags.PAY_EXPIRED_CREDITNOTE).ToString(),
                                    creditNote.amount, StationRepository.Currency);

                            QuestionWindowService.ShowMessage(text, null, null, modelCreditNote_YesClick, null,
                                                              warning: true);
                        }
                        else if (_expiryDate < DateTime.Now && !StationRepository.PayoutExpiredPaymentCreditNotes)
                        {
                            ErrorWindowService.ShowError(
                                TranslationProvider.Translate(MultistringTags.EXPIRED_CREDITNOTE).ToString());
                        }
                        else
                        {
                            text =
                                TranslationProvider.Translate(MultistringTags.PAY_CREDITNOTE,
                                                              creditNote.amount, StationRepository.Currency) + "\r\n";
                            QuestionWindowService.ShowMessage(text, yesButtonText, noButtonText,
                                                              modelCreditNote_YesClick, model_NoClick);
                        }
                    }
                }
            }
            catch (FaultException <HubServiceException> error)
            {
                switch (error.Detail.code)
                {
                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 179:
                    ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NOTE_INVALIDLOCATION).ToString());
                    break;

                case 1791:
                    ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NOTE_INVALIDFRANCHISOR).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;
                }
            }
            catch (Exception e)
            {
                Log.Error(e.Message, e);
            }
            UnBlur();
        }