public UserSettingsViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISubdivisionParametersProvider subdivisionParametersProvider,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            ISubdivisionRepository subdivisionRepository,
            INomenclatureFixedPriceRepository nomenclatureFixedPriceRepository)
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _subdivisionParametersProvider    = subdivisionParametersProvider ?? throw new ArgumentNullException(nameof(subdivisionParametersProvider));
            _subdivisionRepository            = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _nomenclatureFixedPriceRepository =
                nomenclatureFixedPriceRepository ?? throw new ArgumentNullException(nameof(nomenclatureFixedPriceRepository));
            InteractiveService = commonServices.InteractiveService;
            SubdivisionSelectorDefaultFactory =
                (subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory)))
                .CreateDefaultSubdivisionAutocompleteSelectorFactory();
            CounterpartySelectorFactory =
                (counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();

            SetPermissions();

            if (UserIsCashier)
            {
                ConfigureCashSorting();
            }
        }
Пример #2
0
 public CreateComplaintViewModel(
     IEntityUoWBuilder uowBuilder,
     IUnitOfWorkFactory unitOfWorkFactory,
     IEmployeeService employeeService,
     IEntityAutocompleteSelectorFactory employeeSelectorFactory,
     IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
     ISubdivisionRepository subdivisionRepository,
     ICommonServices commonServices,
     IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory,
     INomenclatureRepository nomenclatureRepository,
     IUserRepository userRepository,
     IFilePickerService filePickerService,
     string phone = null
     ) : base(uowBuilder, unitOfWorkFactory, commonServices)
 {
     this.filePickerService       = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
     this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
     EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
     NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
     UserRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
     NomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
     this.subdivisionRepository  = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
     Entity.ComplaintType        = ComplaintType.Client;
     Entity.SetStatus(ComplaintStatuses.Checking);
     ConfigureEntityPropertyChanges();
     Entity.Phone = phone;
     TabName      = "Новая клиентская рекламация";
 }
Пример #3
0
        public CreateComplaintViewModel(Order order,
                                        IEntityUoWBuilder uowBuilder,
                                        IUnitOfWorkFactory unitOfWorkFactory,
                                        IEmployeeService employeeService,
                                        IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
                                        ISubdivisionRepository subdivisionRepository,
                                        ICommonServices commonServices,
                                        INomenclatureRepository nomenclatureRepository,
                                        IUserRepository userRepository,
                                        IFilePickerService filePickerService,
                                        IOrderSelectorFactory orderSelectorFactory,
                                        IEmployeeJournalFactory employeeJournalFactory,
                                        ICounterpartyJournalFactory counterpartyJournalFactory,
                                        IDeliveryPointJournalFactory deliveryPointJournalFactory,
                                        ISubdivisionJournalFactory subdivisionJournalFactory,
                                        IGtkTabsOpener gtkDialogsOpener,
                                        IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
                                        INomenclatureSelectorFactory nomenclatureSelector,
                                        IUndeliveredOrdersRepository undeliveredOrdersRepository,
                                        string phone = null) : this(uowBuilder, unitOfWorkFactory, employeeService, counterpartySelectorFactory, subdivisionRepository,
                                                                    commonServices, nomenclatureRepository, userRepository, filePickerService, orderSelectorFactory,
                                                                    employeeJournalFactory, counterpartyJournalFactory, deliveryPointJournalFactory, subdivisionJournalFactory, gtkDialogsOpener,
                                                                    undeliveredOrdersJournalOpener, nomenclatureSelector, undeliveredOrdersRepository, phone)
        {
            var currentOrder = UoW.GetById <Order>(order.Id);

            Entity.Order        = currentOrder;
            Entity.Counterparty = currentOrder.Client;
            Entity.Phone        = phone;
        }
