コード例 #1
0
        public EmployeesJournalViewModel CreateWorkingForwarderEmployeeJournal()
        {
            CreateNewDependencies();

            var forwarderFilter = new EmployeeFilterViewModel
            {
                HidenByDefault = true,
            };

            forwarderFilter.SetAndRefilterAtOnce(
                x => x.Status   = EmployeeStatus.IsWorking,
                x => x.Category = EmployeeCategory.forwarder);

            return(new EmployeesJournalViewModel(
                       forwarderFilter,
                       _authorizationServiceFactory,
                       _employeeWageParametersFactory,
                       _employeeJournalFactory,
                       _subdivisionJournalFactory,
                       _employeePostsJournalFactory,
                       _cashDistributionCommonOrganisationProvider,
                       _subdivisionService,
                       _emailServiceSettingAdapter,
                       _wageCalculationRepository,
                       _employeeRepository,
                       _warehouseRepository,
                       _routeListRepository,
                       CurrentUserSettings.Settings,
                       _validationContextFactory,
                       _phonesViewModelFactory,
                       _driverApiUserRegisterEndpoint,
                       ServicesConfig.CommonServices,
                       UnitOfWorkFactory.GetDefaultFactory
                       ));
        }
コード例 #2
0
        public FuelReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filterDriver = new EmployeeFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            var driverFactory = new EmployeeJournalFactory(filterDriver);

            evmeDriver.SetEntityAutocompleteSelectorFactory(driverFactory.CreateEmployeeAutocompleteSelectorFactory());
            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(new CarJournalFactory(MainClass.MainWin.NavigationManager).CreateCarAutocompleteSelectorFactory());
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            var officeFilter = new EmployeeFilterViewModel();

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

            evmeAuthor.SetEntityAutocompleteSelectorFactory(officeFactory.CreateEmployeeAutocompleteSelectorFactory());
            dateperiodpicker.StartDate  = dateperiodpicker.EndDate = DateTime.Today;
            buttonCreateReport.Clicked += OnButtonCreateReportClicked;
        }
コード例 #3
0
        public DriverWagesReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var driverFilter = new EmployeeFilterViewModel();

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

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeDriver.Changed += (sender, args) =>
            {
                if (dateperiodpicker.StartDateOrNull.HasValue && evmeDriver.Subject is Employee)
                {
                    OnUpdate(true);
                }
            };

            dateperiodpicker.PeriodChanged += (sender, args) =>
            {
                if (evmeDriver.Subject is Employee && dateperiodpicker.StartDateOrNull.HasValue)
                {
                    OnUpdate(true);
                }
            };
            buttonCreateReport.Clicked += OnButtonCreateReportClicked;
        }
コード例 #4
0
        private void ConfigureBindings()
        {
            ylabelCreationDate.Binding.AddFuncBinding(ViewModel.Entity, e => e.CreationDate.ToString("g"), w => w.LabelProp).InitializeFromSource();
            ylabelAuthor.Binding.AddFuncBinding(ViewModel.Entity, e => e.Author != null ? e.Author.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelStatus.Binding.AddFuncBinding(ViewModel.Entity, e => e.Status.GetEnumTitle(), w => w.LabelProp).InitializeFromSource();
            yspinMoney.Binding.AddBinding(ViewModel.Entity, e => e.TransferedSum, w => w.ValueAsDecimal).InitializeFromSource();
            yspinMoney.Binding.AddBinding(ViewModel, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();

            var filterDriver = new EmployeeFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.Status = EmployeeStatus.IsWorking
                );
            entryDriver.RepresentationModel = new EmployeesVM(filterDriver);
            entryDriver.Binding.AddBinding(ViewModel.Entity, e => e.Driver, w => w.Subject).InitializeFromSource();
            entryDriver.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(ViewModel.Entity, x => x.Car, x => x.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            comboboxCashSubdivisionFrom.SetRenderTextFunc <Subdivision>(s => s.Name);
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsFrom, w => w.ItemsList).InitializeFromSource();
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel.Entity, e => e.CashSubdivisionFrom, w => w.SelectedItem).InitializeFromSource();

            comboboxCashSubdivisionTo.SetRenderTextFunc <Subdivision>(s => s.Name);
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsTo, w => w.ItemsList).InitializeFromSource();
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel.Entity, e => e.CashSubdivisionTo, w => w.SelectedItem).InitializeFromSource();

            comboExpenseCategory.SetRenderTextFunc <ExpenseCategory>(s => s.Name);
            comboExpenseCategory.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategories, w => w.ItemsList).InitializeFromSource();
            comboExpenseCategory.Binding.AddBinding(ViewModel.Entity, e => e.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();
            comboExpenseCategory.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            comboIncomeCategory.SetRenderTextFunc <IncomeCategory>(s => s.Name);
            comboIncomeCategory.Binding.AddBinding(ViewModel, vm => vm.IncomeCategories, w => w.ItemsList).InitializeFromSource();
            comboIncomeCategory.Binding.AddBinding(ViewModel.Entity, e => e.IncomeCategory, w => w.SelectedItem).InitializeFromSource();
            comboIncomeCategory.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ylabelCashierSender.Binding.AddFuncBinding(ViewModel.Entity, e => e.CashierSender != null ? e.CashierSender.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelCashierReceiver.Binding.AddFuncBinding(ViewModel.Entity, e => e.CashierReceiver != null ? e.CashierReceiver.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelSendTime.Binding.AddFuncBinding(ViewModel.Entity, e => e.SendTime.HasValue ? e.SendTime.Value.ToString("g") : "", w => w.LabelProp).InitializeFromSource();
            ylabelReceiveTime.Binding.AddFuncBinding(ViewModel.Entity, e => e.ReceiveTime.HasValue ? e.ReceiveTime.Value.ToString("g") : "", w => w.LabelProp).InitializeFromSource();

            ytextviewComment.Binding.AddBinding(ViewModel.Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();
            ytextviewComment.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ViewModel.SendCommand.CanExecuteChanged += (sender, e) => {
                buttonSend.Sensitive = ViewModel.SendCommand.CanExecute();
            };

            ViewModel.ReceiveCommand.CanExecuteChanged += (sender, e) => {
                buttonReceive.Sensitive = ViewModel.ReceiveCommand.CanExecute();
            };

            buttonPrint.Sensitive = ViewModel.PrintCommand.CanExecute();
        }
コード例 #5
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;
        }
コード例 #6
0
        protected override void ConfigureWithUow()
        {
            enumcomboDocumentType.ItemsEnum   = typeof(DocumentType);
            enumcomboDocumentType.HiddenItems = new[] { DocumentType.DeliveryDocument as object };

            evmeWarehouse.SetEntityAutocompleteSelectorFactory(new WarehouseSelectorFactory());

            if (ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !ServicesConfig.CommonServices.UserService.GetCurrentUser(UoW).IsAdmin)
            {
                evmeWarehouse.Sensitive = evmeWarehouse.CanEditReference = false;
            }

            if (CurrentUserSettings.Settings.DefaultWarehouse != null)
            {
                evmeWarehouse.Subject = UoW.GetById <Warehouse>(CurrentUserSettings.Settings.DefaultWarehouse.Id);
            }

            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            var driverFactory = new EmployeeJournalFactory(filter);

            evmeDriver.SetEntityAutocompleteSelectorFactory(driverFactory.CreateEmployeeAutocompleteSelectorFactory());
            dateperiodDocs.StartDate = DateTime.Today.AddDays(-7);
            dateperiodDocs.EndDate   = DateTime.Today.AddDays(1);

            comboMovementStatus.ItemsEnum = typeof(MovementDocumentStatus);
            evmeDriver.Changed           += (sender, args) => OnRefiltered();
            evmeWarehouse.Changed        += (sender, args) => OnRefiltered();
        }
コード例 #7
0
 void LstCmbPlanType_Changed(object sender, EventArgs e)
 {
     filter.SetAndRefilterAtOnce(
         x => x.RestrictCategory = EmployeeCategory.office,
         x => x.Status           = EmployeeStatus.IsWorking,
         x => x.RestrictWageParameterItemType = lstCmbPlanType.SelectedItem as WageParameterItemTypes?
         );
 }
コード例 #8
0
        protected override void ConfigureWithUow()
        {
            yentryExpense.ItemsQuery = Repository.Cash.CategoryRepository.ExpenseCategoriesQuery();

            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(x => x.Status = EmployeeStatus.IsWorking);
            repEntryAccountable.RepresentationModel   = new EmployeesVM(filter);
        }
コード例 #9
0
        protected void OnRadioCatAllToggled(object sender, EventArgs e)
        {
            var filter = new EmployeeFilterViewModel();

            if (radioCatDriver.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.driver);
            }

            if (radioCatForwarder.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.forwarder);
            }

            if (radioCatOffice.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.office);
            }
            yentryDriver.RepresentationModel = new EmployeesVM();
        }
