Exemplo n.º 1
0
        private void Configure()
        {
            AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                ViewModel.EmployeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory());

            daterangepicker.Binding.AddBinding(ViewModel, vm => vm.StartDate, w => w.StartDateOrNull);
            daterangepicker.Binding.AddBinding(ViewModel, vm => vm.EndDate, w => w.EndDateOrNull);

            AuthorEntityviewmodelentry.Binding.AddBinding(
                ViewModel,
                vm => vm.Author,
                w => w.Subject
                ).InitializeFromSource();

            AccountableEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                ViewModel.EmployeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());

            AccountableEntityviewmodelentry.Binding.AddBinding(
                ViewModel,
                vm => vm.AccountableEmployee,
                w => w.Subject
                ).InitializeFromSource();

            yenumcomboStatus.ItemsEnum = typeof(CashRequest.States);
            yenumcomboStatus.Binding.AddBinding(
                ViewModel,
                e => e.State,
                w => w.SelectedItemOrNull);
            yenumcomboStatus.ShowSpecialStateAll = true;


            CashRequestUserRole?userRole = ViewModel.GetUserRole();

            //Для Роли Согласователя по-умолчанию Создана Подана,
            //для Роли Финансиста - Согласована,
            //для Кассира - Передана на Выдачу,

            //Иные роли - только видят только свои заявки, поэтому нужно скрытиь фильтр по авторам
            if (userRole == CashRequestUserRole.Coordinator)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.Submited;
            }
            else if (userRole == CashRequestUserRole.Financier)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.Agreed;
            }
            else if (userRole == CashRequestUserRole.Cashier)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.GivenForTake;
            }
            else if (userRole == CashRequestUserRole.Other)
            {
                AuthorEntityviewmodelentry.Visible = false;
                label3.Visible = false;
            }
        }