Пример #4
0
        public CashFlow(
            ISubdivisionRepository subdivisionRepository, ICommonServices commonServices, ICategoryRepository categoryRepository)
        {
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

            if (categoryRepository == null)
            {
                throw new ArgumentNullException(nameof(categoryRepository));
            }

            Build();

            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            comboPart.ItemsEnum            = typeof(ReportParts);
            comboIncomeCategory.ItemsList  = categoryRepository.IncomeCategories(UoW);
            comboExpenseCategory.Sensitive = comboIncomeCategory.Sensitive = false;
            var now = DateTime.Now;

            dateStart.Date = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
            dateEnd.Date   = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);

            var officeFilter = new EmployeeFilterViewModel();

            officeFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.office);
            var employeeFactory = new EmployeeJournalFactory(officeFilter);

            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory());

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());

            var recurciveConfig = OrmMain.GetObjectDescription <ExpenseCategory>().TableView.RecursiveTreeConfig;
            var list            = categoryRepository.ExpenseCategories(UoW);

            list.Insert(0, allItem);
            var model = recurciveConfig.CreateModel((IList)list);

            comboExpenseCategory.Model = model.Adapter;
            comboExpenseCategory.PackStart(new CellRendererText(), true);
            comboExpenseCategory.SetCellDataFunc(comboExpenseCategory.Cells[0], HandleCellLayoutDataFunc);
            comboExpenseCategory.SetActiveIter(model.IterFromNode(allItem));

            UserSubdivisions = GetSubdivisionsForUser();
            specialListCmbCashSubdivisions.SetRenderTextFunc <Subdivision>(s => s.Name);
            specialListCmbCashSubdivisions.ItemsList = UserSubdivisions;

            ylblOrganisations.Visible = specialListCmbOrganisations.Visible = false;
            Organisations             = UoW.GetAll <Organization>();
            specialListCmbOrganisations.SetRenderTextFunc <Organization>(s => s.Name);
            specialListCmbOrganisations.ItemsList = Organisations;

            int  currentUserId = commonServices.UserService.CurrentUserId;
            bool canCreateCashReportsForOrganisations =
                commonServices.PermissionService.ValidateUserPresetPermission("can_create_cash_reports_for_organisations", currentUserId);

            checkOrganisations.Visible  = canCreateCashReportsForOrganisations;
            checkOrganisations.Toggled += CheckOrganisationsToggled;
        }
Пример #5
0
        public CommonCashTransferDocumentViewModel(
            IEntityUoWBuilder entityUoWBuilder,
            IUnitOfWorkFactory factory,
            ICategoryRepository categoryRepository,
            IEmployeeRepository employeeRepository,
            ISubdivisionRepository subdivisionRepository) : base(entityUoWBuilder, factory)
        {
            _categoryRepository    = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
            _employeeRepository    = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));

            if (entityUoWBuilder.IsNewEntity)
            {
                Entity.CreationDate = DateTime.Now;
                Entity.Author       = Cashier;
            }

            CreateCommands();
            UpdateCashSubdivisions();
            UpdateIncomeCategories();
            UpdateExpenseCategories();
            View = new CommonCashTransferDlg(this);

            Entity.PropertyChanged += Entity_PropertyChanged;

            ConfigureEntityChangingRelations();
            ConfigEntityUpdateSubscribes();
        }
        public CashInfoPanelView(IUnitOfWorkFactory uowFactory,
                                 ICashRepository cashRepository,
                                 ISubdivisionRepository subdivisionRepository,
                                 IUserRepository userRepository)
        {
            this.Build();
            _uow            = uowFactory?.CreateWithoutRoot("Боковая панель остатков по кассам") ?? throw new ArgumentNullException(nameof(uowFactory));
            _cashRepository = cashRepository ?? throw new ArgumentNullException(nameof(cashRepository));

            var currentUser           = ServicesConfig.CommonServices.UserService.GetCurrentUser(_uow);
            var availableSubdivisions = subdivisionRepository.GetCashSubdivisionsAvailableForUser(_uow, currentUser).ToList();
            var settings =
                (userRepository ?? throw new ArgumentNullException(nameof(userRepository)))
                .GetCurrentUserSettings(_uow);
            var needSave = settings.UpdateCashSortingSettings(availableSubdivisions);

            if (needSave)
            {
                _uow.Save(settings);
                _uow.Commit();
            }

            _sortedSubdivisionsIds = settings.CashSubdivisionSortingSettings
                                     .OrderBy(x => x.SortingIndex)
                                     .Select(x => x.CashSubdivision.Id)
                                     .ToList();
        }