コード例 #10
0
        public OrderCreationDateReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.office,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yEntRefEmployee.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #11
0
        public MastersReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryreferenceDriver.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #12
0
        public ShortfallBattlesReport()
        {
            this.Build();
            ydatepicker.Date         = DateTime.Now.Date;
            comboboxDriver.ItemsEnum = typeof(Drivers);
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryDriver.RepresentationModel  = new EmployeesVM(filter);
            ySpecCmbNonReturnReason.ItemsList = UoW.Session.QueryOver <NonReturnReason>().List();
        }
コード例 #13
0
        public OrderCreationDateReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var officeFilter = new EmployeeFilterViewModel();

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

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            datePeriodPicker.PeriodChanged += (sender, e) => CanRun();
            buttonCreateReport.Clicked     += (sender, e) => OnUpdate(true);
        }
コード例 #14
0
        public EmployeesJournalViewModel CreateWorkingForwarderEmployeeJournal()
        {
            CreateNewDependencies();

            var forwarderFilter = new EmployeeFilterViewModel
            {
                HidenByDefault = true,
            };

            forwarderFilter.SetAndRefilterAtOnce(
                x => x.Status   = EmployeeStatus.IsWorking,
                x => x.Category = EmployeeCategory.forwarder);

            return(CreateEmployeesJournal(forwarderFilter));
        }
コード例 #15
0
        public MastersReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var driverFilter = new EmployeeFilterViewModel();

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

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeDriver.Changed             += (sender, e) => CanRun();
            dateperiodpicker.PeriodChanged += (sender, e) => CanRun();
            buttonCreateReport.Clicked     += (sender, e) => OnUpdate(true);
        }
コード例 #16
0
        public MastersVisitReport(IEmployeeJournalFactory employeeJournalFactory)
        {
            if (employeeJournalFactory == null)
            {
                throw new ArgumentNullException(nameof(employeeJournalFactory));
            }

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var driversFilter = new EmployeeFilterViewModel();

            driversFilter.SetAndRefilterAtOnce(
                x => x.Category = EmployeeCategory.driver,
                x => x.Status   = null);
            employeeJournalFactory.SetEmployeeFilterViewModel(driversFilter);
            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());
        }
コード例 #17
0
        public ShortfallBattlesReport()
        {
            this.Build();
            ydatepicker.Date         = DateTime.Now.Date;
            comboboxDriver.ItemsEnum = typeof(Drivers);
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            var driverFactory = new EmployeeJournalFactory(filter);

            evmeDriver.SetEntityAutocompleteSelectorFactory(driverFactory.CreateEmployeeAutocompleteSelectorFactory());
            ySpecCmbNonReturnReason.ItemsList = UoW.Session.QueryOver <NonReturnReason>().List();
            buttonCreateRepot.Clicked        += (s, a) => OnUpdate(true);
            checkOneDriver.Toggled           += OnCheckOneDriverToggled;
        }
コード例 #18
0
ファイル: CarProxyDlg.cs プロジェクト: RoAr80/Vodovoz
        void ConfigureDlg()
        {
            if (Entity.EmployeeDocument == null && Entity.Driver != null)
            {
                GetDocument();
            }

            ylabelNumber.Binding.AddBinding(Entity, x => x.Title, x => x.LabelProp).InitializeFromSource();

            yentryOrganization.SubjectType = typeof(Organization);
            yentryOrganization.Binding.AddBinding(Entity, x => x.Organization, x => x.Subject).InitializeFromSource();
            yentryOrganization.Changed += (sender, e) => {
                UpdateStates();
            };

            var filterDefaultForwarder = new EmployeeFilterViewModel();

            filterDefaultForwarder.Status = EmployeeStatus.IsWorking;
            filterDefaultForwarder.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.driver);
            yentryDriver.RepresentationModel = new EmployeesVM(filterDefaultForwarder);
            yentryDriver.Binding.AddBinding(Entity, x => x.Driver, x => x.Subject).InitializeFromSource();
            yentryDriver.Changed += (sender, e) => {
                UpdateStates();
            };

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(Entity, x => x.Car, x => x.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Changed += (sender, e) => {
                UpdateStates();
            };

            RefreshParserRootObject();

            templatewidget.CanRevertCommon = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_set_common_additionalagreement");
            templatewidget.Binding.AddBinding(Entity, e => e.DocumentTemplate, w => w.Template).InitializeFromSource();
            templatewidget.Binding.AddBinding(Entity, e => e.ChangedTemplateFile, w => w.ChangedDoc).InitializeFromSource();
            templatewidget.BeforeOpen += Templatewidget_BeforeOpen;

            UpdateStates();
        }
コード例 #19
0
        public IEntityAutocompleteSelectorFactory CreateWorkingOfficeEmployeeAutocompleteSelectorFactory()
        {
            CreateNewDependencies();

            return(new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(
                       typeof(Employee),
                       () =>
            {
                var officeFilter = new EmployeeFilterViewModel
                {
                    HidenByDefault = true,
                };

                officeFilter.SetAndRefilterAtOnce(
                    x => x.Status = EmployeeStatus.IsWorking,
                    x => x.Category = EmployeeCategory.office);

                return CreateEmployeesJournal(officeFilter);
            }
                       ));
        }
コード例 #20
0
        public DefectiveItemsReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            yEnumCmbSource.ItemsEnum = typeof(DefectSource);
            yEnumCmbSource.AddEnumToHideList(new Enum[] { DefectSource.None });

            var driverFilter = new EmployeeFilterViewModel();

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

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());

            datePeriod.StartDate      = datePeriod.EndDate = DateTime.Today;
            buttonRun.Clicked        += (sender, e) => OnUpdate(true);
            datePeriod.PeriodChanged += (sender, e) => ValidateParameters();
        }
