示例#1
0
        public EmployeeViewModel(
            IAuthorizationService authorizationService,
            IEmployeeWageParametersFactory employeeWageParametersFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IEmployeePostsJournalFactory employeePostsJournalFactory,
            ICashDistributionCommonOrganisationProvider commonOrganisationProvider,
            ISubdivisionService subdivisionService,
            IEmailServiceSettingAdapter emailServiceSettingAdapter,
            IWageCalculationRepository wageCalculationRepository,
            IEmployeeRepository employeeRepository,
            IUnitOfWorkGeneric <Employee> uowGeneric,
            ICommonServices commonServices,
            IValidationContextFactory validationContextFactory,
            IPhonesViewModelFactory phonesViewModelFactory,
            IWarehouseRepository warehouseRepository,
            IRouteListRepository routeListRepository,
            DriverApiUserRegisterEndpoint driverApiUserRegisterEndpoint,
            UserSettings userSettings,
            IUserRepository userRepository,
            BaseParametersProvider baseParametersProvider,
            bool traineeToEmployee = false,
            INavigationManager navigationManager = null
            ) : base(commonServices?.InteractiveService, navigationManager)
        {
            _authorizationService         = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
            EmployeeWageParametersFactory =
                employeeWageParametersFactory ?? throw new ArgumentNullException(nameof(employeeWageParametersFactory));
            EmployeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            EmployeePostsJournalFactory = employeePostsJournalFactory ?? throw new ArgumentNullException(nameof(employeePostsJournalFactory));
            SubdivisionJournalFactory   = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));

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

            _subdivisionService            = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
            _emailServiceSettingAdapter    = emailServiceSettingAdapter ?? throw new ArgumentNullException(nameof(emailServiceSettingAdapter));
            _wageCalculationRepository     = wageCalculationRepository ?? throw new ArgumentNullException(nameof(wageCalculationRepository));
            _employeeRepository            = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _warehouseRepository           = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _routeListRepository           = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _driverApiUserRegisterEndpoint = driverApiUserRegisterEndpoint ?? throw new ArgumentNullException(nameof(driverApiUserRegisterEndpoint));
            _userSettings           = userSettings ?? throw new ArgumentNullException(nameof(userSettings));
            UoWGeneric              = uowGeneric ?? throw new ArgumentNullException(nameof(uowGeneric));
            _commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _userRepository         = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _baseParametersProvider = baseParametersProvider ?? throw new ArgumentNullException(nameof(baseParametersProvider));

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

            ConfigureValidationContext(validationContextFactory);

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

            PhonesViewModel = phonesViewModelFactory.CreateNewPhonesViewModel(UoW);

            if (Entity.Id == 0)
            {
                Entity.OrganisationForSalary = commonOrganisationProvider.GetCommonOrganisation(UoW);
                TabName = "Новый сотрудник";
            }
            else
            {
                TabName = Entity.GetPersonNameWithInitials();
            }

            if (Entity.Phones == null)
            {
                Entity.Phones = new List <Phone>();
            }

            SetPermissions();

            Entity.PropertyChanged += OnEntityPropertyChanged;

            organizations = UoW.GetAll <Organization>().ToList();
            FillHiddenCategories(traineeToEmployee);

            CanRegisterMobileUser = string.IsNullOrWhiteSpace(Entity.AndroidLogin) && string.IsNullOrWhiteSpace(Entity.AndroidPassword);

            var permissionResult =
                _commonServices.PermissionService.ValidateUserPermission(typeof(Employee), _commonServices.UserService.CurrentUserId);

            if (!permissionResult.CanRead)
            {
                AbortOpening(PermissionsSettings.GetEntityReadValidateResult(typeof(Employee)));
            }
        }