Пример #7
0
        public RouteListWorkingJournalViewModel(
            RouteListJournalFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IRouteListRepository routeListRepository,
            IFuelRepository fuelRepository,
            ICallTaskRepository callTaskRepository,
            BaseParametersProvider baseParametersProvider,
            IExpenseParametersProvider expenseParametersProvider,
            ISubdivisionRepository subdivisionRepository,
            IAccountableDebtsRepository accountableDebtsRepository,
            IGtkTabsOpener gtkTabsOpener)
            : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            TabName = "Работа кассы с МЛ";

            _routeListRepository        = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _fuelRepository             = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            _callTaskRepository         = callTaskRepository ?? throw new ArgumentNullException(nameof(callTaskRepository));
            _baseParametersProvider     = baseParametersProvider ?? throw new ArgumentNullException(nameof(baseParametersProvider));
            _expenseParametersProvider  = expenseParametersProvider ?? throw new ArgumentNullException(nameof(expenseParametersProvider));
            _subdivisionRepository      = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _accountableDebtsRepository = accountableDebtsRepository ?? throw new ArgumentNullException(nameof(accountableDebtsRepository));
            _gtkTabsOpener = gtkTabsOpener ?? throw new ArgumentNullException(nameof(gtkTabsOpener));

            UseSlider = false;

            NotifyConfiguration.Enable();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <RouteList>(OnRouteListChanged);

            InitPopupActions();
        }
Пример #8
0
        public DeleteSubdivisionCommand(SubdivisionViewModel subdivisionViewModel, ISubdivisionRepository repository)
        {
            _subdivisionViewModel = subdivisionViewModel;
            _repository           = repository;

            _subdivisionViewModel.PropertyChanged += (sender, args) => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
        }
Пример #9
0
        public IncomeCashTransferDocumentViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICategoryRepository categoryRepository,
            IEmployeeRepository employeeRepository,
            ISubdivisionRepository subdivisionRepository,
            IEmployeeJournalFactory employeeJournalFactory,
            ICarJournalFactory carJournalFactory) : base(uowBuilder, unitOfWorkFactory)
        {
            _categoryRepository    = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
            _employeeRepository    = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            EmployeeAutocompleteSelectorFactory =
                (employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)))
                .CreateWorkingEmployeeAutocompleteSelectorFactory();
            CarAutocompleteSelectorFactory =
                (carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory)))
                .CreateCarAutocompleteSelectorFactory();

            if (uowBuilder.IsNewEntity)
            {
                Entity.CreationDate = DateTime.Now;
                Entity.Author       = Cashier;
            }
            CreateCommands();
            UpdateCashSubdivisions();
            UpdateIncomeCategories();
            UpdateExpenseCategories();
            View = new IncomeCashTransferDlg(this);

            ConfigEntityUpdateSubscribes();
            ConfigureEntityPropertyChanges();
        }
Пример #10
0
 public RefreshEmployeesCommand(EmployeeViewModel employeeViewModel, IEmployeeRepository employeeRepository,
                                ISubdivisionRepository subdivisionRepository)
 {
     _employeeViewModel     = employeeViewModel;
     _employeeRepository    = employeeRepository;
     _subdivisionRepository = subdivisionRepository;
 }
Пример #11
0
        public ReturnsReceptionView()
        {
            var baseParameters = new BaseParametersProvider(new ParametersProvider());

            _terminalNomenclatureProvider = baseParameters;
            var routeListRepository = new RouteListRepository(new StockRepository(), baseParameters);

            _carLoadDocumentRepository = new CarLoadDocumentRepository(routeListRepository);
            _carUnloadRepository       = new CarUnloadRepository();
            _subdivisionRepository     = new SubdivisionRepository(new ParametersProvider());

            Build();

            ytreeReturns.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create <ReceptionItemNode>()
                                         .AddColumn("Номенклатура").AddTextRenderer(node => node.Name)
                                         .AddColumn("№ Кулера").AddTextRenderer(node => node.Redhead)
                                         .AddSetter((cell, node) => cell.Editable = node.NomenclatureCategory == NomenclatureCategory.additional)
                                         .AddColumn("Кол-во")
                                         .AddNumericRenderer(node => node.Amount, false)
                                         .Adjustment(new Gtk.Adjustment(0, 0, 9999, 1, 100, 0))
                                         .AddSetter((cell, node) => cell.Editable = node.EquipmentId == 0)
                                         .AddSetter((cell, node) => CalculateAmount(node))
                                         .AddColumn("Ожидаемое кол-во")
                                         .AddNumericRenderer(node => node.ExpectedAmount, false)
                                         .AddColumn("")
                                         .Finish();

            ytreeReturns.ItemsDataSource = ReceptionReturnsList;
        }
