public CreateInnerComplaintViewModel( IEntityUoWBuilder uoWBuilder, IUnitOfWorkFactory unitOfWorkFactory, IEmployeeService employeeService, ISubdivisionRepository subdivisionRepository, ICommonServices commonServices, IEntityAutocompleteSelectorFactory employeeSelectorFactory, IFilePickerService filePickerService ) : base(uoWBuilder, unitOfWorkFactory, commonServices) { this.filePickerService = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService)); 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 = "Новая внутреняя рекламация"; }
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 CommonCashTransferDocumentViewModel(IEntityUoWBuilder entityUoWBuilder, IUnitOfWorkFactory factory) : base(entityUoWBuilder, factory) { 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 DiscountReasonViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IDiscountReasonRepository discountReasonRepository, IProductGroupJournalFactory productGroupJournalFactory, INomenclatureJournalFactory nomenclatureSelectorFactory) : base(uowBuilder, unitOfWorkFactory, commonServices) { _discountReasonRepository = discountReasonRepository ?? throw new ArgumentNullException(nameof(discountReasonRepository)); _productGroupJournalFactory = productGroupJournalFactory ?? throw new ArgumentNullException(nameof(productGroupJournalFactory)); _nomenclatureAutocompleteSelectorFactory = (nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory))) .GetDefaultNomenclatureSelectorFactory(); TabName = UoWGeneric.IsNew ? "Новое основание для скидки" : $"Основание для скидки \"{Entity.Name}\""; InitializeNomenclatureCategoriesList(); }
public CashlessRequestViewModel( IFileDialogService fileDialogService, IExpenseCategorySelectorFactory expenseCategoryJournalFactory, IUserRepository userRepository, ICounterpartyJournalFactory counterpartyJournalFactory, IEmployeeRepository employeeRepository, IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, INavigationManager navigation = null) : base(uowBuilder, unitOfWorkFactory, commonServices, navigation) { TabName = base.TabName; CounterpartyAutocompleteSelector = (counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory))) .CreateCounterpartyAutocompleteSelectorFactory(); _expenseCategoryJournalFactory = expenseCategoryJournalFactory ?? throw new ArgumentNullException(nameof(expenseCategoryJournalFactory)); _currentEmployee = (employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository))) .GetEmployeeForCurrentUser(UoW); if (UoW.IsNew) { Entity.Author = _currentEmployee; Entity.Subdivision = _currentEmployee.Subdivision; Entity.Date = DateTime.Now; Entity.PayoutRequestState = PayoutRequestState.New; } UserRoles = GetUserRoles(CurrentUser.Id); IsRoleChooserSensitive = UserRoles.Count() > 1; UserRole = UserRoles.First(); OurOrganisations = UoW.Session.QueryOver <Organization>().List(); var filesViewModel = new CashlessRequestFilesViewModel(Entity, UoW, fileDialogService, CommonServices, userRepository) { ReadOnly = !IsNotClosed || IsSecurityServiceRole }; CashlessRequestFilesViewModel = filesViewModel; ConfigureEntityChangingRelations(); }
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()}"; }
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(); }
public SubdivisionViewModel( IEntityUoWBuilder uoWBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEntityAutocompleteSelectorFactory employeeSelectorFactory, IPermissionRepository permissionRepository, ISalesPlanJournalFactory salesPlanJournalFactory, INomenclatureJournalFactory nomenclatureSelectorFactory, ISubdivisionRepository subdivisionRepository ) : base(uoWBuilder, unitOfWorkFactory, commonServices) { SubdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository)); PresetSubdivisionPermissionVM = new PresetSubdivisionPermissionsViewModel(UoW, permissionRepository, Entity); EmployeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)); SalesPlanSelectorFactory = (salesPlanJournalFactory ?? throw new ArgumentNullException(nameof(salesPlanJournalFactory))) .CreateSalesPlanAutocompleteSelectorFactory(nomenclatureSelectorFactory); ConfigureEntityChangingRelations(); CreateCommands(); }
public DistrictsSetActivationViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEmployeeRepository employeeRepository, INavigationManager navigation = null) : base(uowBuilder, unitOfWorkFactory, commonServices, navigation) { TabName = $"Активация версии районов \"{Entity.Name}\""; ActivationInProgress = false; WasActivated = false; NotCopiedPriorities = new List <DriverDistrictPriority>(); ActiveDistrictsSet = UoW.Session.QueryOver <DistrictsSet>() .Where(x => x.Status == DistrictsSetStatus.Active) .Take(1) .SingleOrDefault(); _employeeRepository = employeeRepository; }
public FineViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, IUndeliveredOrdersJournalOpener undeliveryViewOpener, IEmployeeService employeeService, IEntitySelectorFactory employeeSelectorFactory, IEmployeeSettings employeeSettings, ICommonServices commonServices ) : base(uowBuilder, uowFactory, commonServices) { this.uowFactory = uowFactory ?? throw new ArgumentNullException(nameof(uowFactory)); this.undeliveryViewOpener = undeliveryViewOpener ?? throw new ArgumentNullException(nameof(undeliveryViewOpener)); this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService)); this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)); _employeeSettings = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings)); CreateCommands(); ConfigureEntityPropertyChanges(); UpdateEmployeeList(); }
public OrderWithoutShipmentForDebtViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices, IEmployeeService employeeService, IParametersProvider parametersProvider) : base(uowBuilder, uowFactory, commonServices) { if (employeeService == null) { throw new ArgumentNullException(nameof(employeeService)); } _parametersProvider = parametersProvider ?? throw new ArgumentNullException(nameof(parametersProvider)); bool canCreateBillsWithoutShipment = CommonServices.PermissionService.ValidateUserPresetPermission("can_create_bills_without_shipment", CurrentUser.Id); var currentEmployee = employeeService.GetEmployeeForUser(UoW, UserService.CurrentUserId); if (uowBuilder.IsNewEntity) { if (canCreateBillsWithoutShipment) { if (!AskQuestion("Вы действительно хотите создать счет без отгрузки на долг?")) { AbortOpening(); } else { Entity.Author = currentEmployee; } } else { AbortOpening("У Вас нет прав на выставление счетов без отгрузки."); } } TabName = "Счет без отгрузки на долг"; EntityUoWBuilder = uowBuilder; SendDocViewModel = new SendDocumentByEmailViewModel( new EmailRepository(), currentEmployee, commonServices.InteractiveService, _parametersProvider, UoW); }
public CollectiveExpenseViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, ILifetimeScope autofacScope, IValidator validator, IUserService userService, UserRepository userRepository, IInteractiveQuestion interactive, StockRepository stockRepository, CommonMessages commonMessages, FeaturesService featuresService, BaseParameters baseParameters ) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { this.autofacScope = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope)); this.userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository)); this.interactive = interactive; this.commonMessages = commonMessages ?? throw new ArgumentNullException(nameof(commonMessages)); this.featuresService = featuresService ?? throw new ArgumentNullException(nameof(featuresService)); this.baseParameters = baseParameters ?? throw new ArgumentNullException(nameof(baseParameters)); var entryBuilder = new CommonEEVMBuilderFactory <CollectiveExpense>(this, Entity, UoW, navigation, autofacScope); if (UoW.IsNew) { Entity.CreatedbyUser = userService.GetCurrentUser(UoW); } if (Entity.Warehouse == null) { Entity.Warehouse = stockRepository.GetDefaultWarehouse(UoW, featuresService, autofacScope.Resolve <IUserService>().CurrentUserId); } WarehouseEntryViewModel = entryBuilder.ForProperty(x => x.Warehouse).MakeByType().Finish(); var parameter = new TypedParameter(typeof(CollectiveExpenseViewModel), this); CollectiveExpenseItemsViewModel = this.autofacScope.Resolve <CollectiveExpenseItemsViewModel>(parameter); //Переопределяем параметры валидации Validations.Clear(); Validations.Add(new ValidationRequest(Entity, new ValidationContext(Entity, new Dictionary <object, object> { { nameof(BaseParameters), baseParameters } }))); }
public CreateComplaintViewModel(Order order, 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) : this(uowBuilder, unitOfWorkFactory, employeeService, employeeSelectorFactory, counterpartySelectorFactory, subdivisionRepository, commonServices, nomenclatureSelectorFactory, nomenclatureRepository, userRepository, filePickerService, phone) { Order _order = UoW.GetById <Order>(order.Id); Entity.Order = _order; Entity.Counterparty = _order.Client; Entity.Phone = phone; }
public FlyerViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, INomenclatureJournalFactory nomenclatureSelectorFactory, IFlyerRepository flyerRepository) : base(uowBuilder, unitOfWorkFactory, commonServices) { FlyerAutocompleteSelectorFactory = (nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory))) .CreateNomenclatureForFlyerJournalFactory(); _flyerRepository = flyerRepository ?? throw new ArgumentNullException(nameof(flyerRepository)); if (!uowBuilder.IsNewEntity) { TabName = $"{Entity.FlyerNomenclature.Name}"; } SetCurrentFlyerActionTime(); AddServiceToValidationContext(); }
public ExpenseCategoryViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IFileChooserProvider fileChooserProvider, ExpenseCategoryJournalFilterViewModel journalFilterViewModel ) : base(uowBuilder, unitOfWorkFactory, commonServices) { ExpenseCategoryAutocompleteSelectorFactory = new ExpenseCategoryAutoCompleteSelectorFactory(commonServices, journalFilterViewModel, fileChooserProvider); if (uowBuilder.IsNewEntity) { TabName = "Создание новой категории расхода"; } else { TabName = $"{Entity.Title}"; } }
public PostViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, ILifetimeScope autofacScope, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { this.autofacScope = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope)); var builder = new CommonEEVMBuilderFactory <Post>(this, Entity, UoW, NavigationManager, autofacScope); EntrySubdivision = builder.ForProperty(x => x.Subdivision) .UseViewModelJournalAndAutocompleter <SubdivisionJournalViewModel>() .UseViewModelDialog <SubdivisionViewModel>() .Finish(); EntryDepartment = builder.ForProperty(x => x.Department) .UseViewModelJournalAndAutocompleter <DepartmentJournalViewModel>() .UseViewModelDialog <DepartmentViewModel>() .Finish(); EntryProfession = builder.ForProperty(x => x.Profession) .UseViewModelJournalAndAutocompleter <ProfessionJournalViewModel>() .UseViewModelDialog <ProfessionViewModel>() .Finish(); }
public FuelIncomeInvoiceViewModel ( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, IEmployeeService employeeService, INomenclatureSelectorFactory nomenclatureSelectorFactory, ISubdivisionRepository subdivisionRepository, IFuelRepository fuelRepository, ICounterpartyJournalFactory counterpartyJournalFactory, ICommonServices commonServices ) : base(uowBuilder, unitOfWorkFactory, commonServices) { this.employeeService = employeeService; this.nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory)); this.subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository)); this.fuelRepository = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository)); this.counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory)); TabName = "Входящая накладная по топливу"; if (CurrentEmployee == null) { AbortOpening("К вашему пользователю не привязан сотрудник, невозможно открыть документ"); } if (uowBuilder.IsNewEntity) { Entity.СreationTime = DateTime.Now; Entity.Author = CurrentEmployee; } FuelBalanceViewModel = new FuelBalanceViewModel(subdivisionRepository, fuelRepository); CreateCommands(); ConfigEntityUpdateSubscribes(); ConfigureEntityPropertyChanges(); UpdateCashSubdivisions(); UpdateBalanceCache(); ValidationContext.ServiceContainer.AddService(typeof(IFuelRepository), fuelRepository); ConfigureEntries(); }
public FuelTransferDocumentViewModel( IEntityUoWBuilder uoWBuilder, IUnitOfWorkFactory unitOfWorkFactory, IEmployeeService employeeService, ISubdivisionRepository subdivisionRepository, IFuelRepository fuelRepository, ICommonServices commonServices, IEmployeeJournalFactory employeeJournalFactory, ICarJournalFactory carJournalFactory, IReportViewOpener reportViewOpener ) : base(uoWBuilder, unitOfWorkFactory, 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.employeeJournalFactory = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)); this.carJournalFactory = carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory)); this.reportViewOpener = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener)); TabName = "Документ перемещения топлива"; if (CurrentEmployee == null) { AbortOpening("К вашему пользователю не привязан сотрудник, невозможно открыть документ"); } ConfigureEntityPropertyChanges(); CreateCommands(); FuelBalanceViewModel = new FuelBalanceViewModel(subdivisionRepository, fuelRepository); UpdateCashSubdivisions(); UpdateFuelTypes(); UpdateBalanceCache(); if (uoWBuilder.IsNewEntity) { Entity.CreationTime = DateTime.Now; Entity.Author = CurrentEmployee; } ConfigureEntries(); }
public PaymentByCardViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, CallTaskWorker callTaskWorker, IOrderPaymentSettings orderPaymentSettings, IOrderParametersProvider orderParametersProvider, IDeliveryRulesParametersProvider deliveryRulesParametersProvider, Employee currentEmployee) : base(uowBuilder, unitOfWorkFactory, commonServices) { if (orderPaymentSettings == null) { throw new ArgumentNullException(nameof(orderPaymentSettings)); } if (orderParametersProvider == null) { throw new ArgumentNullException(nameof(orderParametersProvider)); } if (deliveryRulesParametersProvider == null) { throw new ArgumentNullException(nameof(deliveryRulesParametersProvider)); } _callTaskWorker = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker)); _currentEmployee = currentEmployee; TabName = "Оплата по карте"; ItemsList = UoW.GetAll <PaymentFrom>().ToList(); if (PaymentByCardFrom == null) { PaymentByCardFrom = ItemsList.FirstOrDefault(p => p.Id == orderPaymentSettings.DefaultSelfDeliveryPaymentFromId); } Entity.PropertyChanged += Entity_PropertyChanged; ValidationContext.ServiceContainer.AddService(orderParametersProvider); ValidationContext.ServiceContainer.AddService(deliveryRulesParametersProvider); }
public WarehouseTransferViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigationManager, ILifetimeScope autofacScope, IValidator validator, IUserService userService, BaseParameters baseParameters, IInteractiveQuestion interactive) : base(uowBuilder, unitOfWorkFactory, navigationManager, validator) { this.AutofacScope = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope)); this.interactive = interactive ?? throw new ArgumentNullException(nameof(interactive)); if (UoW.IsNew) { Entity.CreatedbyUser = userService.GetCurrentUser(UoW); } var entryBuilder = new CommonEEVMBuilderFactory <Transfer>(this, Entity, UoW, navigationManager) { AutofacScope = AutofacScope }; WarehouseFromEntryViewModel = entryBuilder.ForProperty(x => x.WarehouseFrom) .UseViewModelJournalAndAutocompleter <WarehouseJournalViewModel>() .UseViewModelDialog <WarehouseViewModel>() .Finish(); WarehouseToEntryViewModel = entryBuilder.ForProperty(x => x.WarehouseTo) .UseViewModelJournalAndAutocompleter <WarehouseJournalViewModel>() .UseViewModelDialog <WarehouseViewModel>() .Finish(); LoadActualAmountFromStock(); Entity.PropertyChanged += Entity_PropertyChanged; lastWarehouse = Entity.WarehouseFrom; //Переопределяем параметры валидации Validations.Clear(); Validations.Add(new ValidationRequest(Entity, new ValidationContext(Entity, new Dictionary <object, object> { { nameof(BaseParameters), baseParameters } }))); }
public ApplicationDevelopmentProposalViewModel( IEmployeeService employeeService, IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices) : base(uowBuilder, uowFactory, commonServices) { this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService)); if (uowBuilder.IsNewEntity) { Entity.Author = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id); } var canManageProposal = commonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_app_development_proposal"); IsProposalResponseVisible = !uowBuilder.IsNewEntity; UserCanManageProposal = !uowBuilder.IsNewEntity && canManageProposal; ConfigureEntityChangingRelations(); }
public PremiumViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices, IEmployeeService employeeService, IEmployeeJournalFactory employeeJournalFactory, IPremiumTemplateJournalFactory premiumTemplateJournalFactory) : base(uowBuilder, uowFactory, commonServices) { TabName = Entity.Title; if (UoW.IsNew) { Entity.Author = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id); if (Entity.Author == null) { AbortOpening("Ваш пользователь не привязан к действующему сотруднику. Невозможно создать премию" + ", т.к. некого указать в качестве автора"); } } CanEdit = (Entity.Id == 0 && PermissionResult.CanCreate) || (Entity.Id != 0 && PermissionResult.CanUpdate); Entity.ObservableItems.ListContentChanged += OnObservableItemsListContentChanged; EmployeeAutocompleteSelectorFactory = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory(); PremiumTemplateAutocompleteSelectorFactory = premiumTemplateJournalFactory.CreatePremiumTemplateAutocompleteSelectorFactory(); }
public ManualPaymentMatchingViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices, IOrderRepository orderRepository, IPaymentsRepository paymentsRepository) : base(uowBuilder, uowFactory, commonServices) { _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository)); _paymentsRepository = paymentsRepository ?? throw new ArgumentNullException(nameof(paymentsRepository)); if (uowBuilder.IsNewEntity) { AbortOpening("Невозможно создать новую загрузку выписки из текущего диалога, необходимо использовать диалоги создания"); } TabName = "Ручное распределение платежей"; //Поиск Search = new SearchViewModel(); _searchHelper = new SearchHelper(Search); Search.OnSearch += (sender, args) => UpdateNodes(); CanRevertPayFromOrder = CommonServices.PermissionService.ValidateUserPresetPermission("can_revert_pay_from_order", CurrentUser.Id); GetLastBalance(); FillSumToAllocate(); CurrentBalance = SumToAllocate - AllocatedSum; CreateCommands(); GetCounterpatyDebt(); HasPaymentItems = Entity.PaymentItems.Any(); Entity.ObservableItems.ElementRemoved += (list, idx, aObject) => HasPaymentItems = Entity.PaymentItems.Any(); if (HasPaymentItems) { UpdateAllocatedNodes(); } }
public WriteOffViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, SizeService sizeService, EmployeeCard employee = null, Subdivision subdivision = null, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { SizeService = sizeService; NavigationManager = navigation; Entity.ObservableItems.PropertyChanged += CalculateTotal; CalculateTotal(null, null); if (employee != null) { Employee = UoW.GetById <EmployeeCard>(employee.Id); } else if (subdivision != null) { Subdivision = UoW.GetById <Subdivision>(subdivision.Id); } }
public PaymentByCardViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, CallTaskWorker callTaskWorker, IOrderPaymentSettings orderPaymentSettings ) : base(uowBuilder, unitOfWorkFactory, commonServices) { this.orderPaymentSettings = orderPaymentSettings ?? throw new ArgumentNullException(nameof(orderPaymentSettings)); this.callTaskWorker = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker)); TabName = "Оплата по карте"; ItemsList = UoW.GetAll <PaymentFrom>().ToList(); if (PaymentByCardFrom == null) { PaymentByCardFrom = ItemsList.FirstOrDefault(p => p.Id == orderPaymentSettings.DefaultSelfDeliveryPaymentFromId); } Entity.PropertyChanged += Entity_PropertyChanged; }
public DistrictsSetViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEntityDeleteWorker entityDeleteWorker, IEmployeeRepository employeeRepository, IDistrictRuleRepository districtRuleRepository, INavigationManager navigation = null) : base(uowBuilder, unitOfWorkFactory, commonServices, navigation) { _entityDeleteWorker = entityDeleteWorker ?? throw new ArgumentNullException(nameof(entityDeleteWorker)); DistrictRuleRepository = districtRuleRepository ?? throw new ArgumentNullException(nameof(districtRuleRepository)); TabName = "Районы с графиками доставки"; CanChangeDistrictWageTypePermissionResult = commonServices.CurrentPermissionService.ValidatePresetPermission("can_change_district_wage_type"); if (Entity.Id == 0) { Entity.Author = employeeRepository.GetEmployeeForCurrentUser(UoW); Entity.Status = DistrictsSetStatus.Draft; } var permissionResult = commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(District)); CanEditDistrict = permissionResult.CanUpdate && Entity.Status != DistrictsSetStatus.Active; CanDeleteDistrict = permissionResult.CanDelete && Entity.Status != DistrictsSetStatus.Active; CanCreateDistrict = permissionResult.CanCreate && Entity.Status != DistrictsSetStatus.Active; var permissionRes = commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(DistrictsSet)); CanEdit = permissionRes.CanUpdate && Entity.Status != DistrictsSetStatus.Active; SortDistricts(); _geometryFactory = new GeometryFactory(new PrecisionModel(), 3857); SelectedDistrictBorderVertices = new GenericObservableList <PointLatLng>(); NewBorderVertices = new GenericObservableList <PointLatLng>(); }
public CreateInnerComplaintViewModel( IEntityUoWBuilder uoWBuilder, IUnitOfWorkFactory unitOfWorkFactory, IEmployeeService employeeService, ISubdivisionRepository subdivisionRepository, ICommonServices commonServices, IEntityAutocompleteSelectorFactory employeeSelectorFactory, IFilePickerService filePickerService, IUserRepository userRepository ) : base(uoWBuilder, unitOfWorkFactory, commonServices) { _filePickerService = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService)); _userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository)); _employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)); _employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService)); _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository)); Entity.ComplaintType = ComplaintType.Inner; Entity.SetStatus(ComplaintStatuses.Checking); _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().Where(k => !k.IsArchive).ToList(); TabName = "Новая внутреняя рекламация"; }
public IncomeCategoryViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEmployeeJournalFactory employeeJournalFactory, ISubdivisionJournalFactory subdivisionJournalFactory, IIncomeCategorySelectorFactory incomeCategorySelectorFactory ) : base(uowBuilder, unitOfWorkFactory, commonServices) { IncomeCategoryAutocompleteSelectorFactory = (incomeCategorySelectorFactory ?? throw new ArgumentNullException(nameof(incomeCategorySelectorFactory))) .CreateDefaultIncomeCategoryAutocompleteSelectorFactory(); var employeeAutocompleteSelector = (employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory))) .CreateEmployeeAutocompleteSelectorFactory(); SubdivisionAutocompleteSelectorFactory = (subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory))) .CreateDefaultSubdivisionAutocompleteSelectorFactory(employeeAutocompleteSelector); TabName = uowBuilder.IsNewEntity ? "Создание новой категории дохода" : $"{Entity.Title}"; }
public EntityDialogViewModelBase(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, IValidator validator = null) : base(unitOfWorkFactory, navigation, validator) { if (uowBuilder == null) { throw new ArgumentNullException(nameof(uowBuilder)); } string actionTitle = null; if (typeof(TEntity).GetSubjectNames()?.Genitive != null) { actionTitle = $"Редактирование {typeof(TEntity).GetSubjectNames().Genitive}"; } UoWGeneric = uowBuilder.CreateUoW <TEntity>(unitOfWorkFactory, actionTitle); base.Title = GetDialogNameByEntity(); if (Entity is INotifyPropertyChanged propertyChanged) { propertyChanged.PropertyChanged += Entity_PropertyChanged; } Validations.Add(new ValidationRequest(Entity)); }
public ExpenseCategoryViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IFileChooserProvider fileChooserProvider, ExpenseCategoryJournalFilterViewModel journalFilterViewModel, IEmployeeJournalFactory employeeJournalFactory, ISubdivisionJournalFactory subdivisionJournalFactory ) : base(uowBuilder, unitOfWorkFactory, commonServices) { if (employeeJournalFactory == null) { throw new ArgumentNullException(nameof(employeeJournalFactory)); } if (subdivisionJournalFactory == null) { throw new ArgumentNullException(nameof(subdivisionJournalFactory)); } ExpenseCategoryAutocompleteSelectorFactory = new ExpenseCategoryAutoCompleteSelectorFactory( commonServices, journalFilterViewModel, fileChooserProvider, employeeJournalFactory, subdivisionJournalFactory); SubdivisionAutocompleteSelectorFactory = subdivisionJournalFactory.CreateDefaultSubdivisionAutocompleteSelectorFactory( employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory()); if (uowBuilder.IsNewEntity) { TabName = "Создание новой категории расхода"; } else { TabName = $"{Entity.Title}"; } }