public object Translate(string key)
        {
            var translatedValue = TranslationProvider?.Translate(key);

            if (translatedValue != null)
            {
                return(translatedValue);
            }

            return($"!{key}!");
        }
Example #2
0
        private void EditorMenuOnContextMenuOpening(object sender, ContextMenuEventArgs ea)
        {
            var contextMenu = new ContextMenu();

            SpellCheckSuggestions(contextMenu);

            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-undo"), Command = ApplicationCommands.Undo, InputGestureText = "Ctrl+Z"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-redo"), Command = ApplicationCommands.Redo, InputGestureText = "Ctrl+Y"
            });
            contextMenu.Items.Add(new Separator());
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-cut"), Command = ApplicationCommands.Cut, InputGestureText = "Ctrl+X"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-copy"), Command = ApplicationCommands.Copy, InputGestureText = "Ctrl+C"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-paste"), Command = ApplicationCommands.Paste, InputGestureText = "Ctrl+V"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-paste-special"), Command = PasteSpecialCommand, InputGestureText = "Ctrl+Shift+V", ToolTip = "Paste smart quotes and hypens as plain text"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-delete"), Command = ApplicationCommands.Delete, InputGestureText = "Delete"
            });
            contextMenu.Items.Add(new Separator());
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-select-all"), Command = ApplicationCommands.SelectAll, InputGestureText = "Ctrl+A"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-wrap-format"), Command = FormatCommand, InputGestureText = "Alt+F"
            });
            contextMenu.Items.Add(new MenuItem {
                Header = TranslationProvider.Translate("editor-menu-unwrap-format"), Command = UnformatCommand, InputGestureText = "Alt+Shift+F"
            });

            var element = (FrameworkElement)ea.Source;

            element.ContextMenu = contextMenu;
        }
        private void ShowPrinterErrorMessage(string type)
        {
            int    status       = PrinterHandler.currentStatus;
            string errorMessage = "";

            if (type == "info")
            {
                errorMessage = TranslationProvider.Translate(MultistringTags.ERROR_CANNOT_PRINT_INFO_NOTE).ToString() + ", ";
            }
            else
            {
                errorMessage = TranslationProvider.Translate(MultistringTags.ERROR_CANNOT_PRINT_BALANCE_NOTE).ToString() + ", ";
            }

            switch (status)
            {
            case 0:
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_PRINTER_ERROR_HEADER).ToString(), null, true);
                return;

            case 4:
                errorMessage += TranslationProvider.Translate(MultistringTags.ERROR_PRINTER_NO_PAPER).ToString();
                break;

            case 6:
                errorMessage += TranslationProvider.Translate(MultistringTags.ERROR_PRINTER_NO_TONER).ToString();
                break;

            case 7:
                errorMessage += TranslationProvider.Translate(MultistringTags.ERROR_PRINTER_OPEN).ToString();
                break;

            case 8:
                errorMessage += TranslationProvider.Translate(MultistringTags.ERROR_PRINTER_JAMMED).ToString();
                break;

            case 9:
                errorMessage += TranslationProvider.Translate(MultistringTags.ERROR_PRINTER_OFFLINE).ToString();
                break;
            }

            ShowError(errorMessage, null, true);
        }
        public void Work()
        {
            try {
                Init();

                while (!_end)
                {
                    _workHandle.WaitOne();
                    TranslationRequest req = null;
                    while (_workQueue.TryDequeue(out req))
                    {
                        _translationProvider.Translate(req);
                    }
                }
            }
            finally {
                End();
            }
        }
