public ResidueJournalViewModel( ResidueFilterViewModel filterViewModel, IEmployeeService employeeService, IRepresentationEntityPicker representationEntityPicker, IMoneyRepository moneyRepository, IDepositRepository depositRepository, IBottlesRepository bottlesRepository, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEntityAutocompleteSelectorFactory employeeSelectorFactory ) : base(filterViewModel, unitOfWorkFactory, commonServices) { this.employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)); TabName = "Журнал остатков"; this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService)); this.representationEntityPicker = representationEntityPicker ?? throw new ArgumentNullException(nameof(representationEntityPicker)); this.moneyRepository = moneyRepository ?? throw new ArgumentNullException(nameof(moneyRepository)); this.depositRepository = depositRepository ?? throw new ArgumentNullException(nameof(depositRepository)); this.bottlesRepository = bottlesRepository ?? throw new ArgumentNullException(nameof(bottlesRepository)); this.unitOfWorkFactory = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory)); this.commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices)); SetOrder(x => x.Date, true); UpdateOnChanges( typeof(Residue) ); }
public CallTaskDlg(int callTaskId) { this.Build(); UoWGeneric = UnitOfWorkFactory.CreateForRoot <CallTask>(callTaskId); _employeeRepository = new EmployeeRepository(); _bottleRepository = new BottlesRepository(); _callTaskRepository = new CallTaskRepository(); _phoneRepository = new PhoneRepository(); _deliveryPointJournalFilterViewModel = new DeliveryPointJournalFilterViewModel(); TabName = Entity.Counterparty?.Name; labelCreator.Text = $"Создатель : {Entity.TaskCreator?.ShortName}"; ConfigureDlg(); }
public TasksView( IEmployeeRepository employeeRepository, IBottlesRepository bottleRepository, ICallTaskRepository callTaskRepository, IPhoneRepository phoneRepository) { this.Build(); this.employeeRepository = employeeRepository; this.bottleRepository = bottleRepository; this.callTaskRepository = callTaskRepository; this.phoneRepository = phoneRepository; UoW = UnitOfWorkFactory.CreateWithoutRoot(); this.TabName = "Журнал задач для обзвона"; ConfigureDlg(); }
public CallTaskDlg() { this.Build(); UoWGeneric = UnitOfWorkFactory.CreateWithNewRoot <CallTask>(); _employeeRepository = new EmployeeRepository(); _bottleRepository = new BottlesRepository(); _callTaskRepository = new CallTaskRepository(); _phoneRepository = new PhoneRepository(); _deliveryPointJournalFilterViewModel = new DeliveryPointJournalFilterViewModel(); TabName = "Новая задача"; Entity.CreationDate = DateTime.Now; Entity.Source = TaskSource.Handmade; Entity.TaskCreator = _employeeRepository.GetEmployeeForCurrentUser(UoW);; Entity.EndActivePeriod = DateTime.Now.AddDays(1); createTaskButton.Sensitive = false; ConfigureDlg(); }
public BusinessTasksJournalViewModel( CallTaskFilterViewModel filterViewModel, BusinessTasksJournalFooterViewModel footerViewModel, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEmployeeRepository employeeRepository, IBottlesRepository bottleRepository, ICallTaskRepository callTaskRepository, IPhoneRepository phoneRepository, IOrganizationProvider organizationProvider, ICounterpartyContractRepository counterpartyContractRepository, CounterpartyContractFactory counterpartyContractFactory, IRoboAtsCounterpartyJournalFactory roboAtsCounterpartyJournalFactory, IContactsParameters contactsParameters ) : base(filterViewModel, unitOfWorkFactory, commonServices) { TabName = "Журнал задач для обзвона"; this.employeeRepository = employeeRepository; this.bottleRepository = bottleRepository; this.callTaskRepository = callTaskRepository; this.phoneRepository = phoneRepository; this.organizationProvider = organizationProvider ?? throw new ArgumentNullException(nameof(organizationProvider)); this.counterpartyContractRepository = counterpartyContractRepository ?? throw new ArgumentNullException(nameof(counterpartyContractRepository)); this.counterpartyContractFactory = counterpartyContractFactory ?? throw new ArgumentNullException(nameof(counterpartyContractFactory)); this.footerViewModel = footerViewModel; this.commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices)); _roboAtsCounterpartyJournalFactory = roboAtsCounterpartyJournalFactory ?? throw new ArgumentNullException(nameof(roboAtsCounterpartyJournalFactory)); _contactsParameters = contactsParameters ?? throw new ArgumentNullException(nameof(contactsParameters)); actionsViewModel = new BusinessTasksJournalActionsViewModel(new EmployeeJournalFactory()); RegisterTasks(); var threadLoader = DataLoader as ThreadDataLoader <BusinessTaskJournalNode>; FinishJournalConfiguration(); UpdateOnChanges( typeof(ClientTask), typeof(PaymentTask) ); DataLoader.ItemsListUpdated += (sender, e) => GetStatistics(); }
public TasksView( IEmployeeRepository employeeRepository, IBottlesRepository bottleRepository, ICallTaskRepository callTaskRepository, IPhoneRepository phoneRepository, IEmployeeJournalFactory employeeJournalFactory, IDeliveryPointRepository deliveryPointRepository) { this.Build(); _employeeRepository = employeeRepository; _bottleRepository = bottleRepository; _callTaskRepository = callTaskRepository; _phoneRepository = phoneRepository; _employeeJournalFactory = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)); _deliveryPointRepository = deliveryPointRepository ?? throw new ArgumentNullException(nameof(deliveryPointRepository)); UoW = UnitOfWorkFactory.CreateWithoutRoot(); this.TabName = "Журнал задач для обзвона"; ConfigureDlg(); }
public ResidueViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, IEmployeeService employeeService, IRepresentationEntityPicker entityPicker, IBottlesRepository bottlesRepository, IDepositRepository depositRepository, IMoneyRepository moneyRepository, ICommonServices commonServices, IEntityAutocompleteSelectorFactory employeeSelectorFactory ) : base(uowBuilder, uowFactory, commonServices) { this.employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService)); this.entityPicker = entityPicker ?? throw new ArgumentNullException(nameof(entityPicker)); this.bottlesRepository = bottlesRepository ?? throw new ArgumentNullException(nameof(bottlesRepository)); this.depositRepository = depositRepository ?? throw new ArgumentNullException(nameof(depositRepository)); this.moneyRepository = moneyRepository ?? throw new ArgumentNullException(nameof(moneyRepository)); TabName = "Ввод остатков"; if (CurrentEmployee == null) { AbortOpening("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, " + "так как некого указывать в качестве кладовщика.", "Невозможно открыть ввод остатков"); } if (UoW.IsNew) { Entity.Author = CurrentEmployee; Entity.Date = new DateTime(2017, 4, 23); } CreateCommands(); ConfigureEntityPropertyChanges(); UpdateResidue(); GuiltyItemsVM = new GuiltyItemsViewModel( new Complaint(), UoW, commonServices, new SubdivisionRepository(new ParametersProvider()), employeeSelectorFactory); Entity.ObservableEquipmentDepositItems.PropertyOfElementChanged += OnObservableEquipmentItemsPropertyOfElementChanged; }
protected void RefreshSpinButtons(IBottlesRepository bottlesRepository, IDepositRepository depositRepository) { if (depositRepository == null) { throw new ArgumentNullException(nameof(depositRepository)); } if (bottlesRepository == null) { throw new ArgumentNullException(nameof(bottlesRepository)); } int bottlesMax = bottlesRepository.GetBottlesDebtAtCouterpartyAndDeliveryPoint(UoWGeneric, Entity.FromClient, Entity.FromDeliveryPoint, Entity.TimeStamp); decimal depositsBottlesMax = depositRepository.GetDepositsAtCounterpartyAndDeliveryPoint(UoWGeneric, Entity.FromClient, Entity.FromDeliveryPoint, DepositType.Bottles, Entity.TimeStamp); decimal depositsEquipmentMax = depositRepository.GetDepositsAtCounterpartyAndDeliveryPoint(UoWGeneric, Entity.FromClient, Entity.FromDeliveryPoint, DepositType.Equipment, Entity.TimeStamp); if (Entity.OutBottlesOperation != null) { spinBottles.Value = Entity.OutBottlesOperation.Returned != 0 ? Entity.OutBottlesOperation.Returned : (Entity.OutBottlesOperation.Delivered * -1); } else { spinBottles.Value = 0; } if (Entity.OutBottlesDepositOperation != null) { spinDepositsBottles.Value = (double)(Entity.OutBottlesDepositOperation.RefundDeposit != 0 ? Entity.OutBottlesDepositOperation.RefundDeposit : (Entity.OutBottlesDepositOperation.ReceivedDeposit * -1)); } else { spinDepositsBottles.Value = 0; } if (Entity.OutEquipmentDepositOperation != null) { spinDepositsEquipment.Value = (double)(Entity.OutEquipmentDepositOperation.RefundDeposit != 0 ? Entity.OutEquipmentDepositOperation.RefundDeposit : (Entity.OutEquipmentDepositOperation.ReceivedDeposit * -1)); } else { spinDepositsEquipment.Value = 0; } if (Math.Abs(bottlesMax) < Math.Abs(spinBottles.Value) || Math.Abs(depositsBottlesMax) < Math.Abs((decimal)spinDepositsBottles.Value) || Math.Abs(depositsEquipmentMax) < Math.Abs((decimal)spinDepositsEquipment.Value)) { checkbuttonLock.Active = false; } spinBottles.Sensitive = Entity.FromClient != null; labelBottlesMax.LabelProp = bottlesMax.ToString(); spinDepositsBottles.Sensitive = Entity.FromClient != null; labelDepositsBottlesMax.LabelProp = depositsBottlesMax.ToString(); spinDepositsEquipment.Sensitive = Entity.FromClient != null; labelDepositsEquipmentMax.LabelProp = depositsEquipmentMax.ToString(); if (checkbuttonLock.Active) { spinBottles.Adjustment.Upper = bottlesMax > 0 ? bottlesMax : 0; spinBottles.Adjustment.Lower = bottlesMax < 0 ? bottlesMax : 0; spinDepositsBottles.Adjustment.Upper = (double)(depositsBottlesMax > 0 ? depositsBottlesMax : 0); spinDepositsBottles.Adjustment.Lower = (double)(depositsBottlesMax < 0 ? depositsBottlesMax : 0); spinDepositsEquipment.Adjustment.Upper = (double)(depositsEquipmentMax > 0 ? depositsEquipmentMax : 0); spinDepositsEquipment.Adjustment.Lower = (double)(depositsEquipmentMax < 0 ? depositsEquipmentMax : 0); } else { spinBottles.Adjustment.Upper = 1000; spinBottles.Adjustment.Lower = -1000; spinDepositsBottles.Adjustment.Upper = 100000; spinDepositsBottles.Adjustment.Lower = -100000; spinDepositsEquipment.Adjustment.Upper = 100000; spinDepositsEquipment.Adjustment.Lower = -100000; } }
public void UpdateReceptions_WhenShipWaterFirstThenGoodsWithTwoDifferentSelfDeliveryDocuments_BottlesCountWillNotBeSetToZeroInBottleMovementOperation() { // arrange Order order = new Order { ReturnedTare = 1 }; Nomenclature nomenclatureMock = Substitute.For <Nomenclature>(); nomenclatureMock.Id.Returns(99); Warehouse warehouseMock01 = Substitute.For <Warehouse>(); warehouseMock01.CanReceiveBottles.Returns(true); warehouseMock01.CanReceiveEquipment.Returns(false); Warehouse warehouseMock02 = Substitute.For <Warehouse>(); warehouseMock02.CanReceiveBottles.Returns(false); warehouseMock02.CanReceiveEquipment.Returns(true); SelfDeliveryDocument selfDelivery01 = new SelfDeliveryDocument { TimeStamp = new DateTime(2000, 01, 01, 12, 00, 00), Order = order, Warehouse = warehouseMock01, ReturnedItems = new List <SelfDeliveryDocumentReturned> { new SelfDeliveryDocumentReturned { Amount = 1, Nomenclature = nomenclatureMock, WarehouseMovementOperation = Substitute.For <WarehouseMovementOperation>(), CounterpartyMovementOperation = Substitute.For <CounterpartyMovementOperation>() }, Substitute.For <SelfDeliveryDocumentReturned>() } }; SelfDeliveryDocument selfDelivery02 = new SelfDeliveryDocument { TimeStamp = new DateTime(2000, 01, 01, 12, 10, 00), Order = order, Warehouse = warehouseMock02, ReturnedItems = new List <SelfDeliveryDocumentReturned> { new SelfDeliveryDocumentReturned { Amount = 0, Nomenclature = nomenclatureMock, WarehouseMovementOperation = Substitute.For <WarehouseMovementOperation>() }, new SelfDeliveryDocumentReturned { Amount = 0, Nomenclature = Substitute.For <Nomenclature>(), WarehouseMovementOperation = Substitute.For <WarehouseMovementOperation>() } } }; IUnitOfWork uow = Substitute.For <IUnitOfWork>(); uow.GetById <Nomenclature>(112).Returns(Substitute.For <Nomenclature>()); uow.GetById <Nomenclature>(99).Returns(nomenclatureMock); INomenclatureRepository nomenclatureRepository = Substitute.For <INomenclatureRepository>(); nomenclatureRepository.GetDefaultBottleNomenclature(uow).Returns(nomenclatureMock); IBottlesRepository bottlesRepository = Substitute.For <IBottlesRepository>(); bottlesRepository.GetEmptyBottlesFromClientByOrder(uow, nomenclatureRepository, order, 1).ReturnsForAnyArgs(order.ReturnedTare.Value); // act selfDelivery01.TareToReturn = 2; selfDelivery01.InitializeDefaultValues(uow, nomenclatureRepository); selfDelivery01.UpdateReceptions( uow, new List <GoodsReceptionVMNode>(), nomenclatureRepository, bottlesRepository ); selfDelivery02.InitializeDefaultValues(uow, nomenclatureRepository); selfDelivery02.UpdateReceptions( uow, new List <GoodsReceptionVMNode> { new GoodsReceptionVMNode { Amount = 1, NomenclatureId = 112, Category = NomenclatureCategory.equipment } }, nomenclatureRepository, bottlesRepository ); // assert Assert.That(order.ReturnedTare, Is.EqualTo(3)); }