示例#1
0
    void ActionNewRequestToSupplier_Activated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        tdiMain.OpenTab(
            DialogHelper.GenerateDialogHashName <RequestToSupplier>(0),
            () => new RequestToSupplierViewModel(
                EntityUoWBuilder.ForCreate(),
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                VodovozGtkServicesConfig.EmployeeService,
                new SupplierPriceItemsRepository(),
                counterpartySelectorFactory,
                nomenclatureSelectorFactory,
                nomenclatureRepository,
                UserSingletonRepository.GetInstance()
                )
            );
    }
示例#2
0
    void ActionJournalOfRequestsToSuppliers_Activated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        RequestsToSuppliersFilterViewModel filter = new RequestsToSuppliersFilterViewModel(nomenclatureSelectorFactory);

        var requestsJournal = new RequestsToSuppliersJournalViewModel(
            filter,
            UnitOfWorkFactory.GetDefaultFactory,
            ServicesConfig.CommonServices,
            VodovozGtkServicesConfig.EmployeeService,
            new SupplierPriceItemsRepository(),
            counterpartySelectorFactory,
            nomenclatureSelectorFactory,
            nomenclatureRepository,
            UserSingletonRepository.GetInstance()
            );

        tdiMain.AddTab(requestsJournal);
    }
        public OrderJournalViewModel CreateOrderJournalViewModel()
        {
            var subdivisionJournalFactory   = new SubdivisionJournalFactory();
            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            return(new OrderJournalViewModel(
                       _orderJournalFilter ?? new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory),
                       UnitOfWorkFactory.GetDefaultFactory,
                       ServicesConfig.CommonServices,
                       VodovozGtkServicesConfig.EmployeeService,
                       nomenclatureRepository,
                       userRepository,
                       new OrderSelectorFactory(),
                       new EmployeeJournalFactory(),
                       counterpartyJournalFactory,
                       new DeliveryPointJournalFactory(),
                       subdivisionJournalFactory,
                       new GtkTabsOpener(),
                       new UndeliveredOrdersJournalOpener(),
                       new NomenclatureJournalFactory(),
                       new UndeliveredOrdersRepository(),
                       new SubdivisionRepository(new ParametersProvider()),
                       new FileDialogService()
                       ));
        }
示例#4
0
        public IEntityAutocompleteSelectorFactory GetDefaultWaterSelectorFactory()
        {
            var nomenclatureFilter = new NomenclatureFilterViewModel {
                HidenByDefault = true
            };

            nomenclatureFilter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = NomenclatureCategory.water,
                x => x.RestrictDilers   = true
                );

            var counterpartyJournalFactory = new CounterpartyJournalFactory();
            var nomRep         = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            var journalViewModel = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                new NomenclatureJournalFactory(),
                counterpartyJournalFactory,
                nomRep,
                userRepository)
            {
                SelectionMode = JournalSelectionMode.Single,
            };

            return(new EntityAutocompleteSelectorFactory <NomenclaturesJournalViewModel>(typeof(Nomenclature), () => journalViewModel));
        }
示例#5
0
        public IEntitySelector CreateNomenclatureOfGoodsWithoutEmptyBottlesSelector(IEnumerable <int> excludedNomenclatures = null)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictArchive     = true;
            nomenclatureFilter.AvailableCategories = Nomenclature.GetCategoriesForGoodsWithoutEmptyBottles();

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository,
                    userRepository);

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                userRepository
                );

            vm.SelectionMode = JournalSelectionMode.Single;

            return(vm);
        }
示例#6
0
        public IEntitySelector CreateNomenclatureSelectorForFuelSelect()
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictCategory = NomenclatureCategory.fuel;
            nomenclatureFilter.RestrictArchive  = false;

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository,
                    UserSingletonRepository.GetInstance());

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                UserSingletonRepository.GetInstance()
                );

            vm.SelectionMode = JournalSelectionMode.Multiple;

            return(vm);
        }