Example #5
0
        private IEnumerable <FoundOperator> ConvertUsers(Operator[] result)
        {
            var list = new List <Shared.Models.FoundOperator>();

            if (result != null)
            {
                foreach (var account in result)
                {
                    if (account.franchisor == StationRepository.FranchiserName)
                    {
                        var acc = new Shared.Models.FoundOperator();
                        acc.AccountId  = account.id;
                        acc.EMail      = account.email;
                        acc.Firstname  = account.name;
                        acc.Lastname   = account.surname;
                        acc.Username   = account.username;
                        acc.Active     = account.active;
                        acc.Role       = account.role;
                        acc.Location   = account.location;
                        acc.Franchisor = account.franchisor;
                        acc.ActiveCard = account.hasActiveCard ?? false;

                        if (acc.ActiveCard)
                        {
                            if (account.card_pin_enabled == 1)
                            {
                                acc.CardPin =
                                    TranslationProvider.Translate(MultistringTags.ENABLED_PIN).ToString();
                            }
                            else
                            {
                                acc.CardPin =
                                    TranslationProvider.Translate(MultistringTags.DISABLED_PIN).ToString();
                            }
                        }

                        list.Add(acc);
                    }
                }
            }
            return(list);
        }
        private void dispatcherTimerCoin_Tick(object sender, EventArgs e)
        {
            bool result = false;

            dispatcherTimerCoin.Stop();
            try
            {
                di_coin = CoinValidator.GetInventoryData();

                if (di_coin != null)
                {
                    if (di_coin.IsInitialized)
                    {
                        result = di_coin.IsInitialized;
                    }
                }
            }
            catch
            {
            }

            if (result == true)
            {
                IsCoinAcceptorFound = DeviceStatus.STATUS_OK;
                //CoinAcceptorStatus = "Coin Acceptor\r\n Status: OK";
                CoinAcceptorStatus = String.Format(
                    "{0}\r\n {1}",
                    TranslationProvider.Translate(MultistringTags.TERMINAL_VERIFICATION_COIN_ACCEPTOR),
                    TranslationProvider.Translate(MultistringTags.TERMINAL_VERIFICATION_STATUS_OK)
                    );
            }
            else
            {
                IsCoinAcceptorFound = DeviceStatus.STATUS_NOK;
                //CoinAcceptorStatus = "Coin Acceptor\r\n Status: Not Found!";
                CoinAcceptorStatus = String.Format(
                    "{0}\r\n {1}",
                    TranslationProvider.Translate(MultistringTags.TERMINAL_VERIFICATION_COIN_ACCEPTOR),
                    TranslationProvider.Translate(MultistringTags.TERMINAL_VERIFICATION_STATUS_NOT_FOUND)
                    );
            }
        }
        private void runTouchScreenAssignment()
        {
            string           twMonitorUrl     = ConfigurationManager.AppSettings["tw_monitor_path"];
            ProcessStartInfo twMonitorProcess = new ProcessStartInfo();

            twMonitorProcess.CreateNoWindow  = false;
            twMonitorProcess.UseShellExecute = false;
            twMonitorProcess.FileName        = twMonitorUrl;
            twMonitorProcess.WindowStyle     = ProcessWindowStyle.Hidden;

            try
            {
                twmProcess = Process.Start(twMonitorProcess);
            }
            catch
            {
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_CANNOT_RUN_ASSIGNMENT_TOOL).ToString(), ErrorOkClick);
            }


            string           url       = ConfigurationManager.AppSettings["touch_screen_assignment_tool_path"];
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.CreateNoWindow  = false;
            startInfo.UseShellExecute = false;
            startInfo.FileName        = url;
            startInfo.WindowStyle     = ProcessWindowStyle.Hidden;

            try
            {
                using (exeProcess = Process.Start(startInfo))
                {
                    ProcessName = exeProcess.ProcessName;
                    putWindowAsside();
                    exeProcess.WaitForExit();
                }
            }
            catch
            {
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_CANNOT_RUN_ASSIGNMENT_TOOL).ToString(), ErrorOkClick);
            }
        }
        public string this[string columnName]
        {
            get
            {
                if (string.IsNullOrEmpty(NewPassword))
                {
                    return(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_REQUIRED).ToString());
                }
                if (string.IsNullOrEmpty(OldPassword))
                {
                    return(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_REQUIRED).ToString());
                }
                if (OldPassword != NewPassword)
                {
                    return(TranslationProvider.Translate(MultistringTags.PASSWORDS_ARE_DIFFERENT).ToString());
                }

                return(string.Empty);
            }
        }