示例#2
0
        void ConfigureDlg()
        {
            if (!UoW.IsNew)
            {
                enumcomboOperation.Sensitive         = false;
                specialListCmbOrganisation.Sensitive = false;
            }

            accessfilteredsubdivisionselectorwidget.OnSelected += Accessfilteredsubdivisionselectorwidget_OnSelected;
            if (Entity.RelatedToSubdivision != null)
            {
                accessfilteredsubdivisionselectorwidget.SelectIfPossible(Entity.RelatedToSubdivision);
            }

            enumcomboOperation.ItemsEnum = typeof(IncomeType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();

            var filterCasher = new EmployeeFilterViewModel {
                Status = Domain.Employees.EmployeeStatus.IsWorking
            };

            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            var filter = new EmployeeFilterViewModel {
                Status = Domain.Employees.EmployeeStatus.IsWorking
            };

            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filter);
            yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();

            var filterRL = new RouteListsFilter(UoW)
            {
                OnlyStatuses = new[] { RouteListStatus.EnRoute, RouteListStatus.OnClosing }
            };

            yEntryRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRL);
            yEntryRouteList.Binding.AddBinding(Entity, s => s.RouteListClosing, w => w.Subject).InitializeFromSource();
            yEntryRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            yEntryRouteList.Hidden        += YEntryRouteList_ValueOrVisibilityChanged;
            yEntryRouteList.Shown         += YEntryRouteList_ValueOrVisibilityChanged;
            yEntryRouteList.ChangedByUser += YEntryRouteList_ValueOrVisibilityChanged;

            yentryClient.ItemsQuery = Repositories.CounterpartyRepository.ActiveClientsQuery();
            yentryClient.Binding.AddBinding(Entity, s => s.Customer, w => w.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();
            ydateDocument.Sensitive = canEditDate;

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <ExpenseCategory>(
                s =>
                comboExpense.ItemsList = CategoryRepository.ExpenseCategories(UoW).Where(x =>
                                                                                         x.ExpenseDocumentType != ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery)
                );
            comboExpense.ItemsList =
                CategoryRepository.ExpenseCategories(UoW).Where(x =>
                                                                x.ExpenseDocumentType != ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery);
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <IncomeCategory>(
                s =>
                comboCategory.ItemsList = CategoryRepository.IncomeCategories(UoW).Where(x =>
                                                                                         x.IncomeDocumentType != IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery && x.Id != excludeIncomeCategoryId)
                );
            comboCategory.ItemsList = CategoryRepository.IncomeCategories(UoW).Where(x =>
                                                                                     x.IncomeDocumentType != IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery && x.Id != excludeIncomeCategoryId);
            comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource();

            specialListCmbOrganisation.ShowSpecialStateNot = true;
            specialListCmbOrganisation.ItemsList           = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.Organisation, w => w.SelectedItem).InitializeFromSource();
            specialListCmbOrganisation.ItemSelected += SpecialListCmbOrganisationOnItemSelected;

            checkNoClose.Binding.AddBinding(Entity, e => e.NoFullCloseMode, w => w.Active);

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <Selectable <Expense> > ()
                                           .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing()
                                           .AddColumn("Дата").AddTextRenderer(a => a.Value.Date.ToString())
                                           .AddColumn("Получено").AddTextRenderer(a => a.Value.Money.ToString("C"))
                                           .AddColumn("Непогашено").AddTextRenderer(a => a.Value.UnclosedMoney.ToString("C"))
                                           .AddColumn("Статья").AddTextRenderer(a => a.Value.ExpenseCategory.Name)
                                           .AddColumn("Основание").AddTextRenderer(a => a.Value.Description)
                                           .Finish();
            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive               = false;
                ytreeviewDebts.Sensitive       = false;
                ytextviewDescription.Sensitive = false;
                buttonSave.Sensitive           = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
            }
        }
 public DeliveriesLateReport()
 {
     this.Build();
     UoW = UnitOfWorkFactory.CreateWithoutRoot();
     ySpecCmbGeographicGroup.ItemsList = UoW.GetAll <GeographicGroup>();
 }
