Exemple #1
0
        private void ClearModules()
        {
            _cp  = null;
            _ttp = null;
            _administrationPage    = null;
            _timeControlPage       = null;
            _serviceEquipmentPage  = null;
            _taskPage              = null;
            _technologyProblemPage = null;
            _stimulationPage       = null;
            _prodRoomsPage         = null;
            _workshopMapPage       = null;
            _staffPage             = null;
            _workerRequestsPage    = null;
            _plannedWorksPage      = null;


            //while (MainFrame.NavigationService.b)
            //{
            //    MainFrame.NavigationService.RemoveBackEntry();
            //}

            while (MainFrame.CanGoBack)
            {
                MainFrame.RemoveBackEntry();
            }
        }
Exemple #2
0
        private void LoadPageById(int moduleId)
        {
            switch (moduleId)
            {
            case (int)AdministrationClass.Modules.OperationCatalog:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is CatalogPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.OperationCatalog);
                    if (_cp == null)
                    {
                        _cp = new CatalogPage(hasFullAccess);
                    }
                    _cp.Tag = moduleId;
                    MainFrame.Navigate(_cp);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.Workers:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is StaffPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.Workers);
                    if (_staffPage == null)
                    {
                        _staffPage = new StaffPage(hasFullAccess);
                    }
                    _staffPage.Tag = moduleId;
                    MainFrame.Navigate(_staffPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.TimeTracking:
            {
                if (_ttc.GetIsDayEnd(AdministrationClass.CurrentWorkerId))
                {
                    //MenuTogleButton.IsChecked = false;

                    //MessageBox.Show("Для запуска данного модуля необходимо начать рабочий день!", "Информация",
                    //    MessageBoxButton.OK, MessageBoxImage.Information);
                    //break;


                    BlinkWorkingDayButton();
                }
                else
                {
                    if (!MainFrame.HasContent || !(MainFrame.Content is TimeTrackingPage))
                    {
                        if (_ttp == null)
                        {
                            _ttp = new TimeTrackingPage();
                        }
                        _ttp.Tag = moduleId;
                        MainFrame.Navigate(_ttp);
                        ShowWaitAnimation();
                    }
                }
                MinimazeMenu();
            }
            break;

            case (int)AdministrationClass.Modules.Administration:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is AdministrationPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.Administration);
                    if (_administrationPage == null)
                    {
                        _administrationPage = new AdministrationPage(hasFullAccess);
                    }
                    _administrationPage.Tag = moduleId;
                    MainFrame.Navigate(_administrationPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.ControlTimeTracking:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is TimeControlPage))
                {
                    if (_timeControlPage == null)
                    {
                        _timeControlPage = new TimeControlPage();
                    }
                    _timeControlPage.Tag = moduleId;
                    MainFrame.Navigate(_timeControlPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.ServiceEquipment:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is ServiceEquipmentPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.ServiceEquipment);
                    if (_serviceEquipmentPage == null)
                    {
                        _serviceEquipmentPage = new ServiceEquipmentPage(hasFullAccess);
                    }
                    _serviceEquipmentPage.Tag = moduleId;
                    MainFrame.Navigate(_serviceEquipmentPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.TasksPage:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is TaskPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.TasksPage);
                    if (_taskPage == null)
                    {
                        _taskPage = new TaskPage(hasFullAccess);
                    }
                    _taskPage.Tag = moduleId;
                    MainFrame.Navigate(_taskPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.TechnologyProblem:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is TechnologyProblemPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.TechnologyProblem);
                    if (_technologyProblemPage == null)
                    {
                        _technologyProblemPage = new TechnologyProblemPage(hasFullAccess);
                    }
                    _technologyProblemPage.Tag = moduleId;
                    MainFrame.Navigate(_technologyProblemPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.WorkersStimulation:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is StimulationPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.WorkersStimulation);
                    if (_stimulationPage == null)
                    {
                        _stimulationPage = new StimulationPage(hasFullAccess);
                    }
                    _stimulationPage.Tag = moduleId;
                    MainFrame.Navigate(_stimulationPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.ProductionRooms:
            {
                if (!MainFrame.HasContent || !(MainFrame.Content is ProdRoomsPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.ProductionRooms);
                    if (_prodRoomsPage == null)
                    {
                        _prodRoomsPage = new ProdRoomsPage(hasFullAccess);
                    }
                    _prodRoomsPage.Tag = moduleId;
                    MainFrame.Navigate(_prodRoomsPage);
                    ShowWaitAnimation();
                }

                MinimazeMenu();
            }
            break;

            case (int)AdministrationClass.Modules.WorkshopMap:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is WorkshopMapPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.WorkshopMap);
                    if (_workshopMapPage == null)
                    {
                        _workshopMapPage = new WorkshopMapPage(hasFullAccess);
                    }
                    _workshopMapPage.Tag = moduleId;
                    MainFrame.Navigate(_workshopMapPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.WorkerRequests:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is WorkerRequestsPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.WorkerRequests);
                    if (_workerRequestsPage == null)
                    {
                        _workerRequestsPage = new WorkerRequestsPage(hasFullAccess);
                    }
                    _workerRequestsPage.Tag = moduleId;
                    MainFrame.Navigate(_workerRequestsPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.TimeSheet:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is TimesheetPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.TimeSheet);
                    if (_timeSheetPage == null)
                    {
                        _timeSheetPage = new TimesheetPage();
                    }
                    _timeSheetPage.Tag = moduleId;
                    MainFrame.Navigate(_timeSheetPage);
                    ShowWaitAnimation();
                }
            }
            break;

            case (int)AdministrationClass.Modules.PlannedWorks:
            {
                MinimazeMenu();

                if (!MainFrame.HasContent || !(MainFrame.Content is PlannedWorksPage))
                {
                    var hasFullAccess =
                        AdministrationClass.HasFullAccess(AdministrationClass.Modules.PlannedWorks);
                    if (_plannedWorksPage == null)
                    {
                        _plannedWorksPage = new PlannedWorksPage(hasFullAccess);
                    }
                    _plannedWorksPage.Tag = moduleId;
                    MainFrame.Navigate(_plannedWorksPage);
                    ShowWaitAnimation();
                }
            }
            break;
            }
        }