コード例 #21
0
        void ConfigureDlg()
        {
            if (Entity.EmployeeDocument == null && Entity.Driver != null)
            {
                GetDocument();
            }

            ylabelNumber.Binding.AddBinding(Entity, x => x.Title, x => x.LabelProp).InitializeFromSource();

            var orgFactory = new OrganizationJournalFactory();

            evmeOrganisation.SetEntityAutocompleteSelectorFactory(orgFactory.CreateOrganizationAutocompleteSelectorFactory());
            evmeOrganisation.Binding.AddBinding(Entity, x => x.Organization, x => x.Subject).InitializeFromSource();
            evmeOrganisation.Changed += (sender, e) => UpdateStates();

            var driverFilter = new EmployeeFilterViewModel();

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

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeDriver.Binding.AddBinding(Entity, x => x.Driver, x => x.Subject).InitializeFromSource();
            evmeDriver.Changed += (sender, e) => UpdateStates();

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(new CarJournalFactory(MainClass.MainWin.NavigationManager).CreateCarAutocompleteSelectorFactory());
            entityviewmodelentryCar.Binding.AddBinding(Entity, x => x.Car, x => x.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Changed += (sender, e) => UpdateStates();

            RefreshParserRootObject();

            templatewidget.CanRevertCommon = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_set_common_additionalagreement");
            templatewidget.Binding.AddBinding(Entity, e => e.DocumentTemplate, w => w.Template).InitializeFromSource();
            templatewidget.Binding.AddBinding(Entity, e => e.ChangedTemplateFile, w => w.ChangedDoc).InitializeFromSource();
            templatewidget.BeforeOpen += Templatewidget_BeforeOpen;

            UpdateStates();
        }
コード例 #22
0
        protected override void ConfigureWithUow()
        {
            enumcomboDocumentType.ItemsEnum   = typeof(DocumentType);
            enumcomboDocumentType.HiddenItems = new[] { DocumentType.DeliveryDocument as object };

            yentryrefWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery();
            if (CurrentUserSettings.Settings.DefaultWarehouse != null)
            {
                yentryrefWarehouse.Subject = UoW.GetById <Warehouse>(CurrentUserSettings.Settings.DefaultWarehouse.Id);
            }
            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryrefDriver.RepresentationModel = new EmployeesVM(filter);
            dateperiodDocs.StartDate            = DateTime.Today.AddDays(-7);
            dateperiodDocs.EndDate = DateTime.Today.AddDays(1);

            comboMovementStatus.ItemsEnum = typeof(MovementDocumentStatus);
        }
コード例 #23
0
ファイル: FuelReport.cs プロジェクト: Mokrynskiy/Vodovoz
        public FuelReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filterDriver = new EmployeeFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryreferenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.office,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryAuthor.RepresentationModel = new EmployeesVM(filter);
            dateperiodpicker.StartDate       = dateperiodpicker.EndDate = DateTime.Today;
        }