Example #9
0
        public ContainerViewModel(WasteContainer model, IAvvWasteTypeProvider avvWasteTypeProvider)
        {
            m_Model = model;
            m_Model.PropertyChanged              += ModelPropertyChanged;
            m_Model.MapPosition.PropertyChanged  += PositionChanged;
            m_Model.WasteTypes.CollectionChanged += WasteTypesOnCollectionChanged;
            DisplayName            = TranslationProvider.Translate("EditContainer");
            m_AvvWasteTypeProvider = avvWasteTypeProvider;
            SelectedAvvWasteTypes  = new ObservableCollection <AvvWasteType>();
            if (m_AvvWasteTypeProvider.AvvWasteTypes != null)
            {
                SetSelectedAvvWasteType();
            }
            else
            {
                m_AvvWasteTypeProvider.Loaded += (s, e) => SetSelectedAvvWasteType();
            }

            m_ContainerPosition = new MapItemViewModel(model.Name, new Point(model.MapPosition.XPosition, model.MapPosition.YPosition), false);
        }
Example #10
0
        public AddCreditPaymentViewModel()
        {
            string type = ChangeTracker.PaymentFlowOperationType;

            if (type == "credit")
            {
                Text       = TranslationProvider.Translate(MultistringTags.TERMINAL_ADD_CREDIT) as string;
                HeaderText = TranslationProvider.Translate(MultistringTags.TERMINAL_PLEASE_ADD_AMOUNT, (TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_CREDIT) as string));
            }
            else
            {
                Text       = TranslationProvider.Translate(MultistringTags.TERMINAL_ADD_PAYMENT) as string;
                HeaderText = TranslationProvider.Translate(MultistringTags.TERMINAL_PLEASE_ADD_AMOUNT, (TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_PAYMENT) as string));
            }

            YesCommand    = new Command(YesOnClick);
            CloseCommand  = new Command(OnClose);
            NoButtonText  = TranslationProvider.Translate(MultistringTags.TERMINAL_CANCEL) as string;
            YesButtonText = TranslationProvider.Translate(MultistringTags.TERMINAL_ADMIN_MENU_OK) as string;
        }
        private void InitializeZinsenPlot()
        {
            m_PlotModelZinsen = SetupPlotModel(TranslationProvider.Translate("TitlePlotModelZinsen"));
            var columnSeries = new ColumnSeries
            {
                StrokeThickness = 0,
                IsStacked       = false,
                LabelPlacement  = LabelPlacement.Base,
            };

            columnSeries.Items.Add(new ColumnItem(10, 0)); // Fester Zins für immer?
            columnSeries.Items.Add(new ColumnItem(InterneVerzinsung * 100, 1));
            m_PlotModelZinsen.Axes.Add(CreateValueAxis());
            m_PlotModelZinsen.Axes.Add(new CategoryAxis("", new string[]
            {
                "kalk.Zinssatz", "interne Verzinsung"
            }));

            m_PlotModelZinsen.Series.Add(columnSeries);
        }
        public void OnCloseBalance()
        {
            // BusinessPropsHelper.GetAccountingAmount(out _cashinCurrentAmount, out cashoutCurrentAmount);
            decimal billsAmount;
            int     billscount;
            decimal coinsamount;
            int     coinscount;
            decimal amount;

            amount = WsdlRepository.GetStationCashInfo(StationRepository.StationNumber, out billsAmount, out billscount, out coinsamount, out coinscount);
            if (amount > 0)
            {
                string text = TranslationProvider.Translate(MultistringTags.TERMINAL_COLLECT_CASH, amount, StationRepository.Currency);
                QuestionWindowService.ShowMessage(text, null, null, askWindow_YesClick, null);
            }
            else
            {
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NO_CASH), null, false, 3);
            }
        }
Example #13
0
        private void onProduceSettlementCommand()
        {
            if (SelectedOperator == null)
            {
                return;
            }

            bool result = WsdlRepository.CheckForEmptyBoxAndPayments(StationRepository.LocationID, SelectedOperator.id);

            if (!result)
            {
                ProduceSettlement(null, null);
            }
            else
            {
                var text = TranslationProvider.Translate(MultistringTags.TERMINAL_CONTINUE_WITH_SETTLEMENT, SelectedOperator.firstname, SelectedOperator.surname);

                QuestionWindowService.ShowMessage(text, null, null, ProduceSettlement, NotContinue);
            }
        }