Пример #12
0
 public RefreshSubdivisionsCommand(SubdivisionViewModel subdivisionViewModel,
                                   ISubdivisionRepository subdivisionRepository,
                                   IEmployeeRepository employeeRepository)
 {
     _subdivisionViewModel  = subdivisionViewModel;
     _subdivisionRepository = subdivisionRepository;
     _employeeRepository    = employeeRepository;
 }
Пример #13
0
        public IList <GoodsInRouteListResultWithSpecialRequirements> GetGoodsAndEquipsInRLWithSpecialRequirements(
            IUnitOfWork uow,
            RouteList routeList,
            ISubdivisionRepository subdivisionRepository = null,
            Warehouse warehouse = null)
        {
            if (subdivisionRepository == null && warehouse != null)
            {
                throw new ArgumentNullException(nameof(subdivisionRepository));
            }

            List <GoodsInRouteListResultWithSpecialRequirements> result = new List <GoodsInRouteListResultWithSpecialRequirements>();

            GoodsInRouteListResultWithSpecialRequirements terminal = null;

            if (warehouse != null)
            {
                var cashSubdivisions = subdivisionRepository.GetCashSubdivisions(uow);
                if (cashSubdivisions.Contains(warehouse.OwningSubdivision))
                {
                    terminal = GetTerminalInRLWithSpecialRequirements(uow, routeList, warehouse);
                }
                else
                {
                    result.AddRange(GetGoodsInRLWithoutEquipmentsWithSpecialRequirements(uow, routeList).ToList());
                    result.AddRange(GetEquipmentsInRLWithSpecialRequirements(uow, routeList).ToList());
                }
            }
            else
            {
                result.AddRange(GetGoodsInRLWithoutEquipmentsWithSpecialRequirements(uow, routeList).ToList());
                result.AddRange(GetEquipmentsInRLWithSpecialRequirements(uow, routeList).ToList());

                terminal = GetTerminalInRLWithSpecialRequirements(uow, routeList);
            }

            if (terminal != null)
            {
                result.Add(terminal);
            }

            return(result
                   .GroupBy(x => new
            {
                x.NomenclatureId,
                x.ExpireDatePercent,
                x.OwnType
            }
                            ).Select(list => new GoodsInRouteListResultWithSpecialRequirements()
            {
                NomenclatureName = list.FirstOrDefault().NomenclatureName,
                NomenclatureId = list.Key.NomenclatureId,
                OwnType = list.Key.OwnType,
                ExpireDatePercent = list.Key.ExpireDatePercent,
                Amount = list.Sum(x => x.Amount)
            }
                                     ).ToList());
        }
Пример #14
0
        public FuelBalanceViewModel(ISubdivisionRepository subdivisionRepository, IFuelRepository fuelRepository)
        {
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            this.subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.fuelRepository        = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));

            ConfigEntityUpdateSubscribes();
            Update();
        }
Пример #15
0
        public EmployeeViewModel(IEmployeeRepository employeeRepository, ISubdivisionRepository subdivisionRepository)
        {
            AddEmployeeCommand      = new AddEmployeeCommand(this);
            DeleteEmployeeCommand   = new DeleteEmployeeCommand(this, employeeRepository);
            SaveEmployeesCommand    = new SaveEmployeesCommand(this, employeeRepository);
            RefreshEmployeesCommand = new RefreshEmployeesCommand(this, employeeRepository, subdivisionRepository);

            RefreshEmployeesCommand.Execute(null);
        }
