예제 #1
0
        public DirectoryWorkerListViewModel() : base()
        {
            var firstWorkingArea = Screen.AllScreens[0].WorkingArea;

            MaxHeightForm = firstWorkingArea.Height - 100;
            var directoryWorkers = new List <DirectoryWorker>();

            var workers          = BC.GetDirectoryWorkers().ToList();
            var workerWarehouses = workers.Where(w => !w.IsDeadSpirit && BC.GetDirectoryTypeOfPost(w.Id, DateTime.Now).Name == "Склад").ToList();

            directoryWorkers.AddRange(workerWarehouses);

            if (Privileges.HasAccess(UserPrivileges.WorkersVisibility_DeadSpirit))
            {
                var workerDeadSpirits = workers.Where(w => w.IsDeadSpirit).ToList();

                directoryWorkers.AddRange(workerDeadSpirits);
            }

            if (Privileges.HasAccess(UserPrivileges.WorkersVisibility_Office))
            {
                var workerOffices = workers.Where(w => !w.IsDeadSpirit && BC.GetDirectoryTypeOfPost(w.Id, DateTime.Now).Name == "Офис").ToList();

                directoryWorkers.AddRange(workerOffices);
            }

            DirectoryWorkers = new ObservableCollection <DirectoryWorker>(directoryWorkers.OrderBy(w => w.Status));

            ShowDirectoryEditWorkerCommand = new RelayCommand(ShowDirectoryEditWorker);
        }
예제 #2
0
 private void InitializePrivileges()
 {
     DayCosts.Visibility     = Privileges.HasAccess(UserPrivileges.MenuVisibility_Costs_DayCosts) ? Visibility.Visible : Visibility.Collapsed;
     MonthCosts.Visibility   = Privileges.HasAccess(UserPrivileges.MenuVisibility_Costs_MonthCosts) ? Visibility.Visible : Visibility.Collapsed;
     DefaultCosts.Visibility = Privileges.HasAccess(UserPrivileges.MenuVisibility_Costs_DefaultCosts) ? Visibility.Visible : Visibility.Collapsed;
     Safe.Visibility         = Privileges.HasAccess(UserPrivileges.MenuVisibility_Costs_Safe) ? Visibility.Visible : Visibility.Collapsed;
 }
예제 #3
0
        public DayCostsView(DateTime date)
        {
            InitializeComponent();

            _isNotTransportOnly = Privileges.HasAccess(UserPrivileges.CostsVisibility_IsNotTransportOnly);

            FillDataGrid(date);
        }
예제 #4
0
        private void InitializePrivileges()
        {
            bool isVisibilityAll   = Privileges.HasAccess(UserPrivileges.BudgetTabVisibility_All);
            bool isVisibilityLoans = Privileges.HasAccess(UserPrivileges.BudgetTabVisibility_Loans);

            BudgetTabVisibilityAll   = isVisibilityAll ? Visibility.Visible : Visibility.Collapsed;
            BudgetTabVisibilityLoans = isVisibilityLoans ? Visibility.Visible : Visibility.Collapsed;
        }
예제 #5
0
 private void InitializePrivileges()
 {
     ReportSalaryPrint.Visibility     = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportSalaryPrint) ? Visibility.Visible : Visibility.Collapsed;
     ReportSalaryMinsk.Visibility     = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportSalaryMinsk) ? Visibility.Visible : Visibility.Collapsed;
     ReportPam16Percentage.Visibility = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportPam16Percentage) ? Visibility.Visible : Visibility.Collapsed;
     ReportCosts.Visibility           = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportCosts) ? Visibility.Visible : Visibility.Collapsed;
     ReportCash.Visibility            = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportCash) ? Visibility.Visible : Visibility.Collapsed;
     ReportCars.Visibility            = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportCars) ? Visibility.Visible : Visibility.Collapsed;
     ReportProfit.Visibility          = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportProfit) ? Visibility.Visible : Visibility.Collapsed;
     ReportDiffSumToMinsk.Visibility  = Privileges.HasAccess(UserPrivileges.MenuVisibility_Reports_ReportDiffSumToMinsk) ? Visibility.Visible : Visibility.Collapsed;
 }