Example #14
0
        public void AddProductionItem(object dataContext)
        {
            var productionItemAddViewModel = ((ProductionItemAddViewModel)dataContext);

            if (!productionItemAddViewModel.InspectionAttributes.Any())
            {
                var defaultInspectionAttribute = new InspectionAttribute
                {
                    Number      = "1",
                    Description = TranslationProvider.Translate("Other")
                };

                productionItemAddViewModel.InspectionAttributes.Add(defaultInspectionAttribute);
                m_Repository.InspectionAttributes.Add(defaultInspectionAttribute);
            }

            m_Repository.ProductionItems.Add(productionItemAddViewModel.Model);
            m_Repository.Save();
            CloseEditor();
        }
Example #15
0
        public MeasureAddViewModel(EnergyMeasure model, IEnumerable <ResponsibleSubjectViewModel> responsibleSubjectViewModels, [Import] IEnergyRepository energyRepository,
                                   [Import] IViewModelFactory viewModelFactory)
        {
            m_Model = model;
            if (m_Model.CreationDate == new DateTime())
            {
                m_Model.CreationDate = DateTime.Now;
                m_Model.DueDate      = DateTime.Now;
            }
            m_Priorities          = Enum.GetValues(typeof(Priority));
            m_ResponsibleSubjects = responsibleSubjectViewModels;
            DisplayName           = TranslationProvider.Translate("TitleMeasureAddViewModel");

            m_Repository       = energyRepository;
            m_ViewModelFactory = viewModelFactory;

            m_CalculatedConsumption = CurrentConsumption - m_Model.SavedWattShould;
            LoadSubMeasures();
            m_SubMeasureViewModels.CollectionChanged += SubMeasuresOnCollectionChanged;
        }
        private List <HistoryFile> GetHistoryFiles()
        {
            var historyFiles = new List <HistoryFile>();

            try
            {
                var records = WsdlRepository.GetStationCashHistory(StationRepository.StationNumber, _datLocal, _datLocal.AddDays(7));
                for (int i = records.Length - 1; i >= 0; i--)
                {
                    var record = records[i];
                    if (record.operation_type != "CASH_IN")
                    {
                        continue;
                    }
                    var historyFile = new HistoryFile();
                    historyFile.DateValue = record.created_at;
                    if (record.amount >= 1)
                    {
                        historyFile.CashValue = ((int)record.amount).ToString(CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        historyFile.CashValue = record.amount.ToString(CultureInfo.InvariantCulture);
                    }
                    historyFiles.Add(historyFile);
                }
            }
            catch (FaultException <HubServiceException> exception)
            {
                ShowError(exception.Detail.message);
            }

            if (historyFiles.Count == 0)
            {
                var rowX = new HistoryFile();
                rowX.CashDate  = TranslationProvider.Translate(MultistringTags.CASH_HISTORY_NOT_FOUND);
                rowX.CashValue = "";
                historyFiles.Add(rowX);
            }
            return(historyFiles);
        }
Example #17
0
        private void InitializeEmployeeChart()
        {
            var textForegroundColor = OxyColor.Parse(((Color)Application.Current.Resources["TextForegroundColor"]).ToString());
            var lightControlColor   = OxyColor.Parse(((Color)Application.Current.Resources["LightControlColor"]).ToString());

            m_EmployeeChartModel = new PlotModel
            {
                Title = TranslationProvider.Translate(Assembly.GetExecutingAssembly(), "employeeAnalysis"),
                PlotAreaBorderColor     = textForegroundColor,
                TextColor               = textForegroundColor,
                IsLegendVisible         = true,
                LegendOrientation       = LegendOrientation.Horizontal,
                LegendPlacement         = LegendPlacement.Outside,
                LegendPosition          = LegendPosition.BottomLeft,
                PlotAreaBorderThickness = new OxyThickness(1)
            };

            var valueAxis = new LinearAxis(AxisPosition.Left, 0)
            {
                ShowMinorTicks     = true,
                MinorGridlineStyle = LineStyle.Dot,
                MajorGridlineStyle = LineStyle.Dot,
                MajorGridlineColor = lightControlColor,
                MinorGridlineColor = lightControlColor,
                Title         = "kg CO₂",
                TicklineColor = textForegroundColor,
                IsZoomEnabled = false,
                IsPanEnabled  = false
            };

            m_EmployeeChartModel.Axes.Add(valueAxis);

            m_EmployeeCategoryAxis = new CategoryAxis
            {
                TicklineColor = textForegroundColor,
                IsZoomEnabled = false,
                IsPanEnabled  = false,
                MinorStep     = 1
            };
            m_EmployeeChartModel.Axes.Add(m_EmployeeCategoryAxis);
        }
Example #18
0
        public InspectionAddViewModel(Inspection model, CustomerViewModel customer, IEnumerable <ResponsibleSubjectViewModel> responsibleSubjectViewModels, IDiscardRepository repository)
        {
            m_Model      = model;
            m_Repository = repository;
            DisplayName  = TranslationProvider.Translate("TitleAddInspection");

            m_Customer            = customer;
            m_ProductionShift     = Enum.GetValues(typeof(Shift));
            m_InspectionShift     = Enum.GetValues(typeof(Shift));
            m_InspectionType      = Enum.GetValues(typeof(InspectionType));
            m_ResponsibleSubjects = responsibleSubjectViewModels;
            m_ProductionItems     = repository.ProductionItems;
            if (m_Model.ResponsibleSubject != null)
            {
                m_SelectedResponsibleSubject = m_ResponsibleSubjects.First(rs => rs.Model == m_Model.ResponsibleSubject);
            }


            if (m_Model.InspectionDate == new DateTime())
            {
                m_Model.InspectionDate = DateTime.Now;
            }
            if (m_Model.ProductionDate == new DateTime())
            {
                m_Model.ProductionDate = DateTime.Now;
            }


            if (m_Model.ProductionItem == null)
            {
                ProductionItem = FilteredProductionItems.First();
            }
            else
            {
                ProductionItem = m_ProductionItems.First(pi => pi == m_Model.ProductionItem);
            }


            NotifyOfPropertyChange(() => FilteredProductionItems);
            NotifyOfPropertyChange(() => ProductionItem);
        }
Example #19
0
        private void BlockCardOperator()
        {
            try
            {
                IdCardInfoItem[] idCards = WsdlRepository.GetIdCardInfo(ChangeTracker.FoundOperator.AccountId, Role.Operator);

                if (idCards != null)
                {
                    var idCard = idCards.Where(x => x.active == "1").FirstOrDefault();

                    if (idCard != null)
                    {
                        WsdlRepository.UpdateIdCard(idCard.number, "0", false, null);

                        ChangeTracker.FoundOperator.ActiveCard = false;
                        OnPropertyChanged("EnabledBlockIdCardOperator");
                        ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_DONE) as string);
                    }
                }
            }
            catch (System.ServiceModel.FaultException <HubServiceException> exception)
            {
                switch (exception.Detail.code)
                {
                case 169:
                    if (StationRepository.IsIdCardEnabled)
                    {
                        ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_CARD));
                    }
                    else
                    {
                        ShowError(TranslationProvider.Translate(MultistringTags.USER_DONT_HAVE_ACTIVE_BARCODECARD));
                    }
                    return;

                default:     // 113, 114, 172
                    ShowError(exception.Detail.message);
                    return;
                }
            }
        }
        private void InitializeCapitalPlot()
        {
            m_PlotModelCapital = SetupPlotModel(TranslationProvider.Translate("TitlePlotModelCapital"));
            var columnSeries = new ColumnSeries
            {
                StrokeThickness = 0,
                IsStacked       = false,
                LabelPlacement  = LabelPlacement.Base,
            };

            columnSeries.Items.Add(new ColumnItem(m_SelectedFinancialCalculation.KreditFürInvestition, 0));
            columnSeries.Items.Add(new ColumnItem(m_SelectedFinancialCalculation.Kapitalwert, 1));

            m_PlotModelCapital.Axes.Add(new CategoryAxis("", new string[]
            {
                "Investition", "Kapitalwert"
            }));
            m_PlotModelCapital.Axes.Add(CreateValueAxis());

            m_PlotModelCapital.Series.Add(columnSeries);
        }
        protected List <string> ValidateFields()
        {
            List <string> validationResults = new List <string>();
            bool          result            = true;

            NewPin.Error = null;
            if (this.NewPin.Value.Length != 4)
            {
                result            = false;
                this.NewPin.Error = TranslationProvider.Translate(MultistringTags.TERMINAL_PIN_4_SYMBOLS) as string;
                validationResults.Add(TranslationProvider.Translate(MultistringTags.TERMINAL_PIN_4_SYMBOLS));
            }
            if (NewPin.Value != NewPinConfirmed.Value && !String.IsNullOrEmpty(NewPinConfirmed.Value))
            {
                NewPin.Error          = TranslationProvider.Translate(MultistringTags.PASSWORDS_ARE_DIFFERENT);
                NewPinConfirmed.Error = TranslationProvider.Translate(MultistringTags.PASSWORDS_ARE_DIFFERENT);
                validationResults.Add(TranslationProvider.Translate(MultistringTags.PASSWORDS_ARE_DIFFERENT));
            }
            IsEnabledSave = validationResults.Count == 0 && NewPin.Value == NewPinConfirmed.Value;
            return(validationResults);
        }
