示例#1
0
        public WayBillGeneratorViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            IInteractiveService interactiveService,
            INavigationManager navigation,
            IWayBillDocumentRepository wayBillDocumentRepository,
            RouteGeometryCalculator calculator,
            EntityAutocompleteSelectorFactory <EmployeesJournalViewModel> entityAutocompleteSelectorFactory
            )
            : base(unitOfWorkFactory, interactiveService, navigation)
        {
            this.entityAutocompleteSelectorFactory = entityAutocompleteSelectorFactory ?? throw new ArgumentNullException(nameof(entityAutocompleteSelectorFactory));

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

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

            this.Entity = new WayBillDocumentGenerator(UnitOfWorkFactory.CreateWithoutRoot(), wayBillDocumentRepository, calculator);
            TabName     = "Путевые листы для ФО";
            CreateCommands();
        }
示例#2
0
        private void Initialize()
        {
            CounterpartySelectorFactory = new DefaultEntityAutocompleteSelectorFactory <Counterparty,
                                                                                        CounterpartyJournalViewModel,
                                                                                        CounterpartyJournalFilterViewModel>(CommonServices);

            EmployeeSelectorFactory =
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () => {
                var filter = new EmployeeFilterViewModel {
                    Status = EmployeeStatus.IsWorking, RestrictCategory = EmployeeCategory.office
                };
                return(new EmployeesJournalViewModel(filter, UnitOfWorkFactory, CommonServices));
            });

            OrderSelectorFactory = new DefaultEntityAutocompleteSelectorFactory <Order,
                                                                                 OrderJournalViewModel,
                                                                                 OrderJournalFilterViewModel>(CommonServices);

            /*
             * SubdivisionSelectorFactory = new DefaultEntityAutocompleteSelectorFactory<Subdivision,
             *                                                                                                                                                      SubdivisionsJournalViewModel,
             *                                                                                                                                                      SubdivisionFilterViewModel>(CommonServices);
             */
        }
示例#3
0
 public UserSettingsViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices,
                              IEmployeeService employeeService, ISubdivisionService subdivisionService, EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel> subdivisionAutocompleteSelectorFactory)
     : base(uowBuilder, unitOfWorkFactory, commonServices)
 {
     this.employeeService    = employeeService ?? throw new ArgumentNullException(nameof(employeeService));;
     this.subdivisionService = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
     SubdivisionAutocompleteSelectorFactory = subdivisionAutocompleteSelectorFactory;
 }
示例#4
0
        private void ConfigureDlg()
        {
            yentryName.Binding.AddBinding(ViewModel.Entity, e => e.ComplainantName, w => w.Text).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entryCounterparty.SetEntityAutocompleteSelectorFactory(ViewModel.CounterpartySelectorFactory);
            entryCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            EntryCounterparty_ChangedByUser(this, new EventArgs());
            entryCounterparty.ChangedByUser += EntryCounterparty_ChangedByUser;

            spLstComplaintKind.SetRenderTextFunc <ComplaintKind>(k => k.GetFullName);
            spLstComplaintKind.Binding.AddBinding(ViewModel, vm => vm.ComplaintKindSource, w => w.ItemsList).InitializeFromSource();
            spLstComplaintKind.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintKind, w => w.SelectedItem).InitializeFromSource();

            spLstAddress.Binding.AddBinding(ViewModel, s => s.CanSelectDeliveryPoint, w => w.Sensitive).InitializeFromSource();

            var orderSelectorFactory = new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order), () => {
                var filter = new OrderJournalFilterViewModel();
                if (ViewModel.Entity.Counterparty != null)
                {
                    filter.RestrictCounterparty = ViewModel.Entity.Counterparty;
                }
                return(new OrderJournalViewModel(filter,
                                                 UnitOfWorkFactory.GetDefaultFactory,
                                                 ServicesConfig.CommonServices,
                                                 ViewModel.EmployeeService,
                                                 ViewModel.NomenclatureSelectorFactory,
                                                 ViewModel.CounterpartySelectorFactory,
                                                 ViewModel.NomenclatureRepository,
                                                 ViewModel.UserRepository));
            });

            entryOrder.SetEntitySelectorFactory(orderSelectorFactory);
            entryOrder.Binding.AddBinding(ViewModel.Entity, e => e.Order, w => w.Subject).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            yentryPhone.Binding.AddBinding(ViewModel.Entity, e => e.Phone, w => w.Text).InitializeFromSource();
            yentryPhone.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            complaintfilesview.ViewModel = ViewModel.FilesViewModel;
            complaintfilesview.Sensitive = ViewModel.CanEdit;

            comboboxComplaintSource.SetRenderTextFunc <ComplaintSource>(x => x.Name);
            comboboxComplaintSource.ItemsList = ViewModel.ComplaintSources;
            comboboxComplaintSource.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintSource, w => w.SelectedItem).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

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

            guiltyitemsview.ViewModel = ViewModel.GuiltyItemsViewModel;

            buttonSave.Clicked   += (sender, e) => { ViewModel.CheckAndSave(); };
            buttonCancel.Clicked += (sender, e) => { ViewModel.Close(false, QS.Navigation.CloseSource.Cancel); };
        }
        public RouteListAnalysisViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            Entity.ObservableAddresses.PropertyOfElementChanged += ObservableAddressesOnPropertyOfElementChanged;

            undeliveryViewOpener = new UndeliveriesViewOpener();
            employeeService      = VodovozGtkServicesConfig.EmployeeService;
            CurrentEmployee      = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id);

            if (CurrentEmployee == null)
            {
                AbortOpening("Ваш пользователь не привязан к действующему сотруднику, вы не можете открыть " +
                             "диалог разбора МЛ, так как некого указывать в качестве логиста.", "Невозможно открыть разбор МЛ");
            }

            employeeSelectorFactory = new DefaultEntityAutocompleteSelectorFactory <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel>(commonServices);

            LogisticanSelectorFactory =
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () => {
                var filter = new EmployeeFilterViewModel {
                    Status = EmployeeStatus.IsWorking, RestrictCategory = EmployeeCategory.office
                };
                return(new EmployeesJournalViewModel(filter, UnitOfWorkFactory, CommonServices));
            });

            DriverSelectorFactory =
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () => {
                var filter = new EmployeeFilterViewModel {
                    Status = EmployeeStatus.IsWorking, RestrictCategory = EmployeeCategory.driver
                };
                return(new EmployeesJournalViewModel(filter, UnitOfWorkFactory, CommonServices));
            });

            ForwarderSelectorFactory =
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () => {
                var filter = new EmployeeFilterViewModel {
                    Status = EmployeeStatus.IsWorking, RestrictCategory = EmployeeCategory.forwarder
                };
                return(new EmployeesJournalViewModel(filter, UnitOfWorkFactory, CommonServices));
            });

            TabName = $"Диалог разбора {Entity.Title}";
        }
