Esempio n. 1
0
        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();

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


            var filter = new EmployeeFilter(UoW);

            filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.driver);
            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();
            minAddressesSpin.Binding.AddBinding(Entity, e => e.MinRouteAddresses, w => w.ValueAsInt).InitializeFromSource();
            maxAddressesSpin.Binding.AddBinding(Entity, e => e.MaxRouteAddresses, 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);

            checkIsCompanyHavings.Binding.AddBinding(Entity, e => e.IsCompanyHavings, w => w.Active).InitializeFromSource();
            checkIsRaskat.Binding.AddBinding(Entity, e => e.IsRaskat, w => w.Active).InitializeFromSource();
            checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource();
            comboTypeOfUse.ItemsEnum = typeof(CarTypeOfUse);
            comboTypeOfUse.Binding.AddBinding(Entity, e => e.TypeOfUse, w => w.SelectedItemOrNull).InitializeFromSource();

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

            checkIsCompanyHavings.Sensitive = CarTypeIsEditable();
            checkIsRaskat.Sensitive         = CarTypeIsEditable();
            comboTypeOfUse.Sensitive        = CarTypeIsEditable();
        }
Esempio n. 2
0
        public void ConfigureBindings()
        {
            logger.Info("Настройка биндинга компонентов диалога стажера");
            //Основные
            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();
            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();
            dataentryDrivingNumber.MaxLength = 20;
            dataentryDrivingNumber.Binding.AddBinding(Entity, e => e.DrivingLicense, w => w.Text).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();
            photoviewEmployee.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource();
            photoviewEmployee.GetSaveFileName = () => Entity.FullName;
            phonesView.UoW = UoWGeneric;
            checkbuttonRussianCitizen.Binding.AddBinding(Entity, e => e.IsRussianCitizen, w => w.Active).InitializeFromSource();
            if (Entity.Phones == null)
            {
                Entity.Phones = new List <Vodovoz.Domain.Contacts.Phone>();
            }
            phonesView.Phones = Entity.Phones;

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

            ytreeviewEmployeeDocument.SetItemsSource(Entity.ObservableDocuments);

            //Реквизиты
            accountsView.ParentReference = new ParentReferenceGeneric <Trainee, Account>(UoWGeneric, o => o.Accounts);
            accountsView.SetTitle("Банковские счета стажера");

            //Файлы
            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Trainee));
            if (Entity.Id != 0)
            {
                attachmentFiles.ItemId = Entity.Id;
                attachmentFiles.UpdateFileList();
            }
            logger.Info("Ok");
        }
Esempio n. 3
0
        public void ConfigureBindings()
        {
            logger.Info("Настройка биндинга компонентов диалога стажера");
            //Основные
            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();
            dataentryPassportSeria.MaxLength = 30;
            dataentryPassportSeria.Binding.AddBinding(Entity, e => e.PassportSeria, w => w.Text).InitializeFromSource();
            dataentryPassportNumber.MaxLength = 30;
            dataentryPassportNumber.Binding.AddBinding(Entity, e => e.PassportNumber, w => w.Text).InitializeFromSource();
            ytextviewPassportIssuedOrg.Binding.AddBinding(Entity, e => e.PassportIssuedOrg, w => w.Buffer.Text).InitializeFromSource();
            ydatePassportIssuedDate.Binding.AddBinding(Entity, e => e.PassportIssuedDate, w => w.DateOrNull).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();
            dataentryDrivingNumber.MaxLength = 20;
            dataentryDrivingNumber.Binding.AddBinding(Entity, e => e.DrivingNumber, w => w.Text).InitializeFromSource();
            referenceNationality.SubjectType = typeof(Nationality);
            referenceNationality.Binding.AddBinding(Entity, e => e.Nationality, w => w.Subject).InitializeFromSource();
            photoviewEmployee.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource();
            photoviewEmployee.GetSaveFileName = () => Entity.FullName;
            phonesView.UoW = UoWGeneric;
            if (Entity.Phones == null)
            {
                Entity.Phones = new List <Phone>();
            }
            phonesView.Phones = Entity.Phones;

            //Реквизиты
            accountsView.ParentReference = new ParentReferenceGeneric <Trainee, Account>(UoWGeneric, o => o.Accounts);
            accountsView.SetTitle("Банковские счета стажера");

            //Файлы
            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Trainee));
            if (Entity.Id != 0)
            {
                attachmentFiles.ItemId = Entity.Id;
                attachmentFiles.UpdateFileList();
            }
            logger.Info("Ok");
        }