コード例 #24
0
ファイル: RouteListKeepingDlg.cs プロジェクト: RoAr80/Vodovoz
        public void ConfigureDlg()
        {
            Entity.ObservableAddresses.ElementAdded   += ObservableAddresses_ElementAdded;
            Entity.ObservableAddresses.ElementRemoved += ObservableAddresses_ElementRemoved;
            Entity.ObservableAddresses.ElementChanged += ObservableAddresses_ElementChanged;;

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Sensitive = logisticanEditing;

            var filterDriver = new EmployeeFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            referenceDriver.Binding.AddBinding(Entity, rl => rl.Driver, widget => widget.Subject).InitializeFromSource();
            referenceDriver.Sensitive = logisticanEditing;
            var filterForwarder = new EmployeeFilterViewModel();

            filterForwarder.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.forwarder,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceForwarder.RepresentationModel = new EmployeesVM(filterForwarder);
            referenceForwarder.Binding.AddBinding(Entity, rl => rl.Forwarder, widget => widget.Subject).InitializeFromSource();
            referenceForwarder.Sensitive = logisticanEditing;
            referenceForwarder.Changed  += ReferenceForwarder_Changed;

            referenceLogistican.RepresentationModel = new EmployeesVM();
            referenceLogistican.Binding.AddBinding(Entity, rl => rl.Logistician, widget => widget.Subject).InitializeFromSource();
            referenceLogistican.Sensitive = logisticanEditing;

            speccomboShift.ItemsList = DeliveryShiftRepository.ActiveShifts(UoW);
            speccomboShift.Binding.AddBinding(Entity, rl => rl.Shift, widget => widget.SelectedItem).InitializeFromSource();
            speccomboShift.Sensitive = logisticanEditing;

            datePickerDate.Binding.AddBinding(Entity, rl => rl.Date, widget => widget.Date).InitializeFromSource();
            datePickerDate.Sensitive = logisticanEditing;

            ylabelLastTimeCall.Binding.AddFuncBinding(Entity, e => GetLastCallTime(e.LastCallTime), w => w.LabelProp).InitializeFromSource();
            yspinActualDistance.Sensitive = allEditing;

            buttonMadeCall.Sensitive = allEditing;

            buttonRetriveEnRoute.Sensitive = Entity.Status == RouteListStatus.OnClosing && isUserLogist &&
                                             ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_retrieve_routelist_en_route");

            buttonNewFine.Sensitive = allEditing;

            buttonRefresh.Sensitive = allEditing;

            //Заполняем иконки
            var ass = Assembly.GetAssembly(typeof(MainClass));

            statusIcons.Add(RouteListItemStatus.EnRoute, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.car.png"));
            statusIcons.Add(RouteListItemStatus.Completed, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-smile-grin.png"));
            statusIcons.Add(RouteListItemStatus.Overdue, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-angry.png"));
            statusIcons.Add(RouteListItemStatus.Canceled, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-crying.png"));
            statusIcons.Add(RouteListItemStatus.Transfered, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-uncertain.png"));

            ytreeviewAddresses.ColumnsConfig = ColumnsConfigFactory.Create <RouteListKeepingItemNode>()
                                               .AddColumn("№ п/п").AddNumericRenderer(x => x.RouteListItem.IndexInRoute + 1)
                                               .AddColumn("Заказ")
                                               .AddTextRenderer(node => node.RouteListItem.Order.Id.ToString())
                                               .AddColumn("Адрес")
                                               .AddTextRenderer(node => node.RouteListItem.Order.DeliveryPoint == null ? "Требуется точка доставки" : node.RouteListItem.Order.DeliveryPoint.ShortAddress)
                                               .AddColumn("Время")
                                               .AddTextRenderer(node => node.RouteListItem.Order.DeliverySchedule == null ? "" : node.RouteListItem.Order.DeliverySchedule.Name)
                                               .AddColumn("Статус")
                                               .AddPixbufRenderer(x => statusIcons[x.Status])
                                               .AddEnumRenderer(node => node.Status, excludeItems: new Enum[] { RouteListItemStatus.Transfered })
                                               .AddSetter((c, n) => c.Editable = allEditing && n.Status != RouteListItemStatus.Transfered)
                                               .AddColumn("Отгрузка")
                                               .AddNumericRenderer(node => node.RouteListItem.Order.OrderItems
                                                                   .Where(b => b.Nomenclature.Category == NomenclatureCategory.water && b.Nomenclature.TareVolume == TareVolume.Vol19L)
                                                                   .Sum(b => b.Count))
                                               .AddColumn("Возврат тары")
                                               .AddNumericRenderer(node => node.RouteListItem.Order.BottlesReturn)
                                               .AddColumn("Сдали по факту")
                                               .AddNumericRenderer(node => node.RouteListItem.DriverBottlesReturned)
                                               .AddColumn("Статус изменен")
                                               .AddTextRenderer(node => node.LastUpdate)
                                               .AddColumn("Комментарий")
                                               .AddTextRenderer(node => node.Comment)
                                               .Editable(allEditing)
                                               .AddColumn("Переносы")
                                               .AddTextRenderer(node => node.Transferred)
                                               .RowCells()
                                               .AddSetter <CellRenderer>((cell, node) => cell.CellBackgroundGdk = node.RowColor)
                                               .Finish();
            ytreeviewAddresses.Selection.Mode     = SelectionMode.Multiple;
            ytreeviewAddresses.Selection.Changed += OnSelectionChanged;
            ytreeviewAddresses.Sensitive          = allEditing;
            ytreeviewAddresses.RowActivated      += YtreeviewAddresses_RowActivated;

            //Point!
            //Заполняем телефоны

            if (Entity.Driver != null && Entity.Driver.Phones.Count > 0)
            {
                uint rows = Convert.ToUInt32(Entity.Driver.Phones.Count + 1);
                PhonesTable1.Resize(rows, 2);
                Label label = new Label();
                label.LabelProp = $"{Entity.Driver.FullName}";
                PhonesTable1.Attach(label, 0, 2, 0, 1);

                for (uint i = 1; i < rows; i++)
                {
                    Label l = new Label();
                    l.LabelProp = "+7 " + Entity.Driver.Phones[Convert.ToInt32(i - 1)].Number;
                    PhonesTable1.Attach(l, 0, 1, i, i + 1);

                    HandsetView h = new HandsetView(Entity.Driver.Phones[Convert.ToInt32(i - 1)].DigitsNumber);
                    PhonesTable1.Attach(h, 1, 2, i, i + 1);
                }
            }
            if (Entity.Forwarder != null && Entity.Forwarder.Phones.Count > 0)
            {
                uint rows = Convert.ToUInt32(Entity.Forwarder.Phones.Count + 1);
                PhonesTable2.Resize(rows, 2);
                Label label = new Label();
                label.LabelProp = $"{Entity.Forwarder.FullName}";
                PhonesTable2.Attach(label, 0, 2, 0, 1);

                for (uint i = 1; i < rows; i++)
                {
                    Label l = new Label();
                    l.LabelProp = "+7 " + Entity.Forwarder.Phones[Convert.ToInt32(i - 1)].Number;
                    PhonesTable2.Attach(l, 0, 1, i, i + 1);

                    HandsetView h = new HandsetView(Entity.Forwarder.Phones[Convert.ToInt32(i - 1)].DigitsNumber);
                    PhonesTable2.Attach(h, 1, 2, i, i + 1);
                }
            }

            //Телефон
            PhonesTable1.ShowAll();
            PhonesTable2.ShowAll();

            phoneLogistican.MangoManager = phoneDriver.MangoManager = phoneForwarder.MangoManager = MainClass.MainWin.MangoManager;
            phoneLogistican.Binding.AddBinding(Entity, e => e.Logistician, w => w.Employee).InitializeFromSource();
            phoneDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Employee).InitializeFromSource();
            phoneForwarder.Binding.AddBinding(Entity, e => e.Forwarder, w => w.Employee).InitializeFromSource();

            //Заполняем информацию о бутылях
            UpdateBottlesSummaryInfo();

            UpdateNodes();
        }
コード例 #25
0
        public AtWorksDlg(
            IDefaultDeliveryDayScheduleSettings defaultDeliveryDayScheduleSettings,
            IEmployeeJournalFactory employeeJournalFactory,
            DriverApiUserRegisterEndpoint driverApiUserRegisterEndpoint,
            IGeographicGroupParametersProvider geographicGroupParametersProvider)
        {
            if (defaultDeliveryDayScheduleSettings == null)
            {
                throw new ArgumentNullException(nameof(defaultDeliveryDayScheduleSettings));
            }

            _employeeJournalFactory            = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _driverApiRegistrationEndpoint     = driverApiUserRegisterEndpoint ?? throw new ArgumentNullException(nameof(driverApiUserRegisterEndpoint));
            _geographicGroupParametersProvider = geographicGroupParametersProvider ?? throw new ArgumentNullException(nameof(geographicGroupParametersProvider));
            Build();

            var geographicGroups =
                _geographicGroupRepository.GeographicGroupsWithCoordinatesExceptEast(UoW, _geographicGroupParametersProvider);
            var colorWhite    = new Color(0xff, 0xff, 0xff);
            var colorLightRed = new Color(0xff, 0x66, 0x66);

            ytreeviewAtWorkDrivers.ColumnsConfig = FluentColumnsConfig <AtWorkDriver> .Create()
                                                   .AddColumn("Приоритет")
                                                   .AddNumericRenderer(x => x.PriorityAtDay)
                                                   .Editing(new Gtk.Adjustment(6, 1, 10, 1, 1, 1))
                                                   .AddColumn("Статус")
                                                   .AddTextRenderer(x => x.Status.GetEnumTitle())
                                                   .AddColumn("Причина")
                                                   .AddTextRenderer(x => x.Reason)
                                                   .AddSetter((cell, driver) => cell.Editable = driver.Status == AtWorkDriver.DriverStatus.NotWorking)
                                                   .AddColumn("Водитель")
                                                   .AddTextRenderer(x => x.Employee.ShortName)
                                                   .AddColumn("Скор.")
                                                   .AddTextRenderer(x => x.Employee.DriverSpeed.ToString("P0"))
                                                   .AddColumn("График работы")
                                                   .AddComboRenderer(x => x.DaySchedule)
                                                   .SetDisplayFunc(x => x.Name)
                                                   .FillItems(UoW.GetAll <DeliveryDaySchedule>().ToList())
                                                   .Editing()
                                                   .AddColumn("Оконч. работы")
                                                   .AddTextRenderer(x => x.EndOfDayText).Editable()
                                                   .AddColumn("Экспедитор")
                                                   .AddComboRenderer(x => x.WithForwarder)
                                                   .SetDisplayFunc(x => x.Employee.ShortName).Editing().Tag(Columns.Forwarder)
                                                   .AddColumn("Автомобиль")
                                                   .AddPixbufRenderer(x => x.Car != null && x.Car.GetActiveCarVersionOnDate(x.Date).CarOwnType == CarOwnType.Company ? vodovozCarIcon : null)
                                                   .AddTextRenderer(x => x.Car != null ? x.Car.RegistrationNumber : "нет")
                                                   .AddColumn("База")
                                                   .AddComboRenderer(x => x.GeographicGroup)
                                                   .SetDisplayFunc(x => x.Name)
                                                   .FillItems(geographicGroups)
                                                   .AddSetter(
                (c, n) => {
                c.Editable      = true;
                c.BackgroundGdk = n.GeographicGroup == null
                                                                ? colorLightRed
                                                                : colorWhite;
            }
                )
                                                   .AddColumn("Грузоп.")
                                                   .AddTextRenderer(x => x.Car != null ? x.Car.CarModel.MaxWeight.ToString("D") : null)
                                                   .AddColumn("Районы доставки")
                                                   .AddTextRenderer(x => string.Join(", ", x.DistrictsPriorities.Select(d => d.District.DistrictName)))
                                                   .AddColumn("")
                                                   .AddColumn("Комментарий")
                                                   .AddTextRenderer(x => x.Comment)
                                                   .Editable(true)
                                                   .RowCells().AddSetter <CellRendererText>((c, n) => c.Foreground = n.Status == AtWorkDriver.DriverStatus.NotWorking? "gray": "black")
                                                   .Finish();

            ytreeviewAtWorkDrivers.Selection.Mode     = Gtk.SelectionMode.Multiple;
            ytreeviewAtWorkDrivers.Selection.Changed += YtreeviewDrivers_Selection_Changed;

            ytreeviewOnDayForwarders.ColumnsConfig = FluentColumnsConfig <AtWorkForwarder> .Create()
                                                     .AddColumn("Экспедитор").AddTextRenderer(x => x.Employee.ShortName)
                                                     .AddColumn("Едет с водителем").AddTextRenderer(x => RenderForwaderWithDriver(x))
                                                     .Finish();

            ytreeviewOnDayForwarders.Selection.Mode     = Gtk.SelectionMode.Multiple;
            ytreeviewOnDayForwarders.Selection.Changed += YtreeviewForwarders_Selection_Changed;

            ydateAtWorks.Date = DateTime.Today;

            int currentUserId = ServicesConfig.CommonServices.UserService.CurrentUserId;

            canReturnDriver = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_return_driver_to_work", currentUserId);

            this.defaultDeliveryDaySchedule =
                UoW.GetById <DeliveryDaySchedule>(defaultDeliveryDayScheduleSettings.GetDefaultDeliveryDayScheduleId());

            _forwarderFilter = new EmployeeFilterViewModel();
            _forwarderFilter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.forwarder,
                x => x.CanChangeStatus  = true,
                x => x.Status           = EmployeeStatus.IsWorking);
        }
コード例 #26
0
        private void ConfigureDlg()
        {
            if (Entity.Id == 0)
            {
                Entity.OrganisationForSalary = commonOrganisationProvider.GetCommonOrganisation(UoW);
            }

            canManageDriversAndForwarders = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_drivers_and_forwarders");
            canManageOfficeWorkers        = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_office_workers");
            canEditOrganisationForSalary  = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_edit_organisation_for_salary");

            ConfigureCategory();
            ConfigureSubdivision();
            OnRussianCitizenToggled(null, EventArgs.Empty);
            dataentryDrivingNumber.MaxLength = 20;
            dataentryDrivingNumber.Binding.AddBinding(Entity, e => e.DrivingLicense, w => w.Text).InitializeFromSource();
            UoWGeneric.Root.PropertyChanged += OnPropertyChanged;
            notebookMain.Page        = 0;
            notebookMain.ShowTabs    = false;
            GenderComboBox.ItemsEnum = typeof(Gender);
            GenderComboBox.Binding.AddBinding(Entity, e => e.Gender, w => w.SelectedItemOrNull).InitializeFromSource();

            subdivisionService = SubdivisionParametersProvider.Instance;

            yenumcomboStatus.ItemsEnum = typeof(EmployeeStatus);
            yenumcomboStatus.Binding.AddBinding(Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();

            chkDriverForOneDay.Binding.AddBinding(Entity, e => e.IsDriverForOneDay, w => w.Active).InitializeFromSource();
            cmbDriverOf.ItemsEnum = typeof(CarTypeOfUse);
            cmbDriverOf.Binding.AddBinding(Entity, e => e.DriverOf, w => w.SelectedItemOrNull).InitializeFromSource();

            dataentryLastName.Binding.AddBinding(Entity, e => e.LastName, w => w.Text).InitializeFromSource();
            dataentryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            dataentryPatronymic.Binding.AddBinding(Entity, e => e.Patronymic, w => w.Text).InitializeFromSource();
            dataentryInnerPhone.Binding.AddBinding(Entity, e => e.InnerPhone, w => w.Text, new Gamma.Binding.Converters.NumbersToStringConverter()).InitializeFromSource();

            entryAddressCurrent.Binding.AddBinding(Entity, e => e.AddressCurrent, w => w.Text).InitializeFromSource();
            entryAddressRegistration.Binding.AddBinding(Entity, e => e.AddressRegistration, w => w.Text).InitializeFromSource();
            entryInn.Binding.AddBinding(Entity, e => e.INN, w => w.Text).InitializeFromSource();

            dataentryAndroidLogin.Binding.AddBinding(Entity, e => e.AndroidLogin, w => w.Text).InitializeFromSource();
            dataentryAndroidPassword.Binding.AddBinding(Entity, e => e.AndroidPassword, w => w.Text).InitializeFromSource();

            var filterDefaultForwarder = new EmployeeFilterViewModel();

            filterDefaultForwarder.SetAndRefilterAtOnce(
                x => x.Category = EmployeeCategory.forwarder,
                x => x.Status   = EmployeeStatus.IsWorking
                );
            repEntDefaultForwarder.RepresentationModel = new EmployeesVM(filterDefaultForwarder);
            repEntDefaultForwarder.Binding.AddBinding(Entity, e => e.DefaultForwarder, w => w.Subject).InitializeFromSource();

            referenceNationality.SubjectType = typeof(Nationality);
            referenceNationality.Binding.AddBinding(Entity, e => e.Nationality, w => w.Subject).InitializeFromSource();
            referenceCitizenship.SubjectType = typeof(Citizenship);
            referenceCitizenship.Binding.AddBinding(Entity, e => e.Citizenship, w => w.Subject).InitializeFromSource();

            referenceUser.SubjectType      = typeof(User);
            referenceUser.CanEditReference = false;
            referenceUser.Binding.AddBinding(Entity, e => e.User, w => w.Subject).InitializeFromSource();
            referenceUser.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_users");

            yenumcombobox13.ItemsEnum = typeof(RegistrationType);
            yenumcombobox13.Binding.AddBinding(Entity, e => e.Registration, w => w.SelectedItemOrNull).InitializeFromSource();

            comboDriverType.ItemsEnum = typeof(DriverType);
            comboDriverType.Binding.AddBinding(Entity, e => e.DriverType, w => w.SelectedItemOrNull).InitializeFromSource();

            ydatepicker1.Binding.AddBinding(Entity, e => e.BirthdayDate, w => w.DateOrNull).InitializeFromSource();
            dateFired.Binding.AddBinding(Entity, e => e.DateFired, w => w.DateOrNull).InitializeFromSource();
            dateHired.Binding.AddBinding(Entity, e => e.DateHired, w => w.DateOrNull).InitializeFromSource();
            dateCalculated.Binding.AddBinding(Entity, e => e.DateCalculated, w => w.DateOrNull).InitializeFromSource();

            photoviewEmployee.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource();
            photoviewEmployee.GetSaveFileName = () => Entity.FullName;

            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Employee));
            if (Entity.Id != 0)
            {
                attachmentFiles.ItemId = UoWGeneric.Root.Id;
                attachmentFiles.UpdateFileList();
            }
            phonesView.UoW = UoWGeneric;
            if (UoWGeneric.Root.Phones == null)
            {
                UoWGeneric.Root.Phones = new List <Phone>();
            }
            phonesView.Phones            = UoWGeneric.Root.Phones;
            accountsView.ParentReference = new ParentReferenceGeneric <Employee, Account>(UoWGeneric, o => o.Accounts);
            accountsView.SetTitle("Банковские счета сотрудника");
            ydateFirstWorkDay.Binding.AddBinding(Entity, e => e.FirstWorkDay, w => w.DateOrNull).InitializeFromSource();
            yspinTripsPriority.Binding.AddBinding(Entity, e => e.TripPriority, w => w.ValueAsShort).InitializeFromSource();
            yspinDriverSpeed.Binding.AddBinding(Entity, e => e.DriverSpeed, w => w.Value, new MultiplierToPercentConverter()).InitializeFromSource();
            minAddressesSpin.Binding.AddBinding(Entity, e => e.MinRouteAddresses, w => w.ValueAsInt).InitializeFromSource();
            maxAddressesSpin.Binding.AddBinding(Entity, e => e.MaxRouteAddresses, w => w.ValueAsInt).InitializeFromSource();
            checkbuttonRussianCitizen.Binding.AddBinding(Entity, e => e.IsRussianCitizen, w => w.Active).InitializeFromSource();
            checkVisitingMaster.Binding.AddBinding(Entity, e => e.VisitingMaster, w => w.Active).InitializeFromSource();
            checkChainStoreDriver.Binding.AddBinding(Entity, e => e.IsChainStoreDriver, w => w.Active).InitializeFromSource();

            ylblUserLogin.TooltipText = "При сохранении сотрудника создаёт нового пользователя с введённым логином и отправляет сотруднику SMS с сгенерированным паролем";
            yentryUserLogin.Binding.AddBinding(Entity, e => e.LoginForNewUser, w => w.Text);
            yentryUserLogin.Sensitive = CanCreateNewUser;

            specialListCmbOrganisation.ItemsList = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.OrganisationForSalary, w => w.SelectedItem).InitializeFromSource();
            specialListCmbOrganisation.Sensitive = canEditOrganisationForSalary;

            ConfigureWorkSchedules();
            ConfigureDistrictPriorities();

            ytreeviewEmployeeDocument.ColumnsConfig = FluentColumnsConfig <EmployeeDocument> .Create()
                                                      .AddColumn("Документ").AddTextRenderer(x => x.Document.GetEnumTitle())
                                                      .AddColumn("Доп. название").AddTextRenderer(x => x.Name)
                                                      .Finish();

            ytreeviewEmployeeDocument.SetItemsSource(Entity.ObservableDocuments);

            ytreeviewEmployeeContract.ColumnsConfig = FluentColumnsConfig <EmployeeContract> .Create()
                                                      .AddColumn("Договор").AddTextRenderer(x => x.EmployeeContractTemplate.TemplateType.GetEnumTitle())
                                                      .AddColumn("Название").AddTextRenderer(x => x.Name)
                                                      .AddColumn("Дата начала").AddTextRenderer(x => x.FirstDay.ToString("dd/MM/yyyy"))
                                                      .AddColumn("Дата конца").AddTextRenderer(x => x.LastDay.ToString("dd/MM/yyyy"))
                                                      .Finish();

            ytreeviewEmployeeContract.SetItemsSource(Entity.ObservableContracts);

            wageParametersView.ViewModel = new EmployeeWageParametersViewModel
                                           (
                Entity,
                this,
                UoW,
                new HierarchicalPresetPermissionValidator(EmployeeSingletonRepository.GetInstance(), new PermissionRepository()),
                UserSingletonRepository.GetInstance(),
                ServicesConfig.CommonServices,
                NavigationManagerProvider.NavigationManager
                                           );

            logger.Info("Ok");
        }
コード例 #27
0
        private void ConfigureDlg()
        {
            var orderOrganizationProviderFactory = new OrderOrganizationProviderFactory();

            organizationProvider           = orderOrganizationProviderFactory.CreateOrderOrganizationProvider();
            counterpartyContractRepository = new CounterpartyContractRepository(organizationProvider);
            counterpartyContractFactory    = new CounterpartyContractFactory(organizationProvider, counterpartyContractRepository);

            buttonReportByClient.Sensitive = Entity.Counterparty != null;
            buttonReportByDP.Sensitive     = Entity.DeliveryPoint != null;

            comboboxImpotanceType.ItemsEnum = typeof(ImportanceDegreeType);
            comboboxImpotanceType.Binding.AddBinding(Entity, s => s.ImportanceDegree, w => w.SelectedItemOrNull).InitializeFromSource();
            TaskStateComboBox.ItemsEnum = typeof(CallTaskStatus);
            TaskStateComboBox.Binding.AddBinding(Entity, s => s.TaskState, w => w.SelectedItemOrNull).InitializeFromSource();
            IsTaskCompleteButton.Binding.AddBinding(Entity, s => s.IsTaskComplete, w => w.Active).InitializeFromSource();
            IsTaskCompleteButton.Label += Entity.CompleteDate?.ToString("dd / MM / yyyy  HH:mm");
            deadlineYdatepicker.Binding.AddBinding(Entity, s => s.EndActivePeriod, w => w.Date).InitializeFromSource();
            ytextviewComments.Binding.AddBinding(Entity, s => s.Comment, w => w.Buffer.Text).InitializeFromSource();
            yentryTareReturn.ValidationMode = ValidationType.numeric;
            yentryTareReturn.Binding.AddBinding(Entity, s => s.TareReturn, w => w.Text, new IntToStringConverter()).InitializeFromSource();


            EmployeeFilterViewModel employeeFilterViewModel = new EmployeeFilterViewModel();

            employeeFilterViewModel.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.office);
            EmployeesVM employeeVM = new EmployeesVM(employeeFilterViewModel);

            EmployeeyEntryreferencevm.RepresentationModel = employeeVM;

            EmployeeyEntryreferencevm.Binding.AddBinding(Entity, s => s.AssignedEmployee, w => w.Subject).InitializeFromSource();

            entityVMEntryDeliveryPoint.SetEntityAutocompleteSelectorFactory(new EntityAutocompleteSelectorFactory <DeliveryPointJournalViewModel>(typeof(DeliveryPoint),
                                                                                                                                                  () => new DeliveryPointJournalViewModel(DeliveryPointJournalFilterViewModel,
                                                                                                                                                                                          UnitOfWorkFactory.GetDefaultFactory, ServicesConfig.CommonServices)
            {
                SelectionMode = JournalSelectionMode.Single
            }));
            entityVMEntryDeliveryPoint.Binding.AddBinding(Entity, s => s.DeliveryPoint, w => w.Subject).InitializeFromSource();

            entityVMEntryCounterparty.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityVMEntryCounterparty.Binding.AddBinding(Entity, s => s.Counterparty, w => w.Subject).InitializeFromSource();

            employee = employeeRepository.GetEmployeeForCurrentUser(UoW);

            ClientPhonesView.ViewModel          = new PhonesViewModel(phoneRepository, UoW, ContactParametersProvider.Instance);
            ClientPhonesView.ViewModel.ReadOnly = true;

            DeliveryPointPhonesView.ViewModel          = new PhonesViewModel(phoneRepository, UoW, ContactParametersProvider.Instance);
            DeliveryPointPhonesView.ViewModel.ReadOnly = true;

            if (Entity.Counterparty != null)
            {
                if (DeliveryPointJournalFilterViewModel != null)
                {
                    DeliveryPointJournalFilterViewModel.Counterparty = Entity.Counterparty;
                }
            }

            UpdateAddressFields();
        }