示例#6
0
        private void ConfigureDlg()
        {
            yentryName.Binding.AddBinding(ViewModel.Entity, e => e.ComplainantName, w => w.Text).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entryCounterparty.SetEntityAutocompleteSelectorFactory(ViewModel.CounterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory());
            entryCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            EntryCounterparty_ChangedByUser(this, new EventArgs());
            entryCounterparty.ChangedByUser += EntryCounterparty_ChangedByUser;

            spLstComplaintKind.SetRenderTextFunc <ComplaintKind>(k => k.GetFullName);
            spLstComplaintKind.Binding.AddBinding(ViewModel, vm => vm.ComplaintKindSource, w => w.ItemsList).InitializeFromSource();
            spLstComplaintKind.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintKind, w => w.SelectedItem).InitializeFromSource();

            yspeccomboboxComplaintObject.ShowSpecialStateAll = true;
            yspeccomboboxComplaintObject.Binding.AddSource(ViewModel)
            .AddBinding(vm => vm.ComplaintObjectSource, w => w.ItemsList)
            .AddBinding(ViewModel, vm => vm.ComplaintObject, w => w.SelectedItem).InitializeFromSource();

            spLstAddress.Binding.AddBinding(ViewModel, s => s.CanSelectDeliveryPoint, w => w.Sensitive).InitializeFromSource();

            var orderSelectorFactory = new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order), () => {
                var filter = new OrderJournalFilterViewModel(ViewModel.CounterpartyJournalFactory, ViewModel.DeliveryPointJournalFactory);
                if (ViewModel.Entity.Counterparty != null)
                {
                    filter.RestrictCounterparty = ViewModel.Entity.Counterparty;
                }
                return(new OrderJournalViewModel(filter,
                                                 UnitOfWorkFactory.GetDefaultFactory,
                                                 ServicesConfig.CommonServices,
                                                 ViewModel.EmployeeService,
                                                 ViewModel.NomenclatureRepository,
                                                 ViewModel.UserRepository,
                                                 ViewModel.OrderSelectorFactory,
                                                 ViewModel.EmployeeJournalFactory,
                                                 ViewModel.CounterpartyJournalFactory,
                                                 ViewModel.DeliveryPointJournalFactory,
                                                 ViewModel.SubdivisionJournalFactory,
                                                 ViewModel.GtkDialogsOpener,
                                                 ViewModel.UndeliveredOrdersJournalOpener,
                                                 ViewModel.NomenclatureSelector,
                                                 ViewModel.UndeliveredOrdersRepository,
                                                 ViewModel.SubdivisionRepository,
                                                 ViewModel.FileDialogService));
            });

            entryOrder.SetEntitySelectorFactory(orderSelectorFactory);
            entryOrder.Binding.AddBinding(ViewModel.Entity, e => e.Order, w => w.Subject).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            entryOrder.ChangedByUser += (sender, e) => ViewModel.ChangeDeliveryPointCommand.Execute();

            if (ViewModel.UserHasOnlyAccessToWarehouseAndComplaints)
            {
                entryCounterparty.CanEditReference = entryOrder.CanEditReference = false;
            }

            yentryPhone.Binding.AddBinding(ViewModel.Entity, e => e.Phone, w => w.Text).InitializeFromSource();
            yentryPhone.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            complaintfilesview.ViewModel = ViewModel.FilesViewModel;
            complaintfilesview.Sensitive = ViewModel.CanEdit;

            comboboxComplaintSource.SetRenderTextFunc <ComplaintSource>(x => x.Name);
            comboboxComplaintSource.ItemsList = ViewModel.ComplaintSources;
            comboboxComplaintSource.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintSource, w => w.SelectedItem).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

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

            guiltyitemsview.ViewModel = ViewModel.GuiltyItemsViewModel;

            buttonSave.Clicked   += (sender, e) => { ViewModel.CheckAndSave(); };
            buttonCancel.Clicked += (sender, e) => { ViewModel.Close(true, QS.Navigation.CloseSource.Cancel); };
        }