Example #22
0
        public UserProfileMenuViewModel()
        {
            ShowAccountHistoryCommand = new Command(OnShowHistory);
            ShowUserProfileCommand    = new Command(OnShowProfile);
            ShowChangePasswordCommand = new Command(OnChangePassword);
            ShowDepositMoneyCommand   = new Command(OnShowDepositMoney);
            ShowCashMoneyCommand      = new Command(OnShowCashMoney);
            ShowTicketsCommand        = new Command(OnTickets);
            ShowBalanceCommand        = new Command(OnBalance);
            LogoutCommand             = new Command(OnLogout);

            ChangeTracker.HeaderVisible       = false;
            ChangeTracker.FooterArrowsVisible = false;

            var user = ChangeTracker.CurrentUser as LoggedInUser;

            if (user != null)
            {
                Hello_string = TranslationProvider.Translate(MultistringTags.HELLO_MSG, user.Username);
            }
        }
 public void setOperationTypes()
 {
     if (OperationType == null)
     {
         OperationType = new List <OperationTypeSelection>();
     }
     else
     {
         OperationType.Clear();
     }
     OperationType.Add(new OperationTypeSelection()
     {
         Index = 0, Value = TranslationProvider.Translate(MultistringTags.TERMINAL_CAHSIN).ToString(), OperationType = "TERMINAL_CASHIN", CashIn = true, CashOut = false
     });
     OperationType.Add(new OperationTypeSelection()
     {
         Index = 1, Value = TranslationProvider.Translate(MultistringTags.TERMINAL_CASHOUT).ToString(), OperationType = "TERMINAL_CASHOUT", CashIn = false, CashOut = true
     });
     OperationType.Add(new OperationTypeSelection()
     {
         Index = 2, Value = TranslationProvider.Translate(MultistringTags.TERMINAL_ALL).ToString(), OperationType = "TERMINAL_ALL", CashIn = true, CashOut = true
     });
     if (PayIn && !PayOut)
     {
         SelectedOperationTypeIndex = 0;
     }
     if (!PayIn && PayOut)
     {
         SelectedOperationTypeIndex = 1;
     }
     if (PayIn && PayOut)
     {
         SelectedOperationTypeIndex = 2;
     }
     if (!PayIn && !PayOut)
     {
         SelectedOperationTypeIndex = 2;
     }
     OnPropertyChanged("SelectedOperationTypeIndex");
 }