示例#7
0
        public void CreateComplaint(Order order)
        {
            if (order != null)
            {
                var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

                IEntityAutocompleteSelectorFactory employeeSelectorFactory =
                    new DefaultEntityAutocompleteSelectorFactory <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel>(
                        ServicesConfig.CommonServices);

                IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
                    new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                                  CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

                IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
                    new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig
                                                                                                              .CommonServices, new NomenclatureFilterViewModel(), counterpartySelectorFactory,
                                                                                                              nomenclatureRepository, UserSingletonRepository.GetInstance());

                ISubdivisionRepository subdivisionRepository = new SubdivisionRepository();

                var parameters = new Dictionary <string, object> {
                    { "order", order },
                    { "uowBuilder", EntityUoWBuilder.ForCreate() },
                    { "unitOfWorkFactory", UnitOfWorkFactory.GetDefaultFactory },
                    { "employeeSelectorFactory", employeeSelectorFactory },
                    { "counterpartySelectorFactory", counterpartySelectorFactory },
                    { "subdivisionService", subdivisionRepository },
                    { "nomenclatureSelectorFactory", nomenclatureSelectorFactory },
                    { "nomenclatureRepository", nomenclatureRepository },
                    { "phone", "+7" + this.MangoManager.CurrentCall.Phone.Number }
                };
                tdiNavigation.OpenTdiTabOnTdiNamedArgs <CreateComplaintViewModel>(null, parameters);
            }
        }
示例#8
0
        public List <NomenclatureDTO> GetGoods(CatalogType type)
        {
            using (var uow = UnitOfWorkFactory.CreateWithoutRoot())
            {
                var types = Enum.GetValues(typeof(MobileCatalog))
                            .Cast <MobileCatalog>()
                            .Where(x => x.ToString().StartsWith(type.ToString()))
                            .ToArray();

                var list = NomenclatureRepository.GetNomenclatureWithPriceForMobileApp(uow, types);
                if (type == CatalogType.Water)
                {
                    list = list.OrderByDescending(n => n.Weight)
                           .ThenBy(n => n.NomenclaturePrice.Any() ? n.NomenclaturePrice.Max(p => p.Price) : 0)
                           .ToList();
                }
                else
                {
                    list = list.OrderBy(n => (int)n.MobileCatalog)
                           .ThenBy(n => n.NomenclaturePrice.Any() ? n.NomenclaturePrice.Max(p => p.Price) : 0)
                           .ToList();
                }

                var listDto = list.Select(n => new NomenclatureDTO(n)).ToList();

                var imageIds = NomenclatureRepository.GetNomenclatureImagesIds(uow, list.Select(x => x.Id).ToArray());
                listDto.Where(dto => imageIds.ContainsKey(dto.Id))
                .ToList()
                .ForEach(dto => dto.imagesIds = imageIds[dto.Id]);
                return(listDto);
            }
        }
示例#9
0
        public IEntityAutocompleteSelectorFactory CreateOrderAutocompleteSelectorFactory()
        {
            ISubdivisionJournalFactory subdivisionJournalFactory = new SubdivisionJournalFactory();

            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            var orderJournalFilterViewModel = new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory);

            return(new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order),
                                                                                 () => new OrderJournalViewModel(
                                                                                     orderJournalFilterViewModel,
                                                                                     UnitOfWorkFactory.GetDefaultFactory,
                                                                                     ServicesConfig.CommonServices,
                                                                                     VodovozGtkServicesConfig.EmployeeService,
                                                                                     nomenclatureRepository,
                                                                                     userRepository,
                                                                                     new OrderSelectorFactory(),
                                                                                     new EmployeeJournalFactory(),
                                                                                     counterpartyJournalFactory,
                                                                                     new DeliveryPointJournalFactory(),
                                                                                     subdivisionJournalFactory,
                                                                                     new GtkTabsOpener(),
                                                                                     new UndeliveredOrdersJournalOpener(),
                                                                                     new NomenclatureSelectorFactory(),
                                                                                     new UndeliveredOrdersRepository()
                                                                                     )
                                                                                 ));
        }
示例#10
0
        public IEntityAutocompleteSelector CreateAutocompleteSelector(bool multipleSelect = false)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictCategory = NomenclatureCategory.fuel;
            nomenclatureFilter.RestrictArchive  = false;

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository, userRepository);

            WaterJournalViewModel waterJournal = new WaterJournalViewModel(
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                userRepository
                );

            waterJournal.SelectionMode = multipleSelect ? JournalSelectionMode.Multiple : JournalSelectionMode.Single;
            return(waterJournal);
        }
