private void ShowRelatedEntityList(Relationship relationship, string name)
        {
            var listViewType = FindLoadedType(name + "ListView");

            var addNewMethod =
                Items.GetType().GetMethod("AddNew", new[] { typeof(string) }).MakeGenericMethod(listViewType);
            var getMethod = Items.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public)
                            .First(m => m.IsGenericMethod && m.Name == "Get").MakeGenericMethod(listViewType);

            var key        = EntityName + "_" + name + "_List";
            var objectView = getMethod.Invoke(Items, new object[] { key }) ??
                             addNewMethod.Invoke(Items, new object[] { key });
            var entityListView = objectView as EntityListView;

            if (entityListView != null)
            {
                var entityId            = (Guid)State["EntityId"];
                CriteriaOperator filter = new BinaryOperator(relationship.ReferencingAttribute.Name, entityId, BinaryOperatorType.Equal);
                entityListView.FixedPredicate = filter;
                entityListView.InitEntityView(name);
                entityListView.Bind(name);
                var info = new XtraTabSmartPartInfo {
                    Title = name
                };
                Workspaces[WorkspaceNames.DetailContentWorkspace].Show(entityListView, info);
            }
        }
        private void CreateCommentsView()
        {
            commentsView = commentsView ?? Items.AddNew <CustomerCommentsView>();
            var info = new XtraTabSmartPartInfo
            {
                Title          = "Title",
                Text           = "Comments",
                PageHeaderFont = new Font("Comic Sans MS", 11.25F, FontStyle.Regular)
            };

            RegisterSmartPartInfo(commentsView, info);
        }
        private void ShowHistoryListView()
        {
            const string key         = "HistoryDetailListView";
            var          historyView = WorkItem.Items.Get <HistoryListView>(key) ?? WorkItem.Items.AddNew <HistoryListView>(key);
            var          info        = new XtraTabSmartPartInfo {
                Title = "History"
            };

            var entityId = (Guid)WorkItem.State["EntityId"];

            historyView.FixedPredicate = new BinaryOperator("ObjectId", entityId);
            historyView.InitEntityView("Audit");
            historyView.Bind("Audit");
            WorkItem.Workspaces[WorkspaceNames.DetailContentWorkspace].Show(historyView, info);
        }
Exemplo n.º 4
0
        private void ShowHistoryListView()
        {
            const string key         = "HistoryListView";
            var          historyView = WorkItem.Items.Get <HistroyListForm>(key) ?? WorkItem.Items.AddNew <HistroyListForm>(key);
            var          info        = new XtraTabSmartPartInfo {
                Title = "History"
            };

            var entityId = SelectEntityId;

            historyView.FormHistoryListView.FixedPredicate = new BinaryOperator("ObjectId", entityId);
            historyView.FormHistoryListView.InitEntityView("Audit");
            historyView.FormHistoryListView.Bind("Audit");
            historyView.ShowDialog();
        }
Exemplo n.º 5
0
        private void ShowDetailView()
        {
            const string key = "Details";

            _view = Items.Get <TView>(key);
            if (_view == null)
            {
                _view = Items.AddNew <TView>(key);
                _view.TurnOnChangeTracker();
            }
            var info = new XtraTabSmartPartInfo {
                Title = EntityName
            };

            Workspaces[WorkspaceNames.DetailContentWorkspace].Show(_view, info);
        }
        private void ShowNoteListView()
        {
            string key          = "NoteDetailListView";
            var    noteListView = WorkItem.Items.Get <NoteListView>(key);

            if (noteListView == null)
            {
                noteListView = WorkItem.Items.AddNew <NoteListView>(key);
                var info = new XtraTabSmartPartInfo {
                    Title = "Notes"
                };
                WorkItem.RegisterSmartPartInfo(noteListView, info);
                noteListView.InitEntityView("Note");
            }
            noteListView.FixedPredicate = new BinaryOperator("ObjectId", EntityId);
            noteListView.Bind("Note");
            WorkItem.Workspaces[WorkspaceNames.DetailContentWorkspace].Show(noteListView);
        }
Exemplo n.º 7
0
        public void OnShowProjectIteration(object sender, EventArgs e)
        {
            string key          = "ProjectIterationListView";
            var    taskListView = WorkItem.Items.Get <ProjectIterationListView>(key);

            if (taskListView == null)
            {
                taskListView = WorkItem.Items.AddNew <ProjectIterationListView>(key);
                var info = new XtraTabSmartPartInfo {
                    Title = "Iterations"
                };
                WorkItem.RegisterSmartPartInfo(taskListView, info);
                taskListView.InitEntityView("ProjectIteration");
            }
            taskListView.FixedPredicate = new BinaryOperator("ProjectId", EntityId);
            taskListView.Bind("ProjectIteration");
            WorkItem.Workspaces[WorkspaceNames.DetailContentWorkspace].Show(taskListView);
        }
        public void CanShowAndClose_XtraTabWorkspace()
        {
            Font tahoma9ptFont = new Font("Tahoma", 9.75f);
            var  smartPartInfo = new XtraTabSmartPartInfo {
                Text = "text", PageHeaderFont = tahoma9ptFont
            };
            var xtraTabWorkspace = new XtraTabWorkspace();

            xtraTabWorkspace.Show(_smartPart, smartPartInfo);

            xtraTabWorkspace.TabPages.Count.ShouldEqual(1);
            xtraTabWorkspace.SmartParts.Count.ShouldEqual(1);
            xtraTabWorkspace.SelectedTabPage.Text.ShouldEqual("text");
            xtraTabWorkspace.SelectedTabPage.Appearance.Header.Font.ShouldEqual(tahoma9ptFont);

            xtraTabWorkspace.Close(_smartPart);
            xtraTabWorkspace.TabPages.Count.ShouldEqual(0);
            xtraTabWorkspace.SmartParts.Count.ShouldEqual(0);
        }
        private void ShowTimeTrackingListView()
        {
            string key = "TimeTrackingDetailListView";
            var    timetrackingListView = WorkItem.Items.Get <TimeTrackingListView>(key);

            if (timetrackingListView == null)
            {
                timetrackingListView = WorkItem.Items.AddNew <TimeTrackingListView>(key);
                var info = new XtraTabSmartPartInfo {
                    Title = "Timetracking"
                };
                WorkItem.RegisterSmartPartInfo(timetrackingListView, info);
                timetrackingListView.InitEntityView("TimeTracking");
            }

            var entityId = (Guid)WorkItem.State["EntityId"];

            timetrackingListView.FixedPredicate = new BinaryOperator("OpportunityId", entityId);
            timetrackingListView.Bind("TimeTracking");
            WorkItem.Workspaces[WorkspaceNames.DetailContentWorkspace].Show(timetrackingListView);
        }