Example #24
0
        public void CreateRoomList(IEnumerable <RoomViewModel> rooms)
        {
            var rlvm = new RoomListViewModel
            {
                Rooms = rooms
            };

            var html = CreateRoomListHtml(rlvm);

            ObjectConfig oc = new ObjectConfig();

            oc.SetPrintBackground(true);
            oc.SetAllowLocalContent(true);
            oc.SetScreenMediaType(true);
            oc.SetLoadImages(true);
            oc.Footer.SetFontSize(8);
            oc.Footer.SetRightText("Erstellt: " + DateTime.Now);

            var pdfBuf = new SynchronizedPechkin(new GlobalConfig()).Convert(oc, html);

            var _SD = new SaveFileDialog
            {
                Filter   = "PDF File (*.pdf)|*.pdf",
                FileName = TranslationProvider.Translate("RoomList"),
                Title    = TranslationProvider.Translate("SaveAs")
            };

            if (_SD.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    File.WriteAllBytes(_SD.FileName, pdfBuf);
                    Process.Start(_SD.FileName);
                }
                catch (IOException e)
                {
                    MessageBox.Show(TranslationProvider.Translate("CantWriteFile"));
                }
            }
        }
        private void BlockClick(object sender, EventArgs ev)
        {
            try
            {
                var cards = WsdlRepository.GetIdCardInfo(EditUser.AccountId, Role.User);

                var  result = "";
                bool isDone = true;
                if (cards != null)
                {
                    foreach (var card in cards.Where(x => x.active == "1"))
                    {
                        result = WsdlRepository.UpdateIdCard(card.number, "1", false, null);
                        if (result != null && Boolean.Parse(result))
                        {
                            isDone = Boolean.Parse(result) && isDone;
                        }
                    }
                }
                if (isDone)
                {
                    EditUser.HasCard = 0;
                    QuestionWindowService.ShowMessage(TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_DONE).ToString(), null, null, null, null, false);
                }
            }
            catch (FaultException <HubServiceException> exception)
            {
                ShowError(exception.Detail.message);
            }
            catch (Exception e)
            {
                Log.Error(e.Message, e);
            }

            OnPropertyChanged("IsCardButtonsActive");
            OnPropertyChanged("BlockCardButtonsActive");
            OnPropertyChanged("IsEnabledBindCard");
            OnPropertyChanged("ActiveCardText");
            OnPropertyChanged("EditUser");
        }