示例#7
0
        private void ConfigureDlg()
        {
            ylabelSubdivisions.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsInWork, w => w.LabelProp).InitializeFromSource();
            ylabelCreatedBy.Binding.AddBinding(ViewModel, e => e.CreatedByAndDate, w => w.LabelProp).InitializeFromSource();
            ylabelChangedBy.Binding.AddBinding(ViewModel, e => e.ChangedByAndDate, w => w.LabelProp).InitializeFromSource();

            yentryName.Binding.AddBinding(ViewModel.Entity, e => e.ComplainantName, w => w.Text).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelName.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            yenumcomboStatus.ItemsEnum = typeof(ComplaintStatuses);
            if (!ViewModel.CanClose)
            {
                yenumcomboStatus.AddEnumToHideList(new object[] { ComplaintStatuses.Closed });
            }

            yenumcomboStatus.Binding.AddSource(ViewModel)
            .AddBinding(vm => vm.Status, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            yenumcomboStatus.EnumItemSelected += (sender, args) => ViewModel.CloseComplaint((ComplaintStatuses)args.SelectedItem);

            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel.Entity, e => e.PlannedCompletionDate, w => w.Date).InitializeFromSource();
            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entryCounterparty.Changed += EntryCounterparty_Changed;
            entryCounterparty.SetEntityAutocompleteSelectorFactory(ViewModel.CounterpartySelectorFactory);
            entryCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelCounterparty.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            spLstAddress.Binding.AddBinding(ViewModel, s => s.CanSelectDeliveryPoint, w => w.Sensitive).InitializeFromSource();
            spLstAddress.Binding.AddBinding(ViewModel, s => s.IsClientComplaint, w => w.Visible).InitializeFromSource();
            lblAddress.Binding.AddBinding(ViewModel, s => s.IsClientComplaint, w => w.Visible).InitializeFromSource();

            var orderSelectorFactory = new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order), () => {
                var filter = new OrderJournalFilterViewModel(ViewModel.CounterpartyJournalFactory, ViewModel.DeliveryPointJournalFactory);

                if (ViewModel.Entity.Counterparty != null)
                {
                    filter.RestrictCounterparty = ViewModel.Entity.Counterparty;
                }

                return(new OrderJournalViewModel(filter,
                                                 UnitOfWorkFactory.GetDefaultFactory,
                                                 ServicesConfig.CommonServices,
                                                 ViewModel.EmployeeService,
                                                 ViewModel.NomenclatureRepository,
                                                 ViewModel.UserRepository,
                                                 ViewModel.OrderSelectorFactory,
                                                 ViewModel.EmployeeJournalFactory,
                                                 ViewModel.CounterpartyJournalFactory,
                                                 ViewModel.DeliveryPointJournalFactory,
                                                 ViewModel.SubdivisionJournalFactory,
                                                 ViewModel.GtkDialogsOpener,
                                                 ViewModel.UndeliveredOrdersJournalOpener,
                                                 ViewModel.NomenclatureSelector,
                                                 ViewModel.UndeliveredOrdersRepository,
                                                 ViewModel.SubdivisionRepository,
                                                 ViewModel.FileDialogService));
            });

            entryOrder.SetEntityAutocompleteSelectorFactory(orderSelectorFactory);
            entryOrder.Binding.AddBinding(ViewModel.Entity, e => e.Order, w => w.Subject).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            entryOrder.ChangedByUser += (sender, e) => ViewModel.ChangeDeliveryPointCommand.Execute();
            labelOrder.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            yentryPhone.Binding.AddBinding(ViewModel.Entity, e => e.Phone, w => w.Text).InitializeFromSource();
            yhboxPhone.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            yhboxPhone.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelNamePhone.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

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

            cmbComplaintKind.SetRenderTextFunc <ComplaintKind>(k => k.GetFullName);
            cmbComplaintKind.Binding
            .AddBinding(ViewModel, vm => vm.ComplaintKindSource, w => w.ItemsList)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .AddBinding(ViewModel.Entity, e => e.ComplaintKind, w => w.SelectedItem)
            .InitializeFromSource();

            yspeccomboboxComplaintObject.ShowSpecialStateAll = true;
            yspeccomboboxComplaintObject.Binding.AddSource(ViewModel)
            .AddBinding(vm => vm.ComplaintObjectSource, w => w.ItemsList)
            .AddBinding(vm => vm.ComplaintObject, w => w.SelectedItem)
            .AddBinding(vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            comboboxComplaintSource.SetRenderTextFunc <ComplaintSource>(x => x.Name);
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.ComplaintSources, w => w.ItemsList).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintSource, w => w.SelectedItem).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelSource.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            cmbComplaintResultOfCounterparty.SetRenderTextFunc <ComplaintResultOfCounterparty>(x => x.Name);
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel, vm => vm.ComplaintResultsOfCounterparty, w => w.ItemsList).InitializeFromSource();
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintResultOfCounterparty, w => w.SelectedItem).InitializeFromSource();
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            cmbComplaintResultOfEmployees.SetRenderTextFunc <ComplaintResultOfEmployees>(x => x.Name);
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel, vm => vm.ComplaintResultsOfEmployees, w => w.ItemsList).InitializeFromSource();
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintResultOfEmployees, w => w.SelectedItem).InitializeFromSource();
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

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

            complaintfilesview.ViewModel = ViewModel.FilesViewModel;

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

            comboType.ItemsEnum = typeof(ComplaintType);
            comboType.Binding
            .AddBinding(ViewModel.Entity, e => e.ComplaintType, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            guiltyitemsview.ViewModel = ViewModel.GuiltyItemsViewModel;

            guiltyitemsview.Visible   = ViewModel.CanAddGuilty;
            labelNameGuilties.Visible = ViewModel.CanAddGuilty;

            vboxDicussions.Add(new ComplaintDiscussionsView(ViewModel.DiscussionsViewModel));
            vboxDicussions.ShowAll();

            ytreeviewFines.ColumnsConfig = FluentColumnsConfig <FineItem> .Create()
                                           .AddColumn("№").AddTextRenderer(x => x.Fine.Id.ToString())
                                           .AddColumn("Сотрудник").AddTextRenderer(x => x.Employee.ShortName)
                                           .AddColumn("Сумма штрафа").AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.Money))
                                           .Finish();

            ytreeviewFines.Binding.AddBinding(ViewModel, vm => vm.FineItems, w => w.ItemsDataSource).InitializeFromSource();

            buttonAddFine.Clicked += (sender, e) => { ViewModel.AddFineCommand.Execute(this.Tab); };
            buttonAddFine.Binding.AddBinding(ViewModel, vm => vm.CanAddFine, w => w.Sensitive).InitializeFromSource();

            buttonAttachFine.Clicked += (sender, e) => { ViewModel.AttachFineCommand.Execute(); };
            buttonAttachFine.Binding.AddBinding(ViewModel, vm => vm.CanAttachFine, w => w.Sensitive).InitializeFromSource();

            buttonSave.Clicked += (sender, e) => { ViewModel.SaveAndClose(); };
            buttonSave.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            buttonCancel.Clicked += (sender, e) => { ViewModel.Close(ViewModel.CanEdit, QS.Navigation.CloseSource.Cancel); };

            ViewModel.FilesViewModel.ReadOnly = !ViewModel.CanEdit;

            ViewModel.Entity.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(ViewModel.Entity.Phone))
                {
                    handsetPhone.SetPhone(ViewModel.Entity.Phone);
                }
            };
        }
示例#8
0
 public PremiumJournalFilterViewModel(EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel> subdivisionAutocompleteSelectorFactory)
 {
     SubdivisionAutocompleteSelectorFactory = subdivisionAutocompleteSelectorFactory;
 }
 public PremiumJournalFilterViewModel(EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel> subdivisionAutocompleteSelectorFactory)
 {
     _startDate = _endDate = DateTime.Today;
     SubdivisionAutocompleteSelectorFactory = subdivisionAutocompleteSelectorFactory;
 }