コード例 #28
0
ファイル: CarsDlg.cs プロジェクト: RoAr80/Vodovoz
        private void ConfigureDlg()
        {
            notebook1.Page     = 0;
            notebook1.ShowTabs = false;

            dataentryModel.Binding.AddBinding(Entity, e => e.Model, w => w.Text).InitializeFromSource();
            dataentryRegNumber.Binding.AddBinding(Entity, e => e.RegistrationNumber, w => w.Text).InitializeFromSource();

            comboTypeOfUse.ItemsEnum = typeof(CarTypeOfUse);
            comboTypeOfUse.Binding.AddBinding(Entity, e => e.TypeOfUse, w => w.SelectedItemOrNull).InitializeFromSource();

            comboDriverCarKind.ItemsList = UoW.GetAll <DriverCarKind>();
            comboDriverCarKind.Binding.AddBinding(Entity, e => e.DriverCarKind, w => w.SelectedItem).InitializeFromSource();

            yentryVIN.Binding.AddBinding(Entity, e => e.VIN, w => w.Text).InitializeFromSource();
            yentryManufactureYear.Binding.AddBinding(Entity, e => e.ManufactureYear, w => w.Text).InitializeFromSource();
            yentryMotorNumber.Binding.AddBinding(Entity, e => e.MotorNumber, w => w.Text).InitializeFromSource();
            yentryChassisNumber.Binding.AddBinding(Entity, e => e.ChassisNumber, w => w.Text).InitializeFromSource();
            yentryCarcaseNumber.Binding.AddBinding(Entity, e => e.Carcase, w => w.Text).InitializeFromSource();
            yentryColor.Binding.AddBinding(Entity, e => e.Color, w => w.Text).InitializeFromSource();
            yentryDocSeries.Binding.AddBinding(Entity, e => e.DocSeries, w => w.Text).InitializeFromSource();
            yentryDocNumber.Binding.AddBinding(Entity, e => e.DocNumber, w => w.Text).InitializeFromSource();
            yentryDocIssuedOrg.Binding.AddBinding(Entity, e => e.DocIssuedOrg, w => w.Text).InitializeFromSource();
            ydatepickerDocIssuedDate.Binding.AddBinding(Entity, e => e.DocIssuedDate, w => w.DateOrNull).InitializeFromSource();

            yentryFuelCardNumber.Binding.AddBinding(Entity, e => e.FuelCardNumber, w => w.Text).InitializeFromSource();
            yentryFuelCardNumber.Binding.AddFuncBinding(Entity, e => e.CanEditFuelCardNumber, w => w.Sensitive).InitializeFromSource();

            yentryPTSNum.Binding.AddBinding(Entity, e => e.DocPTSNumber, w => w.Text).InitializeFromSource();
            yentryPTSSeries.Binding.AddBinding(Entity, e => e.DocPTSSeries, w => w.Text).InitializeFromSource();

            var filter = new EmployeeFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            dataentryreferenceDriver.RepresentationModel = new EmployeesVM(filter);
            dataentryreferenceDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Subject).InitializeFromSource();

            dataentryFuelType.SubjectType = typeof(FuelType);
            dataentryFuelType.Binding.AddBinding(Entity, e => e.FuelType, w => w.Subject).InitializeFromSource();
            radiobuttonMain.Active = true;

            dataspinbutton1.Binding.AddBinding(Entity, e => e.FuelConsumption, w => w.Value).InitializeFromSource();
            maxWeightSpin.Binding.AddBinding(Entity, e => e.MaxWeight, w => w.ValueAsInt).InitializeFromSource();
            maxVolumeSpin.Binding.AddBinding(Entity, e => e.MaxVolume, w => w.Value).InitializeFromSource();
            minBottlesSpin.Binding.AddBinding(Entity, e => e.MinBottles, w => w.ValueAsInt).InitializeFromSource();
            maxBottlesSpin.Binding.AddBinding(Entity, e => e.MaxBottles, w => w.ValueAsInt).InitializeFromSource();
            minBottlesFromAddressSpin.Binding.AddBinding(Entity, e => e.MinBottlesFromAddress, w => w.ValueAsInt).InitializeFromSource();
            maxBottlesFromAddressSpin.Binding.AddBinding(Entity, e => e.MaxBottlesFromAddress, w => w.ValueAsInt).InitializeFromSource();

            photoviewCar.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource();
            photoviewCar.GetSaveFileName = () => String.Format("{0}({1})", Entity.Model, Entity.RegistrationNumber);

            carRepository = new CarRepository();

            checkIsRaskat.Active = Entity.IsRaskat;

            Entity.PropertyChanged += (s, e) => {
                if (e.PropertyName == nameof(Entity.IsRaskat) && checkIsRaskat.Active != Entity.IsRaskat)
                {
                    checkIsRaskat.Active = Entity.IsRaskat;
                }
            };

            checkIsRaskat.Toggled += (s, e) => {
                if (!carRepository.IsInAnyRouteList(UoW, Entity))
                {
                    Entity.IsRaskat = checkIsRaskat.Active;
                }
                else if (checkIsRaskat.Active != Entity.IsRaskat)
                {
                    checkIsRaskat.Active = Entity.IsRaskat;
                    MessageDialogHelper.RunWarningDialog("На данном автомобиле есть МЛ, смена типа невозможна");
                }
            };

            checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource();

            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Car));
            if (!UoWGeneric.IsNew)
            {
                attachmentFiles.ItemId = UoWGeneric.Root.Id;
                attachmentFiles.UpdateFileList();
            }
            OnDataentryreferenceDriverChanged(null, null);
            textDriverInfo.Selectable = true;

            int  currentUserId = ServicesConfig.CommonServices.UserService.CurrentUserId;
            bool canChangeVolumeWeightConsumption = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_cars_volume_weight_consumption", currentUserId) || Entity.Id == 0 || !Entity.IsCompanyCar;
            bool canChangeBottlesFromAddress      = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_cars_bottles_from_address", currentUserId);

            dataspinbutton1.Sensitive = canChangeVolumeWeightConsumption;
            maxVolumeSpin.Sensitive   = canChangeVolumeWeightConsumption;
            maxWeightSpin.Sensitive   = canChangeVolumeWeightConsumption;

            checkIsRaskat.Sensitive  = CarTypeIsEditable() || ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_change_car_is_raskat");
            comboTypeOfUse.Sensitive = CarTypeIsEditable();

            minBottlesFromAddressSpin.Sensitive = canChangeBottlesFromAddress;
            maxBottlesFromAddressSpin.Sensitive = canChangeBottlesFromAddress;

            yTreeGeographicGroups.Selection.Mode = Gtk.SelectionMode.Single;
            yTreeGeographicGroups.ColumnsConfig  = FluentColumnsConfig <GeographicGroup> .Create()
                                                   .AddColumn("Название").AddTextRenderer(x => x.Name)
                                                   .Finish();

            yTreeGeographicGroups.ItemsDataSource = Entity.ObservableGeographicGroups;

            UpdateSensitivity();
        }