Example #26
0
        public void Accept(object dataContext)
        {
            CloseEditor();

            var pievm = ((ProductionItemEditViewModel)dataContext).Model;

            if (!pievm.InspectionAttributes.Any())
            {
                var defaultInspectionAttribute = new InspectionAttribute
                {
                    Number      = "1",
                    Description = TranslationProvider.Translate("Other")
                };

                pievm.InspectionAttributes.Add(defaultInspectionAttribute);
                m_Repository.InspectionAttributes.Add(defaultInspectionAttribute);
            }

            m_Repository.Save();

            NotifyOfPropertyChange(() => FilteredProductionItems);
        }
        private void OnEnablePin()
        {
            var text = ChangeTracker.CurrentUser.PinEnabled
                                         ? TranslationProvider.Translate(
                MultistringTags.TERMINAL_FORM_PIN_WILL_BE_DISABLED) as string
                                         : TranslationProvider.Translate(
                MultistringTags.TERMINAL_FORM_PIN_WILL_BE_ENABLED) as string;

            if (StationRepository.IsIdCardEnabled)
            {
                text = ChangeTracker.CurrentUser.PinEnabled
                                         ? TranslationProvider.Translate(
                    MultistringTags.TERMINAL_FORM_BARCODE_PIN_WILL_BE_DISABLED) as string
                                         : TranslationProvider.Translate(
                    MultistringTags.TERMINAL_FORM_BARCODE_PIN_WILL_BE_ENABLED) as string;
            }

            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, onEnablePinYesClicked, null);
        }
Example #28
0
        private void OnBindCard()
        {
            try
            {
                Blur();
                var cards = WsdlRepository.GetIdCardInfo((int)ChangeTracker.CurrentUser.AccountId, Role.Operator);

                UnBlur();
                if (cards != null && cards.Any(card => card.active == "1"))
                {
                    var text = TranslationProvider.Translate(MultistringTags.USER_HAVE_ACTIVE_CARD_IT_WILL_BE_BLOCKED).ToString();
                    QuestionWindowService.ShowMessage(text, null, null, model_YesClick, null);
                }
                else
                {
                    Mediator.SendMessage <long>(ChangeTracker.CurrentUser.AccountId, MsgTag.BindOperatorCard);
                    OnPropertyChanged("IsCardButtonsActive");
                    OnPropertyChanged("BlockCardButtonsActive");
                }
            }
            catch (FaultException <HubServiceException> error)
            {
                UnBlur();
                if (error.Detail.code == 169)
                {
                    Mediator.SendMessage <long>(ChangeTracker.CurrentUser.AccountId, MsgTag.BindOperatorCard);
                    OnPropertyChanged("IsCardButtonsActive");
                    OnPropertyChanged("BlockCardButtonsActive");
                }
                else
                {
                    ShowError(error.Reason.Translations.Where(x => x.XmlLang.ToLowerInvariant() == SelectedLanguage.ToLowerInvariant()).Select(x => x.Text).FirstOrDefault());
                }
            }


            //Mediator.SendMessage<long>(ChangeTracker.CurrentUser.AccountId, MsgTag.BindOperatorCard);
        }
