private void Configure()
        {
            var journal = new PermissionControlledRepresentationJournal(model);

            journal.Mode            = multipleSelect ? JournalSelectMode.Multiple : JournalSelectMode.Single;
            journal.ObjectSelected += (sender, e) => {
                List <EntityNode> selectedResult = new List <EntityNode>();
                foreach (int selectedId in e.GetSelectedIds())
                {
                    selectedResult.Add(new EntityNode(selectedId, entityType));
                }
                OnEntitySelectedResult?.Invoke(sender, new JournalSelectedNodesEventArgs(selectedResult.ToArray()));
            };
            JournalTab = journal;
            JournalTab.TabNameChanged += (sender, e) => TabNameChanged?.Invoke(sender, e);
            JournalTab.TabClosed      += (sender, e) => {
                TabParent?.ForceCloseTab(this);
                journal.Destroy();
                Dispose();
            };
            journal.Destroyed += (sender, e) => {
                TabParent?.ForceCloseTab(this);
                journal.Destroy();
                Dispose();
            };
        }
Ejemplo n.º 2
0
 protected void OnCloseTab(bool askSave, CloseSource source = CloseSource.Self)
 {
     if (askSave)
     {
         TabParent.AskToCloseTab(this, source);
     }
     else
     {
         TabParent.ForceCloseTab(this, source);
     }
 }
Ejemplo n.º 3
0
        public void ForceCloseTab(ITdiTab tab, CloseSource source = CloseSource.External)
        {
            if (tab == ActiveDialog)
            {
                CloseDialog(source, false);
                return;
            }

            if (tab == Journal)
            {
                TabParent.ForceCloseTab(this, source);
                return;
            }
            TabParent.ForceCloseTab(tab, source);
        }
Ejemplo n.º 4
0
        private void ConfigureDlg()
        {
            var employeeDocumentsPermission = _commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(EmployeeDocument));

            if (Entity.Id != 0 && !employeeDocumentsPermission.CanRead)
            {
                _commonServices.InteractiveService
                .ShowMessage(QS.Dialog.ImportanceLevel.Error, "Недостаточно прав для просмотра документов", "Недостаточно прав");
                FailInitialize = true;
                TabParent?.ForceCloseTab(this, QS.Navigation.CloseSource.Self);
            }

            _canEdit =
                (employeeDocumentsPermission.CanUpdate || (Entity.Id == 0 && employeeDocumentsPermission.CanCreate)) && _canEditEmployee;

            buttonSave.Sensitive = _canEdit;

            comboCategory.ItemsEnum = typeof(EmployeeDocumentType);
            comboCategory.Sensitive = _canEdit;
            comboCategory.Binding
            .AddBinding(Entity, e => e.Document, w => w.SelectedItemOrNull)
            .InitializeFromSource();

            yentryPasSeria.MaxLength = 30;
            yentryPasSeria.Binding
            .AddBinding(Entity, e => e.PassportSeria, w => w.Text)
            .InitializeFromSource();
            yentryPassportNumber.MaxLength = 30;
            yentryPassportNumber.Binding
            .AddBinding(Entity, e => e.PassportNumber, w => w.Text)
            .InitializeFromSource();
            yentryDocName.Binding
            .AddBinding(Entity, e => e.Name, w => w.Text)
            .InitializeFromSource();

            ytextviewIssueOrg.Binding
            .AddBinding(Entity, e => e.PassportIssuedOrg, w => w.Buffer.Text)
            .InitializeFromSource();
            ydatePassportIssuedDate.Binding
            .AddBinding(Entity, e => e.PassportIssuedDate, w => w.DateOrNull)
            .InitializeFromSource();
            ycheckMainDoc.Sensitive = _canEdit;
            ycheckMainDoc.Binding
            .AddBinding(Entity, e => e.MainDocument, w => w.Active)
            .InitializeFromSource();
            OnDocumentTypeSelected(this, null);
        }
Ejemplo n.º 5
0
        private void ConfigureDlg()
        {
            _employeeDocumentsPermissionsSet = _commonServices.PermissionService
                                               .ValidateUserPermission(typeof(EmployeeDocument), _commonServices.UserService.CurrentUserId);

            if (Entity.Id != 0 && !_employeeDocumentsPermissionsSet.CanRead)
            {
                _commonServices.InteractiveService
                .ShowMessage(QS.Dialog.ImportanceLevel.Error, "Недостаточно прав для просмотра документов", "Недостаточно прав");
                FailInitialize = true;
                TabParent?.ForceCloseTab(this, QS.Navigation.CloseSource.Self);
            }

            var canUpdate = _employeeDocumentsPermissionsSet.CanUpdate ||
                            (Entity.Id == 0 && _employeeDocumentsPermissionsSet.CanCreate);

            foreach (var widget in table1.Children)
            {
                if (widget != GtkScrolledWindow)
                {
                    widget.Sensitive = canUpdate;
                }
            }
            buttonSave.Sensitive        = canUpdate;
            ytextviewIssueOrg.Sensitive = canUpdate;

            comboCategory.ItemsEnum = typeof(EmployeeDocumentType);
            comboCategory.Binding.AddBinding(Entity, e => e.Document, w => w.SelectedItemOrNull).InitializeFromSource();

            yentryPasSeria.MaxLength = 30;
            yentryPasSeria.Binding.AddBinding(Entity, e => e.PassportSeria, w => w.Text).InitializeFromSource();
            yentryPassportNumber.MaxLength = 30;
            yentryPassportNumber.Binding.AddBinding(Entity, e => e.PassportNumber, w => w.Text).InitializeFromSource();
            yentryDocName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();

            ytextviewIssueOrg.Binding.AddBinding(Entity, e => e.PassportIssuedOrg, w => w.Buffer.Text).InitializeFromSource();
            ydatePassportIssuedDate.Binding.AddBinding(Entity, e => e.PassportIssuedDate, w => w.DateOrNull).InitializeFromSource();
            ycheckMainDoc.Binding.AddBinding(Entity, e => e.MainDocument, w => w.Active).InitializeFromSource();
            OnDocumentTypeSelected(this, null);
        }
Ejemplo n.º 6
0
 protected void OnCloseTab(CloseSource source)
 {
     logger.Debug("Закрытие диалога {0}", number);
     TabParent.ForceCloseTab(this, source);
 }
Ejemplo n.º 7
0
 protected void OnCloseTab(CloseSource source)
 {
     TabParent.ForceCloseTab(this, source);
 }