示例#11
0
        public IEntityAutocompleteSelectorFactory CreateNomenclatureForFlyerJournalFactory() =>
        new EntityAutocompleteSelectorFactory <NomenclaturesJournalViewModel>(
            typeof(Nomenclature),
            () =>
        {
            var filter = new NomenclatureFilterViewModel
            {
                RestrictCategory = NomenclatureCategory.additional, RestrictArchive = false
            };

            var nomenclatureRepository     = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository             = new UserRepository();
            var counterpartyJournalFactory = new CounterpartyJournalFactory();

            var journal = new NomenclaturesJournalViewModel(
                filter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                new NomenclatureJournalFactory(),
                counterpartyJournalFactory,
                nomenclatureRepository,
                userRepository)
            {
                SelectionMode = JournalSelectionMode.Single
            };

            return(journal);
        }
            );
示例#12
0
    void ActionOrdersTableActivated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        OrderJournalFilterViewModel filter = new OrderJournalFilterViewModel()
        {
            IsForRetail = false
        };
        var ordersJournal = new OrderJournalViewModel(filter,
                                                      UnitOfWorkFactory.GetDefaultFactory,
                                                      ServicesConfig.CommonServices,
                                                      VodovozGtkServicesConfig.EmployeeService,
                                                      nomenclatureSelectorFactory,
                                                      counterpartySelectorFactory,
                                                      nomenclatureRepository,
                                                      UserSingletonRepository.GetInstance());

        tdiMain.AddTab(ordersJournal);
    }
示例#13
0
        public IEntitySelector CreateNomenclatureSelectorForFuelSelect()
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictCategory = NomenclatureCategory.fuel;
            nomenclatureFilter.RestrictArchive  = false;

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartyJournalFactory = new CounterpartyJournalFactory();

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                new NomenclatureJournalFactory(),
                counterpartyJournalFactory,
                nomenclatureRepository,
                userRepository
                );

            vm.SelectionMode = JournalSelectionMode.Multiple;

            return(vm);
        }
示例#14
0
        protected void OnBtnAddOtherGoodsClicked(object sender, EventArgs e)
        {
            OrmReference refWin = new OrmReference(NomenclatureRepository.NomenclatureOfGoodsWithoutEmptyBottlesQuery());

            refWin.FilterClass     = null;
            refWin.Mode            = OrmReferenceMode.Select;
            refWin.ObjectSelected += RefWin_ObjectSelected;
            this.TabParent.AddTab(refWin, this);
        }
示例#15
0
        protected void OnButtonAddEquipmentClicked(object sender, EventArgs e)
        {
            OrmReference refWin = new OrmReference(NomenclatureRepository.NomenclatureByCategory(NomenclatureCategory.equipment));

            refWin.FilterClass     = null;
            refWin.Mode            = OrmReferenceMode.Select;
            refWin.ObjectSelected += RefWin_ObjectSelected;
            MyTab.TabParent.AddTab(refWin, MyTab);
        }
示例#16
0
        public Goods(Export export)
        {
            myExport = export;
            myExport.OnProgressPlusOneTask("Выгружаем товары");

            var groupsIds = myExport.ProductGroups.ToExportIds();

            Nomenclatures = NomenclatureRepository.NomenclatureInGroupsQuery(groupsIds).GetExecutableQueryOver(myExport.UOW.Session).List();
            Nomenclatures.ToList().ForEach(n => n.CreateGuidIfNotExist(export.UOW));
        }
示例#17
0
 public OperationsController(OperationRepository operationRepository,
                             StorageNameRepository storageNameRepository,
                             NomenclatureRepository nomenRepository,
                             CriteriaRepository <OperationSimple> operationSimpleRepository,
                             CriteriaRepository <OperType> operationTypeRepository)
 {
     Check.Require(operationRepository != null, "operationRepository may not be null");
     this.operationRepository       = operationRepository;
     this.operationTypeRepository   = operationTypeRepository;
     this.operationSimpleRepository = operationSimpleRepository;
     this.nomenRepository           = nomenRepository;
     this.storageNameRepository     = storageNameRepository;
 }