Exemplo n.º 2
0
        private void ConfigureDlg()
        {
            #region EntityViewModelEntry

            //Автор
            var currentEmployee = ViewModel.CurrentEmployee;
            AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                ViewModel.EmployeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());
            AuthorEntityviewmodelentry.Binding.AddBinding(ViewModel.Entity, x => x.Author, w => w.Subject).InitializeFromSource();

            if (ViewModel.IsNewEntity)
            {
                ViewModel.Entity.Author = currentEmployee;
            }

            AuthorEntityviewmodelentry.Sensitive = false;

            //Подразделение
            SubdivisionEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                ViewModel.SubdivisionJournalFactory.CreateDefaultSubdivisionAutocompleteSelectorFactory(
                    ViewModel.EmployeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory()));
            SubdivisionEntityviewmodelentry.Binding.AddBinding(ViewModel.Entity, s => s.Subdivision, w => w.Subject).InitializeFromSource();
            SubdivisionEntityviewmodelentry.Sensitive = false;
            ViewModel.Entity.Subdivision = currentEmployee.Subdivision;

            //Причина расхода
            ExpenseCategoryEntityviewmodelentry
            .SetEntityAutocompleteSelectorFactory(ViewModel.ExpenseCategoryAutocompleteSelectorFactory);

            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel.Entity, s => s.ExpenseCategory, w => w.Subject).InitializeFromSource();

            ExpenseCategoryEntityviewmodelentry.CanEditReference = true;

            #endregion EntityViewModelEntry

            #region Combo

            //Организация
            speccomboOrganization.SetRenderTextFunc <Organization>(s => s.Name);
            var orgList = ViewModel.UoW.Session.QueryOver <Organization>().List();
            speccomboOrganization.ItemsList = orgList;
            speccomboOrganization.Binding.AddBinding(ViewModel.Entity, x => x.Organization, x => x.SelectedItem).InitializeFromSource();

            if (speccomboOrganization.SelectedItem == null)
            {
                speccomboOrganization.SelectedItem = orgList.First();
            }

            //Смена ролей
            comboRoleChooser.SetRenderTextFunc <CashRequestUserRole>(ur => ur.GetEnumTitle());
            comboRoleChooser.ItemsList = ViewModel.UserRoles;
            comboRoleChooser.Binding.AddBinding(ViewModel, vm => vm.UserRole, w => w.SelectedItem).InitializeFromSource();
            comboRoleChooser.Sensitive = ViewModel.IsRoleChooserSensitive;

            #endregion

            #region TextEntry

            //Пояснение
            yentryExplanation.Binding.AddBinding(ViewModel.Entity, e => e.Explanation, (widget) => widget.Text).InitializeFromSource();

            //Основание
            yentryGround.Binding.AddBinding(ViewModel.Entity, e => e.Basis, (widget) => widget.Buffer.Text).InitializeFromSource();
            yentryGround.WrapMode = WrapMode.Word;

            //Причина отмены
            yentryCancelReason.Binding.AddBinding(ViewModel.Entity, e => e.CancelReason, (widget) => widget.Buffer.Text).InitializeFromSource();
            yentryCancelReason.WrapMode = WrapMode.Word;

            //Причина отправки на пересогласование
            yentryReasonForSendToReapproval.Binding.AddBinding(ViewModel.Entity, e => e.ReasonForSendToReappropriate, (widget) => widget.Buffer.Text).InitializeFromSource();
            yentryReasonForSendToReapproval.WrapMode = WrapMode.Word;

            #endregion TextEntry

            #region Buttons

            ybtnAccept.Clicked += (sender, args) =>
            {
                ViewModel.AcceptCommand.Execute();
            };

            ybtnApprove.Clicked += (sender, args) => ViewModel.ApproveCommand.Execute();
            ybtnCancel.Clicked  += (sender, args) => ViewModel.CancelCommand.Execute();
            //Передать на выдачу
            ybtnConveyForResults.Clicked += (sender, args) => ViewModel.ConveyForResultsCommand.Execute();
            //Отправить на пересогласование
            ybtnReturnForRenegotiation.Clicked += (sender, args) => ViewModel.ReturnToRenegotiationCommand.Execute();

            ybtnGiveSumm.Clicked += (sender, args) => ViewModel.GiveSumCommand.Execute(ytreeviewSums.GetSelectedObject <CashRequestSumItem>());
            ybtnGiveSumm.Binding.AddBinding(ViewModel, vm => vm.CanGiveSum, w => w.Visible).InitializeFromSource();
            ybtnGiveSumm.Sensitive = ViewModel.Entity.ObservableSums.Any(x => x.ObservableExpenses == null || !x.ObservableExpenses.Any());

            ybtnGiveSummPartially.Clicked += (sender, args) => ViewModel.GiveSumPartiallyCommand.Execute(
                (ytreeviewSums.GetSelectedObject <CashRequestSumItem>(), yspinGivePartially.ValueAsDecimal)
                );
            ybtnGiveSummPartially.Binding.AddBinding(ViewModel, vm => vm.CanGiveSum, w => w.Visible).InitializeFromSource();
            ybtnGiveSummPartially.Sensitive = ViewModel.Entity.ObservableSums.Any(x => x.ObservableExpenses == null || !x.ObservableExpenses.Any());
            yspinGivePartially.Binding.AddBinding(ViewModel, vm => vm.CanGiveSum, w => w.Visible).InitializeFromSource();

            ybtnAddSumm.Clicked    += (sender, args) => ViewModel.AddSumCommand.Execute();
            ybtnEditSum.Clicked    += (sender, args) => ViewModel.EditSumCommand.Execute();
            ybtnDeleteSumm.Clicked += (sender, args) => ViewModel.DeleteSumCommand.Execute();
            ybtnEditSum.Binding.AddBinding(ViewModel, vm => vm.CanEditSumSensitive, w => w.Sensitive).InitializeFromSource();

            //Visible
            ybtnAccept.Binding.AddBinding(ViewModel, vm => vm.CanAccept, w => w.Visible).InitializeFromSource();
            ybtnApprove.Binding.AddBinding(ViewModel, vm => vm.CanApprove, w => w.Visible).InitializeFromSource();
            ybtnCancel.Binding.AddBinding(ViewModel, vm => vm.CanCancel, w => w.Visible).InitializeFromSource();
            ybtnConveyForResults.Binding.AddBinding(ViewModel, vm => vm.CanConveyForResults, w => w.Visible).InitializeFromSource();
            ybtnReturnForRenegotiation.Binding.AddBinding(ViewModel, vm => vm.CanReturnToRenegotiation, w => w.Visible).InitializeFromSource();
            ybtnDeleteSumm.Binding.AddBinding(ViewModel, vm => vm.CanDeleteSum, w => w.Visible).InitializeFromSource();
            ybtnEditSum.Visible   = false;
            buttonSave.Clicked   += (sender, args) => ViewModel.AfterSaveCommand.Execute();
            buttonCancel.Clicked += (s, e) => { ViewModel.Close(true, QS.Navigation.CloseSource.Cancel); };

            ycheckPossibilityNotToReconcilePayments.Binding.AddBinding(ViewModel.Entity, e => e.PossibilityNotToReconcilePayments, w => w.Active).InitializeFromSource();
            ycheckPossibilityNotToReconcilePayments.Binding.AddBinding(ViewModel, vm => vm.CanConfirmPossibilityNotToReconcilePayments, w => w.Visible).InitializeFromSource();
            ylabelPossibilityNotToReconcilePayments.Binding.AddBinding(ViewModel, vm => vm.CanConfirmPossibilityNotToReconcilePayments, w => w.Visible).InitializeFromSource();

            #endregion Buttons

            #region Editibility

            yentryCancelReason.Binding.AddBinding(ViewModel, vm => vm.CanEditOnlyCoordinator, w => w.Sensitive).InitializeFromSource();
            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategorySensitive, w => w.Sensitive).InitializeFromSource();

            speccomboOrganization.Binding.AddBinding(ViewModel, vm => vm.SensitiveForFinancier, w => w.Sensitive).InitializeFromSource();

            #endregion Editibility

            #region Visibility

            labelBalansOrganizations.Binding.AddBinding(ViewModel, vm => vm.VisibleOnlyForFinancer, w => w.Visible).InitializeFromSource();
            ylabelBalansOrganizations.Binding.AddBinding(ViewModel, vm => vm.VisibleOnlyForFinancer, w => w.Visible).InitializeFromSource();

            labelcomboOrganization.Binding.AddBinding(ViewModel, vm => vm.VisibleOnlyForFinancer, w => w.Visible).InitializeFromSource();
            speccomboOrganization.Binding.AddBinding(ViewModel, vm => vm.VisibleOnlyForFinancer, w => w.Visible).InitializeFromSource();

            labelCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategoryVisibility, w => w.Visible).InitializeFromSource();
            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategoryVisibility, w => w.Visible).InitializeFromSource();

            yentryReasonForSendToReapproval.Visible = ViewModel.VisibleOnlyForStatusUpperThanCreated;
            labelReasonForSendToReapproval.Visible  = ViewModel.VisibleOnlyForStatusUpperThanCreated;

            yentryCancelReason.Visible = ViewModel.VisibleOnlyForStatusUpperThanCreated;
            labelCancelReason.Visible  = ViewModel.VisibleOnlyForStatusUpperThanCreated;

            if (ViewModel.Entity.State == CashRequest.States.New)
            {
                hseparator1.Visible = false;
                hseparator2.Visible = false;
                hseparator3.Visible = false;
            }

            #endregion Visibility

            ConfigureTreeView();

            ycheckHaveReceipt.Binding.AddBinding(ViewModel.Entity, e => e.HaveReceipt, w => w.Active).InitializeFromSource();
            ylabelBalansOrganizations.Text = ViewModel.LoadOrganizationsSums();
            ylabelStatus.Binding.AddBinding(ViewModel, vm => vm.StateName, w => w.Text).InitializeFromSource();
            ylabelStatus.Text = ViewModel.Entity.State.GetEnumTitle();

            if (ViewModel.Entity.State == CashRequest.States.Closed)
            {
                ytreeviewSums.Sensitive                   = false;
                ybtnAddSumm.Sensitive                     = false;
                ybtnAccept.Sensitive                      = false;
                ybtnApprove.Sensitive                     = false;
                ybtnCancel.Sensitive                      = false;
                ybtnDeleteSumm.Sensitive                  = false;
                ybtnEditSum.Sensitive                     = false;
                ybtnGiveSumm.Sensitive                    = false;
                ybtnConveyForResults.Sensitive            = false;
                ybtnReturnForRenegotiation.Sensitive      = false;
                speccomboOrganization.Sensitive           = false;
                yentryExplanation.Sensitive               = false;
                yentryGround.Sensitive                    = false;
                yentryCancelReason.Sensitive              = false;
                yentryReasonForSendToReapproval.Sensitive = false;
            }
        }