예제 #6
0
        public DirectoryWorkerBaseViewModel()
            : base()
        {
            IsAdminSalary          = Privileges.HasAccess(UserPrivileges.Salary_AdminSalary);
            IsDeadSpiritVisibility = Privileges.HasAccess(UserPrivileges.WorkersVisibility_DeadSpirit);

            AddCompanyAndPostCommand    = new RelayCommand(AddCompanyAndPost);
            EditCompanyAndPostCommand   = new RelayCommand(EditCompanyAndPost, IsSelectedCompanyAndPost);
            RemoveCompanyAndPostCommand = new RelayCommand(RemoveCompanyAndPost, IsSelectedCompanyAndPost);
            AddPhotoCommand             = new RelayCommand(AddPhoto);
            RemovePhotoCommand          = new RelayCommand(RemovePhoto);

            SelectedIndexCurrentCompanyAndPost = -1;
        }
예제 #7
0
        public AddEditDayCost(DateTime date, int?infoCostId = null)
        {
            InitializeComponent();

            _isNotTransportOnly = Privileges.HasAccess(UserPrivileges.CostsVisibility_IsNotTransportOnly);

            DatePickerDate.SelectedDate = date;

            _isEdit = infoCostId != null;
            if (_isEdit)
            {
                _infoCost = _bc.GetInfoCost(infoCostId.Value);

                ButtonAdd.Content = "Редактировать";
                WindowCosts.Title = "Редактирование";
                InitializeEditableData();
            }
            else
            {
                ButtonAdd.Content = "Добавить";
                WindowCosts.Title = "Добавление";

                InitializeData();

                if (!_isNotTransportOnly)
                {
                    RadioButtonExpense.IsChecked  = true;
                    RadioButtonExpense.IsEnabled  = false;
                    RadioButtonIncoming.IsEnabled = false;

                    ComboBoxCostItems.SelectedItem = _bc.GetDirectoryCostItem("Транспорт (5031)");

                    ComboBoxValidation(ComboBoxCostItems);
                    ComboBoxValidation(ComboBoxTransportCompanies);
                }
            }


            ComboBoxRCs_1.Resources.Add(SystemColors.HighlightBrushKey, Brushes.Red);

            InitializeValidation(GridCosts.Children);
            ChangeButtonAddVisibility(null);
        }
예제 #8
0
        public DirectoryEditWorkerViewModel(int workerId)
            : base()
        {
            _selectedDirectoryWorker = BC.GetDirectoryWorker(workerId);

            IsFireWorkerEnable = Privileges.HasAccess(UserPrivileges.Workers_FireWorkers);

            if (!IsNotFireDate)
            {
                VisibilityBringAlive = Visibility.Visible;
                IsFireWorkerEnable   = false;
            }
            else
            {
                VisibilityBringAlive = Visibility.Collapsed;
            }

            EditWorkerCommand = new RelayCommand(EditWorker, CanEditingWorker);
            FireWorkerCommand = new RelayCommand(FireWorker, CanEditingWorker);
            BringAliveCommand = new RelayCommand(BringAlive);

            FillInputData();
        }