示例#18
0
    void ActionExportImportNomenclatureCatalog_Activated(object sender, System.EventArgs e)
    {
        INomenclatureRepository nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        tdiMain.OpenTab(
            "ExportImportNomenclatureCatalog",
            () => new ExportImportNomenclatureCatalogViewModel(
                nomenclatureRepository,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                NavigationManagerProvider.NavigationManager
                )
            );
    }
示例#19
0
 public RemainsController(RemainRepository remainsRepository,
                          CriteriaRepository <Storage> storageRepository,
                          StorageNameRepository storageNameRepository,
                          CriteriaRepository <Operation> operationRepository,
                          CriteriaRepository <OperationSimple> operationSimpleRepository,
                          NomenclatureRepository nomenRepository)
 {
     Check.Require(remainsRepository != null, "RemainsRepository may not be null");
     this.remainsRepository         = remainsRepository;
     this.storageRepository         = storageRepository;
     this.storageNameRepository     = storageNameRepository;
     this.nomenRepository           = nomenRepository;
     this.operationRepository       = operationRepository;
     this.operationSimpleRepository = operationSimpleRepository;
 }
示例#20
0
        public IEntityAutocompleteSelectorFactory GetDefaultNomenclatureSelectorFactory()
        {
            var filter = new NomenclatureFilterViewModel();

            INomenclatureRepository nomenclatureRepository = new NomenclatureRepository(
                new NomenclatureParametersProvider(
                    new ParametersProvider()));

            IUserRepository userRepository = new UserRepository();

            var counterpartySelectorFactory = new CounterpartyJournalFactory();

            return(new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                             filter, counterpartySelectorFactory.CreateCounterpartyAutocompleteSelectorFactory(),
                                                                                                             nomenclatureRepository, userRepository));
        }
示例#21
0
        private void ReloadReturnedToWarehouse()
        {
            allReturnsToWarehouse = RouteListRepository.GetReturnsToWarehouse(UoW, Entity.Id, Nomenclature.GetCategoriesForShipment());
            var returnedBottlesNom = Int32.Parse(MainSupport.BaseParameters.All["returned_bottle_nomenclature_id"]);

            bottlesReturnedToWarehouse = (int)RouteListRepository.GetReturnsToWarehouse(
                UoW,
                Entity.Id,
                returnedBottlesNom)
                                         .Sum(item => item.Amount);

            defectiveBottlesReturnedToWarehouse = (int)RouteListRepository.GetReturnsToWarehouse(
                UoW,
                Entity.Id,
                NomenclatureRepository.NomenclatureOfDefectiveGoods(UoW).Select(n => n.Id).ToArray())
                                                  .Sum(item => item.Amount);
        }
示例#22
0
        public DataParserWorkwearItems(
            NomenclatureRepository nomenclatureRepository,
            PostRepository postRepository,
            NormRepository normRepository,
            SizeService sizeService)
        {
            AddColumnName(DataTypeWorkwearItems.PersonnelNumber,
                          "Табельный номер"
                          );
            AddColumnName(DataTypeWorkwearItems.ProtectionTools,
                          "Номенклатура нормы"
                          );
            AddColumnName(DataTypeWorkwearItems.Nomenclature,
                          "Номенклатура"
                          );
            AddColumnName(DataTypeWorkwearItems.Subdivision,
                          "Подразделение"
                          );
            AddColumnName(DataTypeWorkwearItems.Post,
                          "Должность"
                          );
            AddColumnName(DataTypeWorkwearItems.Size,
                          "Размер",
                          "Значение антропометрии"       //ОСМиБТ
                          );
            AddColumnName(DataTypeWorkwearItems.Growth,
                          "Рост"
                          );
            AddColumnName(DataTypeWorkwearItems.SizeAndGrowth,
                          "Характеристика"
                          );
            AddColumnName(DataTypeWorkwearItems.IssueDate,
                          "Дата выдачи"
                          );
            AddColumnName(DataTypeWorkwearItems.Count,
                          "Количество",
                          "Кол-во"
                          );

            this.nomenclatureRepository = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.postRepository         = postRepository ?? throw new ArgumentNullException(nameof(postRepository));
            this.normRepository         = normRepository ?? throw new ArgumentNullException(nameof(normRepository));
            this.sizeService            = sizeService ?? throw new ArgumentNullException(nameof(sizeService));
        }