Пример #16
0
        public CreateComplaintViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            ISubdivisionRepository subdivisionRepository,
            ICommonServices commonServices,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IFilePickerService filePickerService,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository,
            string phone = null
            ) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _filePickerService          = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            UserRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.subdivisionRepository  = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));

            OrderSelectorFactory           = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            EmployeeJournalFactory         = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _employeeSelectorFactory       = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
            CounterpartyJournalFactory     = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            DeliveryPointJournalFactory    = deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            SubdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            GtkDialogsOpener               = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            UndeliveredOrdersJournalOpener =
                undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            NomenclatureSelector        = nomenclatureSelector ?? throw new ArgumentNullException(nameof(nomenclatureSelector));
            UndeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

            Entity.ComplaintType = ComplaintType.Client;
            Entity.SetStatus(ComplaintStatuses.Checking);
            ConfigureEntityPropertyChanges();
            Entity.Phone = phone;

            _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().Where(k => !k.IsArchive).ToList();

            UserHasOnlyAccessToWarehouseAndComplaints =
                ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !ServicesConfig.CommonServices.UserService.GetCurrentUser(UoW).IsAdmin;

            TabName = "Новая клиентская рекламация";
        }
Пример #17
0
        public SubdivisionViewModel(ISubdivisionRepository subdivisionRepository,
                                    IEmployeeRepository employeeRepository)
        {
            AddSubdivisionCommand      = new AddSubdivisionCommand(this);
            DeleteSubdivisionCommand   = new DeleteSubdivisionCommand(this, subdivisionRepository);
            SaveSubdivisionsCommand    = new SaveSubdivisionsCommand(this, subdivisionRepository);
            RefreshSubdivisionsCommand =
                new RefreshSubdivisionsCommand(this, subdivisionRepository, employeeRepository);

            RefreshSubdivisionsCommand.Execute(null);
        }
Пример #18
0
 public UserController(IUserRepository userRepository, ISubdivisionRepository subdivisionRepository, UserManager <ApplicationUser, long> userManager,
                       IDocumentService documentService, IDocumentRepository documentRepository, IDocumentTypeRepository documentTypeRepository, ICalculator calculator)
 {
     _subdivisionRepository  = subdivisionRepository;
     _userRepository         = userRepository;
     _userManager            = userManager;
     _documentService        = documentService;
     _documentRepository     = documentRepository;
     _documentTypeRepository = documentTypeRepository;
     _calculator             = calculator;
 }