Esempio n. 4
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");
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        private void ConfigureDlg()
        {
            notebookMain.Page     = 0;
            notebookMain.ShowTabs = false;

            buttonSave.Clicked   += (sender, args) => ViewModel.SaveAndClose();
            buttonCancel.Clicked += (sender, args) => ViewModel.Close(false, CloseSource.Cancel);

            ConfigureRadioButtons();

            //Вкладка Информация
            yenumcomboStatus.ItemsEnum = typeof(EmployeeStatus);
            yenumcomboStatus.Binding.AddBinding(ViewModel.Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();

            dataentryLastName.Binding.AddBinding(ViewModel.Entity, e => e.LastName, w => w.Text).InitializeFromSource();
            dataentryName.Binding.AddBinding(ViewModel.Entity, e => e.Name, w => w.Text).InitializeFromSource();
            dataentryPatronymic.Binding.AddBinding(ViewModel.Entity, e => e.Patronymic, w => w.Text).InitializeFromSource();

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

            entryEmployeePost.SetEntityAutocompleteSelectorFactory(
                ViewModel.EmployeePostsJournalFactory.CreateEmployeePostsAutocompleteSelectorFactory());
            entryEmployeePost.Binding.AddBinding(ViewModel.Entity, e => e.Post, w => w.Subject).InitializeFromSource();

            comboSkillLevel.ItemsList = ViewModel.Entity.GetSkillLevels();
            comboSkillLevel.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.SkillLevel,
                w => w.ActiveText,
                new Gamma.Binding.Converters.NumbersToStringConverter()
                ).InitializeFromSource();
            comboSkillLevel.SelectedItem = ViewModel.Entity.SkillLevel;

            ConfigureCategory();

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

            checkVisitingMaster.Binding
            .AddBinding(ViewModel.Entity, e => e.VisitingMaster, w => w.Active)
            .InitializeFromSource();
            chkDriverForOneDay.Binding
            .AddBinding(ViewModel.Entity, e => e.IsDriverForOneDay, w => w.Active)
            .InitializeFromSource();
            checkChainStoreDriver.Binding
            .AddBinding(ViewModel.Entity, e => e.IsChainStoreDriver, w => w.Active)
            .InitializeFromSource();

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

            GenderComboBox.ItemsEnum = typeof(Gender);
            GenderComboBox.Binding
            .AddBinding(ViewModel.Entity, e => e.Gender, w => w.SelectedItemOrNull)
            .InitializeFromSource();

            ConfigureSubdivision();

            referenceUser.SubjectType      = typeof(User);
            referenceUser.CanEditReference = false;
            referenceUser.Binding.AddBinding(ViewModel.Entity, e => e.User, w => w.Subject).InitializeFromSource();
            referenceUser.Sensitive = ViewModel.CanManageUsers;

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

            birthdatePicker.Binding
            .AddBinding(ViewModel.Entity, e => e.BirthdayDate, w => w.DateOrNull)
            .InitializeFromSource();

            dataentryInnerPhone.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.InnerPhone,
                w => w.Text,
                new Gamma.Binding.Converters.NumbersToStringConverter()
                ).InitializeFromSource();

            checkbuttonRussianCitizen.Binding
            .AddBinding(ViewModel.Entity, e => e.IsRussianCitizen, w => w.Active)
            .InitializeFromSource();
            OnRussianCitizenToggled(null, EventArgs.Empty);

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

            dataentryDrivingNumber.MaxLength = 20;
            dataentryDrivingNumber.Binding
            .AddBinding(ViewModel.Entity, e => e.DrivingLicense, w => w.Text)
            .InitializeFromSource();

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

            phonesView.ViewModel            = ViewModel.PhonesViewModel;
            phonesView.ViewModel.PhonesList = new GenericObservableList <Phone>(ViewModel.Entity.Phones);

            entryAddressCurrent.Binding
            .AddBinding(ViewModel.Entity, e => e.AddressCurrent, w => w.Text)
            .InitializeFromSource();
            entryAddressRegistration.Binding
            .AddBinding(ViewModel.Entity, e => e.AddressRegistration, w => w.Text)
            .InitializeFromSource();
            yentryEmailAddress.Binding.AddBinding(ViewModel.Entity, e => e.Email, w => w.Text).InitializeFromSource();

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

            //Вкладка Логистика
            dataentryAndroidLogin.Binding
            .AddBinding(ViewModel.Entity, e => e.AndroidLogin, w => w.Text)
            .InitializeFromSource();
            dataentryAndroidLogin.Binding
            .AddBinding(ViewModel, vm => vm.CanRegisterMobileUser, w => w.Sensitive)
            .InitializeFromSource();

            dataentryAndroidPassword.Binding
            .AddBinding(ViewModel.Entity, e => e.AndroidPassword, w => w.Text)
            .InitializeFromSource();
            dataentryAndroidPassword.Binding
            .AddBinding(ViewModel, vm => vm.CanRegisterMobileUser, w => w.Sensitive)
            .InitializeFromSource();

            yMobileLoginInfo.Binding
            .AddBinding(ViewModel, vm => vm.AddMobileLoginInfo, w => w.LabelProp)
            .InitializeFromSource();

            yAddMobileLogin.Binding
            .AddBinding(ViewModel, vm => vm.IsValidNewMobileUser, w => w.Sensitive)
            .InitializeFromSource();

            defaultForwarderEntry.SetEntityAutocompleteSelectorFactory(
                ViewModel.EmployeeJournalFactory.CreateWorkingForwarderEmployeeAutocompleteSelectorFactory());
            defaultForwarderEntry.Binding
            .AddBinding(ViewModel.Entity, e => e.DefaultForwarder, w => w.Subject)
            .InitializeFromSource();

            yspinTripsPriority.Binding
            .AddBinding(ViewModel.Entity, e => e.TripPriority, w => w.ValueAsShort)
            .InitializeFromSource();
            yspinDriverSpeed.Binding
            .AddBinding(ViewModel.Entity, e => e.DriverSpeed, w => w.Value, new MultiplierToPercentConverter())
            .InitializeFromSource();

            minAddressesSpin.Binding
            .AddBinding(ViewModel.Entity, e => e.MinRouteAddresses, w => w.ValueAsInt)
            .InitializeFromSource();
            maxAddressesSpin.Binding
            .AddBinding(ViewModel.Entity, e => e.MaxRouteAddresses, w => w.ValueAsInt)
            .InitializeFromSource();

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

            ConfigureWorkSchedules();
            ConfigureDistrictPriorities();

            //Вкладка Реквизиты
            entryInn.Binding.AddBinding(ViewModel.Entity, e => e.INN, w => w.Text).InitializeFromSource();

            accountsView.ParentReference = new ParentReferenceGeneric <Employee, Account>(ViewModel.UoWGeneric, o => o.Accounts);
            accountsView.SetTitle("Банковские счета сотрудника");

            //Вкладка Файлы
            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Employee));

            if (ViewModel.Entity.Id != 0)
            {
                attachmentFiles.ItemId = ViewModel.Entity.Id;
                attachmentFiles.UpdateFileList();
            }

            ViewModel.SaveAttachmentFilesChangesAction += SaveAttachmentFilesChanges;
            ViewModel.HasAttachmentFilesChangesFunc    += HasAttachmentsFilesChanges;

            //Вкладка Документы
            if (radioTabEmployeeDocument.Sensitive = ViewModel.CanReadEmployeeDocuments)
            {
                ConfigureDocumentsTabButtons();
                ConfigureTreeEmployeeDocuments();
            }

            //Вкладка Договора
            ConfigureContractsTabButtons();
            ConfigureTreeEmployeeContracts();

            //Вкладка Зарплата
            specialListCmbOrganisation.ItemsList = ViewModel.organizations;
            specialListCmbOrganisation.Binding
            .AddBinding(ViewModel.Entity, e => e.OrganisationForSalary, w => w.SelectedItem)
            .InitializeFromSource();
            specialListCmbOrganisation.Sensitive = ViewModel.CanEditOrganisationForSalary;

            wageParametersView.ViewModel =
                ViewModel.EmployeeWageParametersFactory.CreateEmployeeWageParametersViewModel(ViewModel.Entity, ViewModel, ViewModel.UoW);
        }