コード例 #29
0
        private void ConfigureDlg()
        {
            btnCancel.Clicked                   += OnCancelClicked;
            printTimeButton.Clicked             += OnPrintTimeButtonClicked;
            ybuttonAddAdditionalLoad.Clicked    += OnButtonAddAdditionalLoadClicked;
            ybuttonRemoveAdditionalLoad.Clicked += OnButtonRemoveAdditionalLoadClicked;

            datepickerDate.Binding.AddBinding(Entity, e => e.Date, w => w.Date).InitializeFromSource();
            _previousSelectedDate             = Entity.Date;
            datepickerDate.DateChangedByUser += OnDatepickerDateDateChangedByUser;

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(new CarJournalFactory(MainClass.MainWin.NavigationManager).CreateCarAutocompleteSelectorFactory());
            entityviewmodelentryCar.Binding.AddBinding(Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.ChangedByUser += (sender, e) =>
            {
                if (Entity.Car == null || Entity.Date == default)
                {
                    evmeForwarder.IsEditable           = true;
                    ybuttonAddAdditionalLoad.Sensitive = false;
                    return;
                }

                ybuttonAddAdditionalLoad.Sensitive = true;
                var isCompanyCar = Entity.GetCarVersion.IsCompanyCar;

                Entity.Driver = Entity.Car.Driver != null && Entity.Car.Driver.Status != EmployeeStatus.IsFired
                                        ? Entity.Car.Driver
                                        : null;
                evmeDriver.Sensitive = Entity.Driver == null || isCompanyCar;

                if (!isCompanyCar || Entity.Car.CarModel.CarTypeOfUse == CarTypeOfUse.Largus && Entity.CanAddForwarder)
                {
                    Entity.Forwarder         = Entity.Forwarder;
                    evmeForwarder.IsEditable = true;
                }
                else
                {
                    Entity.Forwarder         = null;
                    evmeForwarder.IsEditable = false;
                }
            };

            var driverFilter = new EmployeeFilterViewModel();

            driverFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.CanChangeStatus  = false);
            var driverFactory = new EmployeeJournalFactory(driverFilter);

            evmeDriver.Changed += (sender, args) => lblDriverComment.Text = Entity.Driver?.Comment;
            evmeDriver.SetEntityAutocompleteSelectorFactory(driverFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Subject).InitializeFromSource();

            hboxDriverComment.Binding
            .AddFuncBinding(Entity, e => e.Driver != null && !string.IsNullOrWhiteSpace(e.Driver.Comment), w => w.Visible)
            .InitializeFromSource();

            var forwarderFilter = new EmployeeFilterViewModel();

            forwarderFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.forwarder,
                x => x.CanChangeStatus  = false);
            var forwarderFactory = new EmployeeJournalFactory(forwarderFilter);

            evmeForwarder.SetEntityAutocompleteSelectorFactory(forwarderFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeForwarder.Binding.AddBinding(Entity, e => e.Forwarder, w => w.Subject).InitializeFromSource();
            evmeForwarder.Changed += (sender, args) =>
            {
                createroutelistitemsview1.OnForwarderChanged();
                lblForwarderComment.Text = Entity.Forwarder?.Comment;
            };

            hboxForwarderComment.Binding
            .AddFuncBinding(Entity, e => e.Forwarder != null && !string.IsNullOrWhiteSpace(e.Forwarder.Comment), w => w.Visible)
            .InitializeFromSource();
            lblForwarderComment.Text = Entity.Forwarder?.Comment;

            var employeeFactory = new EmployeeJournalFactory();

            evmeLogistician.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeLogistician.Sensitive = false;
            evmeLogistician.Binding.AddBinding(Entity, e => e.Logistician, w => w.Subject).InitializeFromSource();

            speccomboShift.ItemsList = _deliveryShiftRepository.ActiveShifts(UoW);
            speccomboShift.Binding.AddBinding(Entity, e => e.Shift, w => w.SelectedItem).InitializeFromSource();

            labelStatus.Binding.AddFuncBinding(Entity, e => e.Status.GetEnumTitle(), w => w.LabelProp).InitializeFromSource();

            evmeDriver.Sensitive = false;
            enumPrint.Sensitive  = Entity.Status != RouteListStatus.New;

            if (Entity.Id > 0)
            {
                //Нужно только для быстрой загрузки данных диалога. Проверено на МЛ из 200 заказов. Разница в скорости в несколько раз.
                var orders = UoW.Session.QueryOver <RouteListItem>()
                             .Where(x => x.RouteList == Entity)
                             .Fetch(x => x.Order).Eager
                             .Fetch(x => x.Order.OrderItems).Eager
                             .List();
            }

            _isLogistican = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("logistican");
            createroutelistitemsview1.RouteListUoW = UoWGeneric;
            createroutelistitemsview1.SetPermissionParameters(permissionResult, _isLogistican);

            var additionalLoadingItemsViewModel =
                new AdditionalLoadingItemsViewModel(UoW, this, new NomenclatureJournalFactory(), ServicesConfig.InteractiveService);

            additionalLoadingItemsViewModel.BindWithSource(Entity, e => e.AdditionalLoadingDocument);
            additionalLoadingItemsViewModel.CanEdit  = Entity.Status == RouteListStatus.New;
            _additionalLoadingItemsView              = new AdditionalLoadingItemsView(additionalLoadingItemsViewModel);
            _additionalLoadingItemsView.WidthRequest = 300;
            _additionalLoadingItemsView.ShowAll();
            hboxAdditionalLoading.PackStart(_additionalLoadingItemsView, false, false, 0);

            buttonAccept.Visible = ybuttonAddAdditionalLoad.Visible = ybuttonRemoveAdditionalLoad.Visible =
                NotLoadedRouteListStatuses.Contains(Entity.Status);

            if (Entity.Status == RouteListStatus.InLoading || Entity.Status == RouteListStatus.Confirmed)
            {
                var icon = new Image
                {
                    Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-edit", IconSize.Menu)
                };
                buttonAccept.Image = icon;
                buttonAccept.Label = "Редактировать";
            }

            ggToStringWidget.UoW   = UoW;
            ggToStringWidget.Label = "Район города:";
            ggToStringWidget.Binding.AddBinding(Entity, x => x.ObservableGeographicGroups, x => x.Items).InitializeFromSource();

            enumPrint.ItemsEnum = typeof(RouteListPrintableDocuments);
            enumPrint.SetVisibility(RouteListPrintableDocuments.TimeList, false);
            enumPrint.SetVisibility(RouteListPrintableDocuments.OrderOfAddresses, false);
            bool IsLoadDocumentPrintable = ServicesConfig.CommonServices.CurrentPermissionService
                                           .ValidatePresetPermission("can_print_car_load_document");

            enumPrint.SetVisibility(RouteListPrintableDocuments.LoadDocument, IsLoadDocumentPrintable &&
                                    !(Entity.Status == RouteListStatus.Confirmed));
            enumPrint.EnumItemClicked += (sender, e) => PrintSelectedDocument((RouteListPrintableDocuments)e.ItemEnum);

            //Телефон
            phoneLogistican.MangoManager = phoneDriver.MangoManager = phoneForwarder.MangoManager = MainClass.MainWin.MangoManager;
            phoneLogistican.Binding.AddBinding(Entity, e => e.Logistician, w => w.Employee).InitializeFromSource();
            phoneDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Employee).InitializeFromSource();
            phoneForwarder.Binding.AddBinding(Entity, e => e.Forwarder, w => w.Employee).InitializeFromSource();

            var hasAccessToDriverTerminal = _isLogistican ||
                                            ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("role_сashier");
            var baseDoc = _routeListRepository.GetLastTerminalDocumentForEmployee(UoW, Entity.Driver);

            labelTerminalCondition.Visible = hasAccessToDriverTerminal &&
                                             baseDoc is DriverAttachedTerminalGiveoutDocument &&
                                             baseDoc.CreationDate.Date <= Entity?.Date;
            if (labelTerminalCondition.Visible)
            {
                labelTerminalCondition.LabelProp += $"{Entity.DriverTerminalCondition?.GetEnumTitle() ?? "неизвестно"}";
            }

            _canСreateRoutelistInPastPeriod = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_routelist_in_past_period");

            _oldDriver = Entity.Driver;
            UpdateDlg(_isLogistican);

            Entity.PropertyChanged += OnRouteListPropertyChanged;
        }