示例#23
0
        public override bool Save()
        {
            if (String.IsNullOrWhiteSpace(Entity.Code1c))
            {
                Entity.Code1c = NomenclatureRepository.GetNextCode1c(UoW);
            }

            var valid = new QSValidator <Nomenclature>(UoWGeneric.Root);

            if (valid.RunDlgIfNotValid((Gtk.Window) this.Toplevel))
            {
                return(false);
            }
            logger.Info("Сохраняем номенклатуру...");
            Entity.SetNomenclatureCreationInfo(UserSingletonRepository.GetInstance());
            pricesView.SaveChanges();
            UoWGeneric.Save();
            return(true);
        }
示例#24
0
        public override bool Save()
        {
            var valid = new QSValidation.QSValidator <SelfDeliveryDocument>(UoWGeneric.Root);

            if (valid.RunDlgIfNotValid((Gtk.Window) this.Toplevel))
            {
                return(false);
            }

            Entity.LastEditor     = Repository.EmployeeRepository.GetEmployeeForCurrentUser(UoW);
            Entity.LastEditedTime = DateTime.Now;
            if (Entity.LastEditor == null)
            {
                MessageDialogWorks.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете изменять складские документы, так как некого указывать в качестве кладовщика.");
                return(false);
            }

            Entity.UpdateOperations(UoW);
            foreach (GoodsReceptionVMNode item in BottlesReceptionList)
            {
                Entity.UpdateReturnedOperation(UoW, item.NomenclatureId, item.Amount);
                var defBottle = NomenclatureRepository.GetDefaultBottle(UoW);
                if (item.NomenclatureId == defBottle.Id)
                {
                    Entity.Order.ReturnedTare = item.Amount;
                }
            }
            foreach (GoodsReceptionVMNode item in GoodsReceptionList)
            {
                Entity.UpdateReturnedOperation(UoW, item.NomenclatureId, item.Amount);
            }
            if (Entity.FullyShiped(UoW))
            {
                MessageDialogWorks.RunInfoDialog("Заказ отгружен полностью.");
            }

            logger.Info("Сохраняем документ самовывоза...");
            UoWGeneric.Save();
            logger.Info("Ok.");
            return(true);
        }
        public IEntityAutocompleteSelectorFactory CreateCashSelfDeliveryOrderAutocompleteSelector()
        {
            var subdivisionJournalFactory   = new SubdivisionJournalFactory();
            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            return(new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(
                       typeof(Order),
                       () =>
            {
                var filter = new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory);
                filter.SetAndRefilterAtOnce(
                    x => x.RestrictStatus = OrderStatus.WaitForPayment,
                    x => x.AllowPaymentTypes = new[] { PaymentType.cash },
                    x => x.RestrictOnlySelfDelivery = true,
                    x => x.RestrictWithoutSelfDelivery = false,
                    x => x.RestrictHideService = true,
                    x => x.RestrictOnlyService = false);

                return new OrderJournalViewModel(
                    filter,
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices,
                    VodovozGtkServicesConfig.EmployeeService,
                    nomenclatureRepository,
                    userRepository,
                    new OrderSelectorFactory(),
                    new EmployeeJournalFactory(),
                    counterpartyJournalFactory,
                    new DeliveryPointJournalFactory(),
                    subdivisionJournalFactory,
                    new GtkTabsOpener(),
                    new UndeliveredOrdersJournalOpener(),
                    new NomenclatureJournalFactory(),
                    new UndeliveredOrdersRepository(),
                    new SubdivisionRepository(new ParametersProvider()),
                    new FileDialogService());
            }));
        }
示例#26
0
        public NomenclaturesJournalViewModel CreateNomenclaturesJournalViewModel(bool multiselect = false)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            var nomenclatureRepository     = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository             = new UserRepository();
            var counterpartyJournalFactory = new CounterpartyJournalFactory();

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                new NomenclatureJournalFactory(),
                counterpartyJournalFactory,
                nomenclatureRepository,
                userRepository
                );

            vm.SelectionMode = multiselect ? JournalSelectionMode.Multiple : JournalSelectionMode.Single;
            return(vm);
        }