示例#4
0
        public ComplaintViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory uowFactory,
            ICommonServices commonServices,
            IUndeliveredOrdersJournalOpener undeliveryViewOpener,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            IFilePickerService filePickerService,
            ISubdivisionRepository subdivisionRepository,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory driverJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            ISalesPlanJournalFactory salesPlanJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(uowBuilder, uowFactory, commonServices)
        {
            _filePickerService          = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            _subdivisionRepository      = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _undeliveryViewOpener       = undeliveryViewOpener ?? throw new ArgumentNullException(nameof(undeliveryViewOpener));
            EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            UserRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _salesPlanJournalFactory    = salesPlanJournalFactory ?? throw new ArgumentNullException(nameof(salesPlanJournalFactory));
            NomenclatureSelector        = nomenclatureSelector ?? throw new ArgumentNullException(nameof(nomenclatureSelector));
            UndeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

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

            Entity.ObservableComplaintDiscussions.ElementChanged     += ObservableComplaintDiscussions_ElementChanged;
            Entity.ObservableComplaintDiscussions.ListContentChanged += ObservableComplaintDiscussions_ListContentChanged;
            Entity.ObservableFines.ListContentChanged += ObservableFines_ListContentChanged;

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

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

            ConfigureEntityChangingRelations();

            CreateCommands();

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

            ComplaintObject = Entity.ComplaintKind?.ComplaintObject;

            TabName = $"Рекламация №{Entity.Id} от {Entity.CreationDate.ToShortDateString()}";
        }