Пример #19
0
        public FuelDocumentsJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISubdivisionRepository subdivisionRepository,
            IFuelRepository fuelRepository,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ICarJournalFactory carJournalFactory,
            IReportViewOpener reportViewOpener,
            IFileChooserProvider fileChooserProvider,
            ExpenseCategoryJournalFilterViewModel expenseCategoryJournalFilterViewModel
            ) :
            base(unitOfWorkFactory, commonServices)
        {
            this.commonServices                        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            this.employeeService                       = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.subdivisionRepository                 = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.fuelRepository                        = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            this.counterpartyJournalFactory            = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            this.nomenclatureSelectorFactory           = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.employeeJournalFactory                = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _subdivisionJournalFactory                 = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            this.carJournalFactory                     = carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory));
            this.reportViewOpener                      = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener));
            this.fileChooserProvider                   = fileChooserProvider ?? throw new ArgumentNullException(nameof(fileChooserProvider));
            this.expenseCategoryJournalFilterViewModel = expenseCategoryJournalFilterViewModel ?? throw new ArgumentNullException(nameof(expenseCategoryJournalFilterViewModel));


            TabName = "Журнал учета топлива";

            var loader = new ThreadDataLoader <FuelDocumentJournalNode>(unitOfWorkFactory);

            loader.MergeInOrderBy(x => x.CreationDate, true);
            DataLoader = loader;

            RegisterIncomeInvoice();
            RegisterTransferDocument();
            RegisterWriteoffDocument();

            FinishJournalConfiguration();

            UpdateOnChanges(
                typeof(FuelIncomeInvoice),
                typeof(FuelIncomeInvoiceItem),
                typeof(FuelTransferDocument),
                typeof(FuelWriteoffDocument),
                typeof(FuelWriteoffDocumentItem)
                );
        }
        public ComplaintFilterViewModel(
            ICommonServices commonServices,
            ISubdivisionRepository subdivisionRepository,
            IEmployeeJournalFactory employeeSelectorFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory
            )
        {
            this.commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            CounterpartySelectorFactory =
                (counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();
            EmployeeSelectorFactory =
                (employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)))
                .CreateWorkingEmployeeAutocompleteSelectorFactory();
            GuiltyItemVM = new GuiltyItemViewModel(
                new ComplaintGuiltyItem(),
                commonServices,
                subdivisionRepository,
                employeeSelectorFactory.CreateEmployeeAutocompleteSelectorFactory(),
                UoW,
                true
                );

            GuiltyItemVM.Entity.OnGuiltyTypeChange = () => {
                if (GuiltyItemVM.Entity.GuiltyType != ComplaintGuiltyTypes.Employee)
                {
                    GuiltyItemVM.Entity.Employee = null;
                }
                if (GuiltyItemVM.Entity.GuiltyType != ComplaintGuiltyTypes.Subdivision)
                {
                    GuiltyItemVM.Entity.Subdivision = null;
                }
            };
            GuiltyItemVM.OnGuiltyItemReady += (sender, e) => Update();

            _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().ToList();

            UpdateWith(
                x => x.ComplaintType,
                x => x.ComplaintStatus,
                x => x.Counterparty,
                x => x.Employee,
                x => x.StartDate,
                x => x.EndDate,
                x => x.Subdivision,
                x => x.FilterDateType,
                x => x.ComplaintKind,
                x => x.ComplaintDiscussionStatus,
                x => x.ComplaintObject
                );
        }
Пример #21
0
        public IList <GoodsInRouteListResult> GetGoodsAndEquipsInRL(
            IUnitOfWork uow,
            RouteList routeList,
            ISubdivisionRepository subdivisionRepository = null,
            Warehouse warehouse = null)
        {
            if (subdivisionRepository == null && warehouse != null)
            {
                throw new ArgumentNullException(nameof(subdivisionRepository));
            }

            List <GoodsInRouteListResult> result = new List <GoodsInRouteListResult>();

            if (warehouse != null)
            {
                var cashSubdivisions = subdivisionRepository.GetCashSubdivisions(uow);
                if (cashSubdivisions.Contains(warehouse.OwningSubdivision))
                {
                    var terminal = GetTerminalInRL(uow, routeList, warehouse);
                    if (terminal != null)
                    {
                        result.Add(terminal);
                    }
                }
                else
                {
                    result.AddRange(GetGoodsInRLWithoutEquipments(uow, routeList).ToList());
                    result.AddRange(GetEquipmentsInRL(uow, routeList).ToList());
                }
            }
            else
            {
                result.AddRange(GetGoodsInRLWithoutEquipments(uow, routeList).ToList());
                result.AddRange(GetEquipmentsInRL(uow, routeList).ToList());

                var terminal = GetTerminalInRL(uow, routeList);
                if (terminal != null)
                {
                    result.Add(terminal);
                }
            }

            return(result
                   .GroupBy(x => x.NomenclatureId, x => x.Amount)
                   .Select(x => new GoodsInRouteListResult {
                NomenclatureId = x.Key,
                Amount = x.Sum()
            }
                           )
                   .ToList());
        }
Пример #22
0
        public WarehouseJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            ISubdivisionRepository subdivisionRepository)
            : base(unitOfWorkFactory, commonServices)
        {
            TabName = "Журнал складов";
            this.subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            warehousePermissions       = new[] { WarehousePermissions.WarehouseView };

            UpdateOnChanges(
                typeof(Warehouse)
                );
        }
Пример #23
0
 public GuiltyItemsViewModel(
     Complaint entity,
     IUnitOfWork uow,
     ICommonServices commonServices,
     ISubdivisionRepository subdivisionRepository,
     IEntityAutocompleteSelectorFactory employeeSelectorFactory
     ) : base(entity, commonServices)
 {
     this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
     this.subdivisionRepository   = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
     this.commonServices          = commonServices;
     UoW = uow ?? throw new ArgumentNullException(nameof(uow));
     CreateCommands();
 }
