Exemplo n.º 1
0
        public ExportDefinitionForm(Api api, string directory, string fileName, ExportDefinition export)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (directory == null)
            {
                throw new ArgumentNullException(nameof(directory));
            }
            if (export == null)
            {
                throw new ArgumentNullException(nameof(export));
            }

            _api       = api;
            _directory = directory;
            _fileName  = fileName;
            _entity    = export.Entity;
            _filters   = export.Filters;

            InitializeComponent();

            if (fileName != null)
            {
                Text += " - " + fileName;
            }

            VisualStyleUtil.StyleListView(_availableFields);
            VisualStyleUtil.StyleListView(_reportFields);

            _entityGroup = new ListViewGroup(HumanText.GetEntityName(_entity));
            _reportFields.Groups.Add(_entityGroup);

            var selectPath = new Button
            {
                Image = NeutralResources.navigate_close
            };

            _path.RightButtons.Add(selectPath);

            selectPath.Click += selectPath_Click;

            foreach (var field in export.Fields)
            {
                AddReportField(field);
            }

            SetSelectedEntity(EntityMemberPath.Empty);

            UpdateEnabled();
        }
Exemplo n.º 2
0
        private void SetSelectedEntity(EntityMemberPath path)
        {
            if (path.Count == 0)
            {
                _selectedEntity = _entity;
                _path.Text      = HumanText.GetEntityName(_selectedEntity);
            }
            else
            {
                _selectedEntity = _api.GetEntitySchema(((EntityForeign)path.Tail).LinkTable);
                _path.Text      = HumanText.GetEntityMemberPath(path);
            }

            _availableFields.BeginUpdate();
            _availableFields.Items.Clear();

            foreach (var member in _selectedEntity.Members.OrderBy(HumanText.GetMemberName))
            {
                var memberPath = new EntityMemberPath(path, member);

                if (
                    (member is EntityField || member is EntityCalculatedField) &&
                    _reportFields.Items.Cast <ListViewItem>().All(p => !p.Tag.Equals(memberPath))
                    )
                {
                    _availableFields.Items.Add(new ListViewItem(HumanText.GetMemberName(member))
                    {
                        Tag = memberPath
                    });
                }
            }

            _availableFields.EndUpdate();

            UpdateEnabled();

            if (_autoCompleteForm != null)
            {
                _autoCompleteForm.Dispose();
                _autoCompleteForm = null;
            }
        }
Exemplo n.º 3
0
        public EntityPathSelectorTreeView(Api api, EntitySchema entity)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _api = api;

            var node = new TreeNode(HumanText.GetEntityName(entity));

            node.Tag = entity;
            node.Nodes.Add(new TreeNode());
            Nodes.Add(node);
            node.Expand();
        }
Exemplo n.º 4
0
 public EntityDrawer(EntitySchema entity)
 {
     Entity = entity;
     _name  = HumanText.GetEntityName(Entity);
 }