コード例 #30
0
        protected override void ConfigureWithUow()
        {
            yEnumCMBGuilty.ItemsEnum             = typeof(GuiltyTypes);
            enumCMBUndeliveryStatus.ItemsEnum    = typeof(UndeliveryStatus);
            enumCMBUndeliveryStatus.SelectedItem = UndeliveryStatus.InProcess;
            yEnumCMBActionWithInvoice.ItemsEnum  = typeof(ActionsWithInvoice);
            ySpecCMBinProcessAt.ItemsList        = ySpecCMBGuiltyDep.ItemsList = EmployeeRepository.Subdivisions(UoW);

            refOldOrder.RepresentationModel = new OrdersVM(new OrdersFilter(UoW));
            refOldOrder.CanEditReference    = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            var driversFilter = new EmployeeFilterViewModel();

            driversFilter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            refDriver.RepresentationModel = new EmployeesVM(driversFilter);

            refClient.RepresentationModel = new CounterpartyVM(new CounterpartyFilter(UoW));
            entityVMEntryDeliveryPoint.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <DeliveryPoint, DeliveryPointJournalViewModel, DeliveryPointJournalFilterViewModel>(ServicesConfig.CommonServices));

            var authorsFilter = new EmployeeFilterViewModel();

            authorsFilter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.office,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            refOldOrderAuthor.RepresentationModel = refUndeliveryAuthor.RepresentationModel = new EmployeesVM(authorsFilter);

            dateperiodOldOrderDate.StartDateOrNull = DateTime.Today.AddMonths(-1);
            dateperiodOldOrderDate.EndDateOrNull   = DateTime.Today.AddMonths(1);
            chkProblematicCases.Toggled           += (sender, e) => {
                if (chkProblematicCases.Active)
                {
                    yEnumCMBGuilty.SelectedItemOrNull = null;
                    ySpecCMBGuiltyDep.Visible         = lblGuiltyDep.Visible = false;
                }
                yEnumCMBGuilty.Sensitive = !chkProblematicCases.Active;
                OnRefiltered();
            };

            //Подразделение
            var employeeSelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory
                <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel>(ServicesConfig.CommonServices);

            var filter = new SubdivisionFilterViewModel()
            {
                SubdivisionType = SubdivisionType.Default
            };


            AuthorSubdivisionEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                new EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel>(
                    typeof(Subdivision),
                    () => new SubdivisionsJournalViewModel(
                        filter,
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeSelectorFactory
                        )
                    )
                );

            AuthorSubdivisionEntityviewmodelentry.Changed += AuthorSubdivisionEntityviewmodelentryOnChanged;
        }