Пример #24
0
        public WarehouseJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            ISubdivisionRepository subdivisionRepository,
            WarehouseJournalFilterViewModel filterViewModel = null)
            : base(unitOfWorkFactory, commonServices)
        {
            TabName = "Журнал складов";
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _filterViewModel       = filterViewModel;

            UpdateOnChanges(
                typeof(Warehouse)
                );
        }
 public CreateInnerComplaintViewModel(
     IEntityUoWBuilder uoWBuilder,
     IUnitOfWorkFactory unitOfWorkFactory,
     IEmployeeService employeeService,
     ISubdivisionRepository subdivisionRepository,
     ICommonServices commonServices,
     IEntityAutocompleteSelectorFactory employeeSelectorFactory
     ) : base(uoWBuilder, unitOfWorkFactory, commonServices)
 {
     this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
     this.employeeService         = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
     this.subdivisionRepository   = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
     Entity.ComplaintType         = ComplaintType.Inner;
     Entity.SetStatus(ComplaintStatuses.Checking);
     TabName = "Новая внутреняя рекламация";
 }
Пример #26
0
 public GuiltyItemViewModel(
     ComplaintGuiltyItem entity,
     ICommonServices commonServices,
     ISubdivisionRepository subdivisionRepository,
     IEntityAutocompleteSelectorFactory employeeSelectorFactory,
     IUnitOfWork uow
     ) : base(entity, commonServices)
 {
     UoW = uow ?? throw new ArgumentNullException(nameof(uow));
     EmployeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
     if (subdivisionRepository == null)
     {
         throw new ArgumentNullException(nameof(subdivisionRepository));
     }
     ConfigureEntityPropertyChanges();
     AllDepartments = subdivisionRepository.GetAllDepartments(UoW);
 }
Пример #27
0
        public CreateComplaintViewModel(Counterparty client,
                                        IEntityUoWBuilder uowBuilder,
                                        IUnitOfWorkFactory unitOfWorkFactory,
                                        IEmployeeService employeeService,
                                        IEntityAutocompleteSelectorFactory employeeSelectorFactory,
                                        IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
                                        ISubdivisionRepository subdivisionRepository,
                                        ICommonServices commonServices,
                                        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory,
                                        INomenclatureRepository nomenclatureRepository,
                                        IUserRepository userRepository,
                                        string phone = null) : this(uowBuilder, unitOfWorkFactory, employeeService, employeeSelectorFactory, counterpartySelectorFactory, subdivisionRepository, commonServices, nomenclatureSelectorFactory, nomenclatureRepository, userRepository, phone)
        {
            Counterparty _client = UoW.GetById <Counterparty>(client.Id);

            Entity.Counterparty = _client;
            Entity.Phone        = phone;
        }
        public FuelWriteoffDocumentViewModel(
            IEntityUoWBuilder uoWBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IEmployeeService employeeService,
            IFuelRepository fuelRepository,
            ISubdivisionRepository subdivisionRepository,
            ICommonServices commonServices,
            IEmployeeJournalFactory employeeJournalFactory,
            IReportViewOpener reportViewOpener,
            IFileChooserProvider fileChooserProvider,
            ExpenseCategoryJournalFilterViewModel expenseCategoryJournalFilterViewModel,
            ISubdivisionJournalFactory subdivisionJournalFactory
            )
            : base(uoWBuilder, unitOfWorkFactory, commonServices)
        {
            this.unitOfWorkFactory     = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this.employeeService       = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.fuelRepository        = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            this.subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            EmployeeJournalFactory     = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            this.reportViewOpener      = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener));
            this.expenseCategoryJournalFilterViewModel = expenseCategoryJournalFilterViewModel ?? throw new ArgumentNullException(nameof(expenseCategoryJournalFilterViewModel));
            this.fileChooserProvider  = fileChooserProvider ?? throw new ArgumentNullException(nameof(fileChooserProvider));
            SubdivisionJournalFactory = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));

            CreateCommands();
            UpdateCashSubdivisions();

            TabName = "Акт выдачи топлива";
            if (CurrentEmployee == null)
            {
                AbortOpening("К вашему пользователю не привязан сотрудник, невозможно открыть документ");
            }

            if (UoW.IsNew)
            {
                Entity.Date    = DateTime.Now;
                Entity.Cashier = CurrentEmployee;
            }

            ValidationContext.ServiceContainer.AddService(typeof(IFuelRepository), fuelRepository);
            ConfigureEntries();
        }