示例#5
0
        private void ConfigureDlg()
        {
            notebook1.ShowTabs          = false;
            spinWeight.Sensitive        = false;
            spinVolume.Sensitive        = false;
            lblPercentForMaster.Visible = spinPercentForMaster.Visible = false;
            entryName.IsEditable        = true;
            radioInfo.Active            = true;

            ylabelCreationDate.Binding.AddFuncBinding(Entity, s => s.CreateDate.HasValue ? s.CreateDate.Value.ToString("dd.MM.yyyy HH:mm") : "", w => w.LabelProp).InitializeFromSource();
            ylabelCreatedBy.Binding.AddFuncBinding <Nomenclature>(Entity, s => GetUserEmployeeName(s.CreatedBy), w => w.LabelProp).InitializeFromSource();

            enumVAT.ItemsEnum = typeof(VAT);
            enumVAT.Binding.AddBinding(Entity, e => e.VAT, w => w.SelectedItem).InitializeFromSource();

            enumType.ItemsEnum = typeof(NomenclatureCategory);
            enumType.Binding.AddBinding(Entity, e => e.Category, w => w.SelectedItem).InitializeFromSource();

            enumTareVolume.ItemsEnum = typeof(TareVolume);
            enumTareVolume.Binding.AddBinding(Entity, e => e.TareVolume, w => w.SelectedItemOrNull).InitializeFromSource();
            ycheckDisposableTare.Binding.AddBinding(Entity, e => e.IsDisposableTare, w => w.Active).InitializeFromSource();

            yСolorBtnBottleCapColor.Binding.AddBinding(Entity, e => e.BottleCapColor, w => w.Color, new ColorTextToGdkColorConverter()).InitializeFromSource();
            yСolorBtnBottleCapColor.ColorSet += YСolorBtnBottleCapColorOnColorSet;

            enumSaleCategory.Visible   = Entity.Category == NomenclatureCategory.equipment;
            enumSaleCategory.ItemsEnum = typeof(SaleCategory);
            enumSaleCategory.Binding.AddBinding(Entity, e => e.SaleCategory, w => w.SelectedItemOrNull).InitializeFromSource();

            enumDepositType.Visible   = Entity.Category == NomenclatureCategory.deposit;
            enumDepositType.ItemsEnum = typeof(TypeOfDepositCategory);
            enumDepositType.Binding.AddBinding(Entity, e => e.TypeOfDepositCategory, w => w.SelectedItemOrNull).InitializeFromSource();

            comboMobileCatalog.ItemsEnum = typeof(MobileCatalog);
            comboMobileCatalog.Binding.AddBinding(Entity, e => e.MobileCatalog, w => w.SelectedItem).InitializeFromSource();

            lblSaleCategory.Visible = Nomenclature.GetCategoriesWithSaleCategory().Contains(Entity.Category);
            lblSubType.Visible      = Entity.Category == NomenclatureCategory.deposit;

            entryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            yentryOfficialName.Binding.AddBinding(Entity, e => e.OfficialName, w => w.Text).InitializeFromSource();
            var parallel = new ParallelEditing(yentryOfficialName);

            parallel.SubscribeOnChanges(entryName);
            parallel.GetParallelTextFunc = GenerateOfficialName;

            ycheckRentPriority.Binding.AddBinding(Entity, e => e.RentPriority, w => w.Active).InitializeFromSource();
            checkNotReserve.Binding.AddBinding(Entity, e => e.DoNotReserve, w => w.Active).InitializeFromSource();
            checkcanPrintPrice.Binding.AddBinding(Entity, e => e.CanPrintPrice, w => w.Active).InitializeFromSource();
            labelCanPrintPrice.Visible = checkcanPrintPrice.Visible = Entity.Category == NomenclatureCategory.water && !Entity.IsDisposableTare;
            checkHide.Binding.AddBinding(Entity, e => e.Hide, w => w.Active).InitializeFromSource();
            entryCode1c.Binding.AddBinding(Entity, e => e.Code1c, w => w.Text).InitializeFromSource();
            yspinSumOfDamage.Binding.AddBinding(Entity, e => e.SumOfDamage, w => w.ValueAsDecimal).InitializeFromSource();
            spinWeight.Binding.AddBinding(Entity, e => e.Weight, w => w.Value).InitializeFromSource();
            spinVolume.Binding.AddBinding(Entity, e => e.Volume, w => w.Value).InitializeFromSource();
            spinPercentForMaster.Binding.AddBinding(Entity, e => e.PercentForMaster, w => w.Value).InitializeFromSource();
            checkSerial.Binding.AddBinding(Entity, e => e.IsSerial, w => w.Active).InitializeFromSource();

            ycheckNewBottle.Binding.AddBinding(Entity, e => e.IsNewBottle, w => w.Active).InitializeFromSource();
            ycheckDefectiveBottle.Binding.AddBinding(Entity, e => e.IsDefectiveBottle, w => w.Active).InitializeFromSource();
            ycheckShabbyBottle.Binding.AddBinding(Entity, e => e.IsShabbyBottle, w => w.Active).InitializeFromSource();

            chkIsDiler.Binding.AddBinding(Entity, e => e.IsDiler, w => w.Active).InitializeFromSource();
            spinMinStockCount.Binding.AddBinding(Entity, e => e.MinStockCount, w => w.ValueAsDecimal).InitializeFromSource();

            ycomboFuelTypes.SetRenderTextFunc <FuelType>(x => x.Name);
            ycomboFuelTypes.ItemsList = UoW.GetAll <FuelType>();
            ycomboFuelTypes.Binding.AddBinding(Entity, e => e.FuelType, w => w.SelectedItem).InitializeFromSource();
            ycomboFuelTypes.Visible = Entity.Category == NomenclatureCategory.fuel;

            ylblOnlineStore.Text = Entity.OnlineStore?.Name;

            yentryFolder1c.SubjectType = typeof(Folder1c);
            yentryFolder1c.Binding.AddBinding(Entity, e => e.Folder1C, w => w.Subject).InitializeFromSource();

            yentryProductGroup.JournalButtons      = Buttons.Add | Buttons.Edit;
            yentryProductGroup.RepresentationModel = new ProductGroupVM(UoW, new ProductGroupFilterViewModel());
            yentryProductGroup.Binding.AddBinding(Entity, e => e.ProductGroup, w => w.Subject).InitializeFromSource();

            referenceUnit.SubjectType = typeof(MeasurementUnits);
            referenceUnit.Binding.AddBinding(Entity, n => n.Unit, w => w.Subject).InitializeFromSource();
            yentryrefEqupmentType.SubjectType = typeof(EquipmentKind);
            yentryrefEqupmentType.Binding.AddBinding(Entity, e => e.Kind, w => w.Subject).InitializeFromSource();
            referenceColor.SubjectType = typeof(EquipmentColors);
            referenceColor.Binding.AddBinding(Entity, e => e.EquipmentColor, w => w.Subject).InitializeFromSource();
            referenceRouteColumn.SubjectType = typeof(Domain.Logistic.RouteColumn);
            referenceRouteColumn.Binding.AddBinding(Entity, n => n.RouteListColumn, w => w.Subject).InitializeFromSource();
            referenceManufacturer.SubjectType = typeof(Manufacturer);
            referenceManufacturer.Binding.AddBinding(Entity, e => e.Manufacturer, w => w.Subject).InitializeFromSource();
            checkNoDeliver.Binding.AddBinding(Entity, e => e.NoDelivey, w => w.Active).InitializeFromSource();

            yentryShortName.Binding.AddBinding(Entity, e => e.ShortName, w => w.Text, new NullToEmptyStringConverter()).InitializeFromSource();
            yentryShortName.MaxLength = 220;
            checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource();
            checkIsArchive.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures");

            entityviewmodelentryShipperCounterparty.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(QS.Project.Services.ServicesConfig.CommonServices)
                );
            entityviewmodelentryShipperCounterparty.Binding.AddBinding(Entity, s => s.ShipperCounterparty, w => w.Subject).InitializeFromSource();
            entityviewmodelentryShipperCounterparty.CanEditReference = true;
            yentryStorageCell.Binding.AddBinding(Entity, s => s.StorageCell, w => w.Text).InitializeFromSource();
            UpdateVisibilityForEshopParam();

            nomenclaturePurchasePricesView.ViewModel = new NomenclaturePurchasePricesViewModel(Entity, this, UoW, ServicesConfig.CommonServices);

            #region Вкладка характиристики

            ytextDescription.Binding.AddBinding(Entity, e => e.Description, w => w.Buffer.Text).InitializeFromSource();
            nomenclaturecharacteristicsview1.Uow = UoWGeneric;

            #endregion

            int currNomenclatureOfDependence = (Entity.DependsOnNomenclature == null ? 0 : Entity.DependsOnNomenclature.Id);

            dependsOnNomenclature.RepresentationModel = new NomenclatureDependsFromVM(Entity);
            dependsOnNomenclature.Binding.AddBinding(Entity, e => e.DependsOnNomenclature, w => w.Subject).InitializeFromSource();

            ConfigureInputs(Entity.Category, Entity.TareVolume);

            pricesView.UoWGeneric = UoWGeneric;
            pricesView.Sensitive  = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures");

            Imageslist.ImageButtonPressEvent += Imageslist_ImageButtonPressEvent;

            Entity.PropertyChanged += Entity_PropertyChanged;

            //make actions menu
            var menu     = new Gtk.Menu();
            var menuItem = new Gtk.MenuItem("Заменить все ссылки на номенклатуру...");
            menuItem.Activated += MenuItem_ReplaceLinks_Activated;;
            menu.Add(menuItem);
            menuActions.Menu = menu;
            menu.ShowAll();
            menuActions.Sensitive = !UoWGeneric.IsNew;

            ConfigureValidationContext();
        }