Example #29
0
        private void ShowStream(IMatchVw match)
        {
            if (FirstStart)
            {
                //https://lbc.betradar.com/screen/#/terminal/76/4900522/656
                StreamWebAddress     = "https://lbc.betradar.com/";
                WebBrowserVisibility = Visibility.Visible;
                FirstStart           = false;
                return;
            }

            //add timers logic
            SelectedMatch = match;

            if (DateTime.Now < SelectedMatch.LastPlayedStreamAt.AddSeconds(ChangeTracker.VideoWarningBefore))
            {
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_STREAM_BLOCKED).ToString());
                return;
            }

            SelectedMatch.LastPlayedStreamAt = DateTime.Now;

            WebBrowserVisibility = Visibility.Visible;

            StopTimer();

            bool res = DeleteUrlCacheEntry("https://lbc.betradar.com/screen/jwplayer.flash.swf");

            StreamWebAddress = "https://lbc.betradar.com/screen/#/terminal/76/" + SelectedMatch.LineObject.BtrMatchId.ToString() + "/" + SelectedMatch.StreamID.ToString();

            Random random       = new Random();
            int    randomNumber = (random.Next(ChangeTracker.VideoTimePeriodMin, ChangeTracker.VideoTimePeriodMax) - ChangeTracker.VideoWarningBefore) * 1000;

            StreamTimer          = new System.Timers.Timer();
            StreamTimer.Interval = randomNumber;
            StreamTimer.Elapsed += NotifyUserOfStreamEnding;
            StreamTimer.Start();
        }
        public UserHistoryViewModel()
        {
            StartPage   = 1;
            GoCommand   = new Command(OnGoClick);
            ItemCreated = new Command <UIElement>(OnRowItemCreated);
            GridCreated = new Command <UIElement>(OnGridCreated);
            this.SelectStartDateCommand = new Command(OnSelectStartDateExecute);
            this.SelectEndDateCommand   = new Command(OnSelectEndDateExecute);
            Mediator.Register <long>(this, UpdateHistory, MsgTag.UpdateHistory);

            operations = new ObservableCollection <ComboBoxItem>();
            operations.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.BALANCE_OPERATIONS).ToString(), 2));
            operations.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.PROFILE_OPERATIONS).ToString(), 1));
            //operations.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.TICKET_OPERATIONS).ToString(), 3));
            operations.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.ALL_OPERATIONS).ToString(), 0));

            dateFilters = new ObservableCollection <ComboBoxItem>();
            dateFilters.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.Last_Week).ToString(), 0));
            dateFilters.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.Current_Month).ToString(), 1));
            dateFilters.Add(
                new ComboBoxItem(TranslationProvider.Translate(MultistringTags.Previous_and_Current_Month).ToString(), 2));
            dateFilters.Add(new ComboBoxItem(TranslationProvider.Translate(MultistringTags.Custom_data_filter).ToString(), 3));
            _selectedGroup = operations[0];
            UpdateHistoryRecordTypes();
            _selectedDateFilterIndex = 0;
            startDate = DateTime.Now.AddDays(-7);
            endDate   = null;

            PreviousPage      = new Command(OnPreviousPage);
            FirstPage         = new Command(OnFirstPage);
            NextPage          = new Command(OnNextPage);
            LastPage          = new Command(OnLastPage);
            HideWindowCommand = new Command(HideWindow);
            _currentPageIndex = 1;

            _selectedHistoryRecordTypeIndex = 0;
            IsBackVisible = ChangeTracker.CurrentUser is OperatorUser;
        }
        internal WizardStepItem(TranslationProvider Provider, string name, string Parent)
        {
            Step = (WizardSteps)Enum.Parse(typeof(WizardSteps), name);
            string trName = "!" + name;
            TranslatedName = Provider.Translate(trName, Parent);
            TranslatedDescription = Provider.Translate(trName + "_Description", Parent);

            if (TranslatedName == null)
                TranslatedName = "!!Missing: " + trName;
            if (TranslatedDescription == null)
                TranslatedDescription = "!!Missing: " + trName + "_Description";
        }