Exemplo n.º 3
0
        private void Configure()
        {
            AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () =>
            {
                var employeeFilter = new EmployeeFilterViewModel {
                    Status   = EmployeeStatus.IsWorking,
                    Category = EmployeeCategory.office
                };
                return(new EmployeesJournalViewModel(
                           employeeFilter,
                           UnitOfWorkFactory.GetDefaultFactory,
                           ServicesConfig.CommonServices));
            })
                );

            daterangepicker.Binding.AddBinding(ViewModel, vm => vm.StartDate, w => w.StartDateOrNull);
            daterangepicker.Binding.AddBinding(ViewModel, vm => vm.EndDate, w => w.EndDateOrNull);

            AuthorEntityviewmodelentry.Binding.AddBinding(
                ViewModel,
                vm => vm.Author,
                w => w.Subject
                ).InitializeFromSource();


            AccountableEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel>
                    (ServicesConfig.CommonServices)
                );

            AccountableEntityviewmodelentry.Binding.AddBinding(
                ViewModel,
                vm => vm.AccountableEmployee,
                w => w.Subject
                ).InitializeFromSource();

            yenumcomboStatus.ItemsEnum = typeof(CashRequest.States);
            yenumcomboStatus.Binding.AddBinding(
                ViewModel,
                e => e.State,
                w => w.SelectedItemOrNull);
            yenumcomboStatus.ShowSpecialStateAll = true;


            UserRole?userRole = ViewModel.GetUserRole();

            //Для Роли Согласователя по-умолчанию Создана Подана,
            //для Роли Финансиста - Согласована,
            //для Кассира - Передана на Выдачу,

            //Иные роли - только видят только свои заявки, поэтому нужно скрытиь фильтр по авторам
            if (userRole == UserRole.Coordinator)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.Submited;
            }
            else if (userRole == UserRole.Financier)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.Agreed;
            }
            else if (userRole == UserRole.Cashier)
            {
                yenumcomboStatus.SelectedItem = CashRequest.States.GivenForTake;
            }
            else if (userRole == UserRole.Other)
            {
                AuthorEntityviewmodelentry.Visible = false;
                label3.Visible = false;
            }
        }