示例#27
0
 public UnitOfWork(VegaContext context)
 {
     _context             = context;
     Clients              = new ClientRepository(_context);
     Users                = new UserRepository(_context);
     Supplier             = new SupplierRepository(_context);
     Component            = new ComponentRepository(_context);
     ImportingInvoice     = new ImportingInvoiceRepository(_context);
     UGroup               = new GroupsRepository(_context);
     FabricationOrder     = new FabricationOrderRepository(_context);
     Expence              = new ExpenceRepository(_context);
     ExpenceCat           = new  ExpenceCatRepository(_context);
     GroupPermission      = new  GroupPermissionRepository(_context);
     Permission           = new PermissionRepository(_context);
     Sequence             = new SequenceRepository(_context);
     Nomenclature         = new NomenclatureRepository(_context);
     NomenclatureSequence = new NomenclatureSequenceRepository(_context);
     Color                = new ColorRepository(_context);
     SellingInvoices      = new SellingInvoicesRepository(_context);
     RawMaterials         = new RawMaterialsRepository(_context);
     UsedRawMaterial      = new UsedRawMaterialRepository(_context);
     ProgressionChecks    = new ProgressionChecksRepository(_context);
 }
示例#28
0
 protected void OnButtonAddPartClicked(object sender, EventArgs e)
 {
     OpenDialog(NomenclatureRepository.NomenclatureOfPartsForService());
 }
示例#29
0
 protected void OnButtonAddServiceClicked(object sender, EventArgs e)
 {
     OpenDialog(NomenclatureRepository.NomenclatureOfServices());
 }