예제 #9
0
        private void InitializeChoiseProjects()
        {
            MonthTimeSheetCommand        = new RelayCommand(MonthTimeSheet);
            RemainsCommand               = new RelayCommand(Remains);
            ProcessingBookKeepingCommand = new RelayCommand(ProcessingBookKeeping);
            RemainsLoanCommand           = new RelayCommand(RemainsLoan);
            WarehouseCommand             = new RelayCommand(Warehouse);
            CostsCommand            = new RelayCommand(Costs);
            ReportsCommand          = new RelayCommand(Reports);
            AdminCommand            = new RelayCommand(Admin);
            ChangeUserCommand       = new RelayCommand(ChangeUser);
            CalculateRemainsCommand = new RelayCommand(CalculateRemains);

            MonthTimeSheetVisibility        = Privileges.HasAccess(UserPrivileges.MultyProject_MonthTimeSheetVisibility) ? Visibility.Visible : Visibility.Collapsed;
            DbFenoxVisibility               = Privileges.HasAccess(UserPrivileges.MultyProject_DbFenoxVisibility) ? Visibility.Visible : Visibility.Collapsed;
            CostsVisibility                 = Privileges.HasAccess(UserPrivileges.MultyProject_CostsVisibility) ? Visibility.Visible : Visibility.Collapsed;
            ProcessingBookKeepingVisibility = Privileges.HasAccess(UserPrivileges.MultyProject_ProcessingBookKeepingVisibility) ? Visibility.Visible : Visibility.Collapsed;
            RemainsLoanVisibility           = Privileges.HasAccess(UserPrivileges.MultyProject_RemainsLoanVisibility) ? Visibility.Visible : Visibility.Collapsed;
            ReportsVisibility               = Privileges.HasAccess(UserPrivileges.MultyProject_ReportsVisibility) ? Visibility.Visible : Visibility.Collapsed;
            AdminVisibility                 = Privileges.HasAccess(UserPrivileges.MultyProject_AdminVisibility) ? Visibility.Visible : Visibility.Collapsed;
            RemainsSumVisibility            = Visibility.Collapsed;

            BC.SetRemainsToFirstDateInMonth();
        }
예제 #10
0
        public MonthCostsViewModel()
        {
            var firstWorkingArea = Screen.AllScreens[0].WorkingArea;

            MaxHeightForm = firstWorkingArea.Height - 100;

            _isNotTransportOnly = Privileges.HasAccess(UserPrivileges.CostsVisibility_IsNotTransportOnly);

            Costs = new ObservableCollection <InfoCost>();

            Years = new ObservableCollection <int>(BC.GetInfoCostYears());
            if (Years.Any())
            {
                SelectedYear = Years.Last();
            }

            IncomingsAndExpenses = new ObservableCollection <IncomingAndExpense>();
            IncomingsAndExpenses.Add(new IncomingAndExpense());

            ShowDayCostsCommand = new RelayCommand(ShowDayCosts);
            FilterCommand       = new RelayCommand(FilterShow);
            ReturnCommand       = new RelayCommand(Return);

            ReturnName       = "Компенсация";
            ReturnVisibility = Visibility.Collapsed;

            ReturnButtonVisibility = _isNotTransportOnly ? Visibility.Visible : Visibility.Collapsed;

            VisibilityCash = _isNotTransportOnly ? Visibility.Visible : Visibility.Collapsed;


            BC.DataContext.Configuration.AutoDetectChangesEnabled = false;

            CostItems = new ObservableCollection <DirectoryCostItem>(BC.GetDirectoryCostItems());
            var costItemEmpty = new DirectoryCostItem {
                Name = null
            };

            CostItems.Insert(0, costItemEmpty);

            InOuts = new ObservableCollection <string>
            {
                "",
                "Приход",
                "Расход"
            };
            SelectedInOut = InOuts.First();

            TransportCompanies = new ObservableCollection <DirectoryTransportCompany>(BC.GetDirectoryTransportCompanies());
            var transportCompanyEmpty = new DirectoryTransportCompany {
                Name = null
            };

            TransportCompanies.Insert(0, transportCompanyEmpty);
            SelectedTransportCompany = TransportCompanies.First();

            Notes = new ObservableCollection <DirectoryNote>(BC.GetDirectoryNotes().ToList());
            var noteEmpty = new DirectoryNote {
                Description = null
            };

            Notes.Insert(0, noteEmpty);

            SelectedNote = Notes.First();

            SelectedCostItem = CostItems.First();

            BC.DataContext.Configuration.AutoDetectChangesEnabled = true;

            InfoCost.OnChangeIsReturn += InfoCost_OnChangeIsReturn;
        }