Exemplo n.º 4
0
        private void ConfigureDlg()
        {
            #region EntityViewModelEntry

            //Автор
            var currentEmployee = ViewModel.CurrentEmployee;
            AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee),
                                                                                  () =>
            {
                var employeeFilter = new EmployeeFilterViewModel
                {
                    Status = EmployeeStatus.IsWorking,
                };
                return(new EmployeesJournalViewModel(
                           employeeFilter,
                           UnitOfWorkFactory.GetDefaultFactory,
                           ServicesConfig.CommonServices));
            })
                );
            AuthorEntityviewmodelentry.Binding.AddBinding(ViewModel.Entity, x => x.Author, w => w.Subject)
            .InitializeFromSource();

            if (ViewModel.IsNewEntity)
            {
                ViewModel.Entity.Author = currentEmployee;
            }

            AuthorEntityviewmodelentry.Sensitive = false;

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

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

            SubdivisionEntityviewmodelentry.SetEntityAutocompleteSelectorFactory(
                new EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel>(
                    typeof(Subdivision),
                    () => new SubdivisionsJournalViewModel(
                        filter,
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeSelectorFactory
                        )
                    )
                );
            SubdivisionEntityviewmodelentry.Binding
            .AddBinding(
                ViewModel.Entity,
                s => s.Subdivision,
                w => w.Subject)
            .InitializeFromSource();
            SubdivisionEntityviewmodelentry.Sensitive = false;
            ViewModel.Entity.Subdivision = currentEmployee.Subdivision;

            //Причина расхода
            ExpenseCategoryEntityviewmodelentry
            .SetEntityAutocompleteSelectorFactory(ViewModel.ExpenseCategoryAutocompleteSelectorFactory);

            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(
                ViewModel.Entity,
                s => s.ExpenseCategory,
                w => w.Subject)
            .InitializeFromSource();

            ExpenseCategoryEntityviewmodelentry.CanEditReference = true;

            #endregion EntityViewModelEntry

            #region Combo

            //Организация
            speccomboOrganization.SetRenderTextFunc <Organization>(s => s.Name);
            var orgList = ViewModel.UoW.Session.QueryOver <Organization>().List();
            speccomboOrganization.ItemsList = orgList;
            speccomboOrganization.Binding.AddBinding(
                ViewModel.Entity,
                x => x.Organization,
                x => x.SelectedItem)
            .InitializeFromSource();

            if (speccomboOrganization.SelectedItem == null)
            {
                speccomboOrganization.SelectedItem = orgList.First();
            }

            //Смена ролей для админов
            comboIfAdminRoleChooser.ItemsEnum = typeof(UserRole);
            comboIfAdminRoleChooser.Binding.AddBinding(
                ViewModel,
                e => CashRequestViewModel.savedUserRole,
                w => w.SelectedItem).InitializeFromSource();
            comboIfAdminRoleChooser.SelectedItem = ViewModel.UserRole;
            comboIfAdminRoleChooser.Visible      = ViewModel.IsAdminPanelVisible;
            ybtnAdminRoleRemember.Visible        = ViewModel.IsAdminPanelVisible;
            ybtnAdminRoleRemember.Clicked       += (sender, args) => { ViewModel.RememberRole(comboIfAdminRoleChooser.SelectedItem); };

            #endregion

            #region TextEntry

            //Пояснение
            yentryExplanation.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.Explanation,
                (widget) => widget.Text)
            .InitializeFromSource();

            //Основание
            yentryGround.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.Basis,
                (widget) => widget.Buffer.Text)
            .InitializeFromSource();
            yentryGround.WrapMode = WrapMode.Word;

            //Причина отмены
            yentryCancelReason.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.CancelReason,
                (widget) => widget.Buffer.Text)
            .InitializeFromSource();
            yentryCancelReason.WrapMode = WrapMode.Word;


            //Причина отправки на пересогласование
            yentryReasonForSendToReapproval.Binding
            .AddBinding(
                ViewModel.Entity,
                e => e.ReasonForSendToReappropriate,
                (widget) => widget.Buffer.Text)
            .InitializeFromSource();
            yentryReasonForSendToReapproval.WrapMode = WrapMode.Word;


            #endregion TextEntry

            #region Buttons

            ybtnAccept.Clicked += (sender, args) =>
            {
                ViewModel.AcceptCommand.Execute();
            };
            ybtnApprove.Clicked += (sender, args) => ViewModel.ApproveCommand.Execute();
            ybtnCancel.Clicked  += (sender, args) => ViewModel.CancelCommand.Execute();
            //Передать на выдачу
            ybtnConveyForResults.Clicked += (sender, args) => ViewModel.ConveyForResultsCommand.Execute();
            //Отправить на пересогласование
            ybtnReturnForRenegotiation.Clicked += (sender, args) => ViewModel.ReturnToRenegotiationCommand.Execute();

            ybtnGiveSumm.Clicked += (sender, args) => ViewModel.GiveSumCommand.Execute();
            ybtnGiveSumm.Binding.AddBinding(ViewModel, vm => vm.CanGiveSum, w => w.Visible).InitializeFromSource();
            ybtnGiveSumm.Sensitive = ViewModel.Entity.ObservableSums.Any(x => x.Expense == null);


            ybtnAddSumm.Clicked    += (sender, args) => ViewModel.AddSumCommand.Execute();
            ybtnEditSum.Clicked    += (sender, args) => ViewModel.EditSumCommand.Execute();
            ybtnDeleteSumm.Clicked += (sender, args) => ViewModel.DeleteSumCommand.Execute();
            ybtnEditSum.Binding.AddBinding(ViewModel, vm => vm.CanEditSumSensitive, w => w.Sensitive).InitializeFromSource();

            //Visible
            ybtnAccept.Binding.AddBinding(ViewModel, vm => vm.CanAccept, w => w.Visible).InitializeFromSource();
            ybtnApprove.Binding.AddBinding(ViewModel, vm => vm.CanApprove, w => w.Visible).InitializeFromSource();
            ybtnCancel.Binding.AddBinding(ViewModel, vm => vm.CanCancel, w => w.Visible).InitializeFromSource();
            ybtnConveyForResults.Binding.AddBinding(ViewModel, vm => vm.CanConveyForResults, w => w.Visible).InitializeFromSource();
            ybtnReturnForRenegotiation.Binding.AddBinding(ViewModel, vm => vm.CanReturnToRenegotiation, w => w.Visible).InitializeFromSource();
            ybtnDeleteSumm.Binding.AddBinding(ViewModel, vm => vm.CanDeleteSum, w => w.Visible).InitializeFromSource();
            ybtnEditSum.Visible   = false;
            buttonSave.Clicked   += (sender, args) => ViewModel.AfterSaveCommand.Execute();
            buttonCancel.Clicked += (s, e) => { ViewModel.Close(false, QS.Navigation.CloseSource.Cancel); };

            #endregion Buttons

            #region Editibility

            yentryCancelReason.Binding.AddBinding(ViewModel, vm => vm.CanEditOnlyCoordinator, w => w.Sensitive).InitializeFromSource();
            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategorySensitive, w => w.Sensitive).InitializeFromSource();
            speccomboOrganization.Binding.AddBinding(ViewModel, vm => vm.CanEditOnlyinStateNAGandRoldFinancier, w => w.Sensitive).InitializeFromSource();

            #endregion Editibility

            #region Visibility

            labelBalansOrganizations.Visible  = ViewModel.VisibleOnlyForFinancer;
            ylabelBalansOrganizations.Visible = ViewModel.VisibleOnlyForFinancer;

            speccomboOrganization.Visible  = ViewModel.VisibleOnlyForFinancer;
            labelcomboOrganization.Visible = ViewModel.VisibleOnlyForFinancer;

            labelCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategoryVisibility, w => w.Visible);
            ExpenseCategoryEntityviewmodelentry.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategoryVisibility, w => w.Visible);

            yentryReasonForSendToReapproval.Visible = ViewModel.VisibleOnlyForStatusUpperThanCreated;
            labelReasonForSendToReapproval.Visible  = ViewModel.VisibleOnlyForStatusUpperThanCreated;

            yentryCancelReason.Visible = ViewModel.VisibleOnlyForStatusUpperThanCreated;
            labelCancelReason.Visible  = ViewModel.VisibleOnlyForStatusUpperThanCreated;

            if (ViewModel.Entity.State == CashRequest.States.New)
            {
                hseparator1.Visible = false;
                hseparator2.Visible = false;
                hseparator3.Visible = false;
            }

            #endregion Visibility

            ConfigureTreeView();

            ycheckHaveReceipt.Binding.AddBinding(
                ViewModel.Entity,
                e => e.HaveReceipt,
                w => w.Active)
            .InitializeFromSource();

            ylabelBalansOrganizations.Text = ViewModel.LoadOrganizationsSums();

            ylabelRole.Binding.AddFuncBinding(
                ViewModel,
                vm => vm.UserRole.GetEnumTitle(),
                w => w.Text
                ).InitializeFromSource();
            ylabelStatus.Binding.AddBinding(
                ViewModel,
                vm => vm.StateName,
                w => w.Text
                ).InitializeFromSource();
            ylabelStatus.Text = ViewModel.Entity.State.GetEnumTitle();

            if (ViewModel.Entity.State == CashRequest.States.Closed)
            {
                ytreeviewSums.Sensitive                   = false;
                ybtnAddSumm.Sensitive                     = false;
                ybtnAccept.Sensitive                      = false;
                ybtnApprove.Sensitive                     = false;
                ybtnCancel.Sensitive                      = false;
                ybtnDeleteSumm.Sensitive                  = false;
                ybtnEditSum.Sensitive                     = false;
                ybtnGiveSumm.Sensitive                    = false;
                ybtnConveyForResults.Sensitive            = false;
                ybtnReturnForRenegotiation.Sensitive      = false;
                speccomboOrganization.Sensitive           = false;
                yentryExplanation.Sensitive               = false;
                yentryGround.Sensitive                    = false;
                yentryCancelReason.Sensitive              = false;
                yentryReasonForSendToReapproval.Sensitive = false;
            }
        }