示例#30
0
        void ConfigureDlg()
        {
            enumStatus.Sensitive         = enumType.Sensitive = false;
            enumStatusEditable.Sensitive = true;
            notebook1.ShowTabs           = false;
            notebook1.CurrentPage        = 0;

            enumcomboWithSerial.ItemsEnum = typeof(ServiceClaimEquipmentSerialType);
            enumcomboWithSerial.Binding.AddBinding(Entity, e => e.WithSerial, w => w.SelectedItem).InitializeFromSource();
            enumStatus.ItemsEnum = typeof(ServiceClaimStatus);
            enumStatus.Binding.AddBinding(Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();
            enumType.ItemsEnum = typeof(ServiceClaimType);
            enumType.Binding.AddBinding(Entity, e => e.ServiceClaimType, w => w.SelectedItem).InitializeFromSource();
            enumPaymentType.ItemsEnum = typeof(PaymentType);
            enumPaymentType.Binding.AddBinding(Entity, e => e.Payment, w => w.SelectedItem).InitializeFromSource();

            checkRepeated.Binding.AddBinding(Entity, e => e.RepeatedService, w => w.Active).InitializeFromSource();
            dataNumber.Binding.AddBinding(Entity, e => e.Id, w => w.LabelProp, new IdToStringConverter()).InitializeFromSource();
            labelTotalPrice.Binding.AddFuncBinding(Entity, e => e.TotalPrice.ToString("C"), w => w.LabelProp).InitializeFromSource();
            datePickUpDate.Binding.AddBinding(Entity, e => e.ServiceStartDate, w => w.Date).InitializeFromSource();
            textReason.Binding.AddBinding(Entity, e => e.Reason, w => w.Buffer.Text).InitializeFromSource();
            textKit.Binding.AddBinding(Entity, e => e.Kit, w => w.Buffer.Text).InitializeFromSource();
            textDiagnosticsResult.Binding.AddBinding(Entity, e => e.DiagnosticsResult, w => w.Buffer.Text).InitializeFromSource();

            referenceCounterparty.RepresentationModel = new ViewModel.CounterpartyVM(new CounterpartyFilter(UoW));
            referenceCounterparty.Binding.AddBinding(Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();

            referenceEngineer.RepresentationModel = new EmployeesVM(new EmployeeFilter(UoW));
            referenceEngineer.Binding.AddBinding(Entity, e => e.Engineer, w => w.Subject).InitializeFromSource();

            yentryEquipmentReplacement.ItemsQuery = EquipmentRepository.AvailableOnDutyEquipmentQuery();
            yentryEquipmentReplacement.SetObjectDisplayFunc <Equipment> (e => e.Title);
            yentryEquipmentReplacement.Binding
            .AddBinding(UoWGeneric.Root, serviceClaim => serviceClaim.ReplacementEquipment, widget => widget.Subject)
            .InitializeFromSource();

            referenceDeliveryPoint.Sensitive = (UoWGeneric.Root.Counterparty != null);
            referenceDeliveryPoint.Binding.AddBinding(Entity, e => e.DeliveryPoint, w => w.Subject).InitializeFromSource();

            referenceNomenclature.ItemsQuery = NomenclatureRepository.NomenclatureOfItemsForService();
            referenceNomenclature.Binding.AddBinding(Entity, e => e.Nomenclature, w => w.Subject).InitializeFromSource();

            referenceEquipment.SubjectType = typeof(Equipment);
            referenceEquipment.Sensitive   = (UoWGeneric.Root.Nomenclature != null);
            referenceEquipment.Binding.AddBinding(Entity, e => e.Equipment, w => w.Subject).InitializeFromSource();

            treePartsAndServices.ItemsDataSource = UoWGeneric.Root.ObservableServiceClaimItems;
            treeHistory.ItemsDataSource          = UoWGeneric.Root.ObservableServiceClaimHistory;

            treePartsAndServices.ColumnsConfig = FluentColumnsConfig <ServiceClaimItem> .Create()
                                                 .AddColumn("Номенклатура").SetDataProperty(node => node.Nomenclature != null ? node.Nomenclature.Name : "-")
                                                 .AddColumn("Кол-во").AddNumericRenderer(node => node.Count)
                                                 .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                                 .AddSetter((c, node) => c.Digits = node.Nomenclature.Unit == null ? 0 : (uint)node.Nomenclature.Unit.Digits)
                                                 .AddSetter((c, i) => c.Editable  = isEditable)
                                                 .WidthChars(10)
                                                 .AddColumn("Цена").AddNumericRenderer(node => node.Price).Digits(2)
                                                 .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                                 .AddColumn("Сумма").AddNumericRenderer(node => node.Total).Digits(2)
                                                 .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                                 .Finish();

            treeHistory.ColumnsConfig = FluentColumnsConfig <ServiceClaimHistory> .Create()
                                        .AddColumn("Дата").SetDataProperty(node => node.Date.ToShortDateString())
                                        .AddColumn("Время").SetDataProperty(node => node.Date.ToString("HH:mm"))
                                        .AddColumn("Статус").SetDataProperty(node => node.Status.GetEnumTitle())
                                        .AddColumn("Сотрудник").SetDataProperty(node => node.Employee == null ? " - " : node.Employee.FullName)
                                        .AddColumn("Комментарий").SetDataProperty(node => node.Comment)
                                        .Finish();

            UoWGeneric.Root.ObservableServiceClaimItems.ElementChanged += (aList, aIdx) => FixPrice(aIdx [0]);
            configureAvailableNextStatus();
            Entity.PropertyChanged += Entity_PropertyChanged;

            if (UoWGeneric.Root.ServiceClaimType == ServiceClaimType.JustService)
            {
                referenceDeliveryPoint.Visible     = false;
                labelDeliveryPoint.Visible         = false;
                yentryEquipmentReplacement.Visible = false;
                labelReplacement.Visible           = false;
            }
            datePickUpDate.IsEditable = Entity.InitialOrder == null;
            Menu menu            = new Menu();
            var  menuItemInitial = new MenuItem("Перейти к начальному заказу");

            menuItemInitial.Sensitive  = Entity.InitialOrder != null;
            menuItemInitial.Activated += MenuInitialOrderActivated;
            menu.Add(menuItemInitial);
            var menuItemFinal = new MenuItem("Перейти к финальному заказу");

            menuItemFinal.Sensitive  = Entity.FinalOrder != null;
            menuItemFinal.Activated += MenuFinalOrderActivated;
            menu.Add(menuItemFinal);
            menuActions.Menu = menu;
            menu.ShowAll();
        }