Пример #29
0
        public CashBookReport(ISubdivisionRepository subdivisionRepository, ICommonServices commonServices)
        {
            this.Build();
            this.subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            UserSubdivisions = GetSubdivisionsForUser();

            dateperiodpicker.StartDate = DateTime.Now.Date;
            dateperiodpicker.EndDate   = DateTime.Now.Date;

            #region Выбор кассы
            var subdivisions = subdivisionRepository.GetSubdivisionsForDocumentTypes(UoW, new Type[] { typeof(Income), typeof(Income) });
            var itemsList    = subdivisions.ToList();
            {
                IEnumerable <int> fromTypes = itemsList.Select(x => x.Id);
                IEnumerable <int> fromUser  = UserSubdivisions.Select(x => x.Id);
                if (!new HashSet <int>(fromTypes).IsSupersetOf(fromUser))
                {
                    subdivisions = itemsList.Concat(UserSubdivisions);
                }
            }
            itemsList.Add(new Subdivision {
                Name = "Все"
            });

            yspeccomboboxCashSubdivision.SetRenderTextFunc <Subdivision>(s => s.Name);
            yspeccomboboxCashSubdivision.ItemsList    = itemsList;
            yspeccomboboxCashSubdivision.SelectedItem = UserSubdivisions.Count != 0 ? UserSubdivisions?.First() : itemsList.First();
            #endregion

            hboxOrganisations.Visible = false;
            Organizations             = UoW.GetAll <Organization>();
            specialListCmbOrganisations.SetRenderTextFunc <Organization>(s => s.Name);
            specialListCmbOrganisations.ItemsList = Organizations;

            int  currentUserId = commonServices.UserService.CurrentUserId;
            bool canCreateCashReportsForOrganisations =
                commonServices.PermissionService.ValidateUserPresetPermission("can_create_cash_reports_for_organisations", currentUserId);
            ycheckOrganisations.Visible  = canCreateCashReportsForOrganisations;
            ycheckOrganisations.Toggled += CheckOrganisationsToggled;

            buttonCreateRepot.Clicked += OnButtonCreateRepotClicked;
        }
Пример #30
0
        public ComplaintViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory uowFactory,
            ICommonServices commonServices,
            IUndeliveriesViewOpener undeliveryViewOpener,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory employeeSelectorFactory,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            IFilePickerService filePickerService,
            ISubdivisionRepository subdivisionRepository,
            IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository
            ) : base(uowBuilder, uowFactory, commonServices)
        {
            this.filePickerService      = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            this.subdivisionRepository  = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            NomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            this.undeliveryViewOpener   = undeliveryViewOpener ?? throw new ArgumentNullException(nameof(undeliveryViewOpener));
            EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            UserRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
            Entity.ObservableComplaintDiscussions.ElementChanged     += ObservableComplaintDiscussions_ElementChanged;
            Entity.ObservableComplaintDiscussions.ListContentChanged += ObservableComplaintDiscussions_ListContentChanged;
            Entity.ObservableFines.ListContentChanged += ObservableFines_ListContentChanged;

            if (uowBuilder.IsNewEntity)
            {
                AbortOpening("Невозможно создать новую рекламацию из текущего диалога, необходимо использовать диалоги создания");
            }

            if (CurrentEmployee == null)
            {
                AbortOpening("Невозможно открыть рекламацию так как к вашему пользователю не привязан сотрудник");
            }

            ConfigureEntityChangingRelations();

            CreateCommands();
            TabName = $"Рекламация №{Entity.Id} от {Entity.CreationDate.ToShortDateString()}";
        }