示例#6
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();
            comboSkillLevel.ItemsList = Entity.GetSkillLevels();
            comboSkillLevel.Binding.AddBinding(Entity, e => e.SkillLevel, w => w.ActiveText, new Gamma.Binding.Converters.NumbersToStringConverter()).InitializeFromSource();
            comboSkillLevel.SelectedItem = Entity.SkillLevel;

            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();

            var unitOfWorkFactory          = UnitOfWorkFactory.GetDefaultFactory;
            var commonServices             = ServicesConfig.CommonServices;
            var employeePostJournalFactory = new EmployeePostsJournalFactory(unitOfWorkFactory, commonServices);

            entryEmployeePost.SetEntityAutocompleteSelectorFactory(employeePostJournalFactory);
            entryEmployeePost.Binding.AddBinding(Entity, e => e.Post, 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");
        }
示例#7
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();
        }
示例#8
0
        private void ConfigureDlg()
        {
            if (!UoW.IsNew)
            {
                enumcomboOperation.Sensitive         = false;
                specialListCmbOrganisation.Sensitive = false;
            }

            accessfilteredsubdivisionselectorwidget.OnSelected += Accessfilteredsubdivisionselectorwidget_OnSelected;
            if (Entity.RelatedToSubdivision != null)
            {
                accessfilteredsubdivisionselectorwidget.SelectIfPossible(Entity.RelatedToSubdivision);
            }

            enumcomboOperation.ItemsEnum = typeof(ExpenseType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();

            var filterCasher = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            var filterEmployee = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filterEmployee);
            yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();
            yentryEmployee.ChangedByUser += (sender, e) => UpdateEmployeeBalaceInfo();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();
            ydateDocument.Sensitive = _canEditDate;

            IFileChooserProvider fileChooserProvider = new FileChooser("Расход " + DateTime.Now + ".csv");
            var filterViewModel = new ExpenseCategoryJournalFilterViewModel {
                ExcludedIds    = _categoryRepository.ExpenseSelfDeliveryCategories(UoW).Select(x => x.Id),
                HidenByDefault = true
            };

            var expenseCategorySelectorFactory = new SimpleEntitySelectorFactory <ExpenseCategory, ExpenseCategoryViewModel>(
                () =>
            {
                var expenseCategoryJournalViewModel = new SimpleEntityJournalViewModel <ExpenseCategory, ExpenseCategoryViewModel>(
                    x => x.Name,
                    () => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForCreate(),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        fileChooserProvider,
                        filterViewModel,
                        _employeeJournalFactory,
                        _subdivisionJournalFactory
                        ),
                    node => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForOpen(node.Id),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        fileChooserProvider,
                        filterViewModel,
                        _employeeJournalFactory,
                        _subdivisionJournalFactory
                        ),
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices
                    )
                {
                    SelectionMode = JournalSelectionMode.Single
                };
                expenseCategoryJournalViewModel.SetFilter(filterViewModel,
                                                          filter => Restrictions.Not(Restrictions.In("Id", filter.ExcludedIds.ToArray())));

                return(expenseCategoryJournalViewModel);
            }
                );

            entityVMEntryExpenseCategory.SetEntityAutocompleteSelectorFactory(expenseCategorySelectorFactory);
            entityVMEntryExpenseCategory.Binding.AddBinding(Entity, e => e.ExpenseCategory, w => w.Subject).InitializeFromSource();

            specialListCmbOrganisation.ShowSpecialStateNot = true;
            specialListCmbOrganisation.ItemsList           = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.Organisation, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            UpdateEmployeeBalanceVisibility();
            UpdateEmployeeBalaceInfo();
            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
                buttonSave.Sensitive          = false;
                ytextviewDescription.Editable = false;
            }
        }
示例#9
0
        public AtWorksDlg(IDefaultDeliveryDaySchedule defaultDeliveryDaySchedule)
        {
            if (defaultDeliveryDaySchedule == null)
            {
                throw new ArgumentNullException(nameof(defaultDeliveryDaySchedule));
            }

            this.Build();

            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.IsCompanyCar ? vodovozCarIcon : null)
                                                   .AddTextRenderer(x => x.Car != null ? x.Car.RegistrationNumber : "нет")
                                                   .AddColumn("База")
                                                   .AddComboRenderer(x => x.GeographicGroup)
                                                   .SetDisplayFunc(x => x.Name)
                                                   .FillItems(GeographicGroupRepository.GeographicGroupsWithCoordinates(UoW))
                                                   .AddSetter(
                (c, n) => {
                c.Editable      = true;
                c.BackgroundGdk = n.GeographicGroup == null
                                                                ? colorLightRed
                                                                : colorWhite;
            }
                )
                                                   .AddColumn("Грузоп.")
                                                   .AddTextRenderer(x => x.Car != null ? x.Car.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>(defaultDeliveryDaySchedule.GetDefaultDeliveryDayScheduleId());
        }