示例#1
0
        public void OpenTimesheetListTab(int userdId)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as TimesheetListView;

                if (view != null && tabItem.DropDownContent.Equals("Timesheets"))
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("Timesheets");
                ti.Header = th;
                ti.Content = new TimesheetListView(userdId);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#2
0
        private void OpenUriReport(Uri uri)
        {
            //Check whether we already have this issue open

            var ti = new RadTabItem();
            var th = new TabHeader(ti, this);
            th.headerLabel.Content = string.Format("Report [{0}]", "Name");
            ti.Header = th;
            ti.Content = new ReportTab(uri);
            ti.IsSelected = true;
            ti.DropDownContent = th.headerLabel.Content.ToString();

            MainTabControl.Items.Add(ti);
        }
示例#3
0
        private void ProcessTabChanges(TabChangedEventArgs tabChangedEventArgs, TabHeader tabHeader, ITab tab)
        {
            if (tabChangedEventArgs.ClearChanges)
            {
                tab.TabChanges.Clear();
            }
            else
            {
                if (tabChangedEventArgs.Changed)
                {
                    if (!tab.TabChanges.Contains(tabChangedEventArgs.PropertyName))
                    {
                        tab.TabChanges.Add(tabChangedEventArgs.PropertyName);
                    }
                }
                else
                {
                    if (tab.TabChanges.Contains(tabChangedEventArgs.PropertyName))
                    {
                        tab.TabChanges.Remove(tabChangedEventArgs.PropertyName);
                    }
                }
            }

            if (tab.TabChanges.Count > 0)
            {
                if (!tabHeader.headerLabel.Content.ToString().Contains("*"))
                {
                    tabHeader.headerLabel.Content = String.Format("* {0}", tabHeader.headerLabel.Content);
                    tab.RequiresSave = true;
                }
            }
            else
            {
                tabHeader.headerLabel.Content = tabHeader.headerLabel.Content.ToString().Replace("* ", "");
                tab.RequiresSave = false;
            }
        }
示例#4
0
        private void OpenPreferredEquipmentTab(CommonUtils.EquipmentTypeCode equipmentTypeCode)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as PreferredEquipmetListView;

                if (view != null)
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("{0} Preferred Equipment", GetPreferredEquipmentTitle(equipmentTypeCode));
                ti.Header = th;
                ti.Content = new PreferredEquipmetListView(equipmentTypeCode);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#5
0
        private void OpenTab(QuickIssue issue)
        {
            //Check whether we already have this issue open
            bool issueAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var issuePanel = tabItem.Content as IssuesPanel;

                if (issuePanel != null)
                {
                    if (issuePanel.IssueId == issue.Id)
                    {
                        //Issue is already open so select it
                        tabItem.IsSelected = true;
                        issueAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (issueAlreadyOpen == false)
            {
                var ti = new RadTabItem();

                MainTabControl.Items.Add(ti);
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = String.Format("Issue #{0}", issue.Id);
                ti.Header = th;
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();
                ti.Content = new IssuesPanel(issue.Id);

                if (CMS.EffectivePrivileges.IssueTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
示例#6
0
        private void OpenPipeSummaryListTab(List<int> ids)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as PipeSummaryListView;

                if (view != null)
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("Pipes");
                ti.Header = th;
                ti.Content = new PipeSummaryListView(ids);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#7
0
        private void OpenPipeTab(QuickPipe pipe)
        {
            if (pipe == null || !pipe.IsActive)
            {
                return;
            }

            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var pipesPanel = tabItem.Content as PipePanel;

                if (pipesPanel != null)
                {
                    if (pipesPanel.Pipe.Id == pipe.Id)
                    {
                        //Issue is already open so select it
                        tabItem.IsSelected = true;
                        tabAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = String.Format("Pipe {0}", pipe.Name);
                ti.Header = th;
                ti.Content = new PipePanel(pipe.Id);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.PipeTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
示例#8
0
        private void OpenMobilePlantTab(QuickMobilePlant mobilePlant)
        {
            if (mobilePlant == null || !mobilePlant.IsActive)
            {
                return;
            }

            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var mobilePlantPanel = tabItem.Content as MobilePlantPanel;

                if (mobilePlantPanel != null && mobilePlantPanel.ViewModel.Equipment != null)
                {
                    if (mobilePlantPanel.ViewModel.Equipment.Id == mobilePlant.Id)
                    {
                        //Issue is already open so select it
                        tabItem.IsSelected = true;
                        tabAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = String.Format("Mobile Plant: {0}", mobilePlant.Name);
                ti.Header = th;
                ti.Content = new MobilePlantPanel(mobilePlant.Id);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.MobilePlantTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
示例#9
0
        private void OpenMyInTrayListTab()
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as MyInTrayView;

                if (view != null)
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = "My In-Tray";

                ti.Header = th;
                MainTabControl.Items.Add(ti);

                var view = new MyInTrayView();
                view.IsLoaded += s1 =>
                {
                    ti.Content = view;
                    ti.IsSelected = true;
                    ti.DropDownContent = th.headerLabel.Content.ToString();
                };
            }
        }
示例#10
0
        private void OpenIssueGraphicSummaryListTab(List<int> ids, string graphicName)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as IssueSummaryListView;

                if (view != null && tabItem.Name.Contains(graphicName))
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("Issues for: {0}", graphicName);
                ti.Header = th;
                ti.Content = new IssueSummaryListView(ids, CommonUtils.SummaryViewType.GraphicRelatedIssues, string.Empty);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#11
0
        private void OpenIssueSummaryListTab(IssueSummaryDataTranferObject dto)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as IssueSummaryListView;

                if (view != null)
                {
                    if (view.SummaryType == dto.SummaryType && view.FilterName == dto.FilterName)
                    {
                        //Issue is already open so select it
                        tabItem.IsSelected = true;
                        tabAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                if (string.IsNullOrEmpty(dto.FilterName))
                {
                    th.headerLabel.Content = "Issues [All Statuses]";
                }
                else
                {
                    th.headerLabel.Content = string.Format("Issues [{0}]", dto.FilterName);
                }

                ti.Header = th;
                ti.Content = new IssueSummaryListView(dto.IssueIds, dto.SummaryType, dto.FilterName);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#12
0
        private void OpenFavoritesTab(CommonUtils.FavouriteType favouriteType)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as MyFavouritesView;

                if (view != null && view.FavouriteType == favouriteType)
                {
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);

                switch (favouriteType)
                {
                    case CommonUtils.FavouriteType.Document:
                        th.headerLabel.Content = "My Favourite Documents";
                        break;
                    case CommonUtils.FavouriteType.Issue:
                        th.headerLabel.Content = "My Favourite Issues";
                        break;
                    case CommonUtils.FavouriteType.DocumentRole:
                        th.headerLabel.Content = "Documents Frequently Used in My Role";
                        break;
                }

                ti.Header = th;

                var view = new MyFavouritesView();

                view.IsLoaded += s1 =>
                {
                    ti.Content = view;
                    ti.IsSelected = true;
                    ti.DropDownContent = th.headerLabel.Content.ToString();
                    MainTabControl.Items.Add(ti);
                };
                view.SetView(favouriteType);
            }
        }
示例#13
0
        private void OpenDocumentVersionPreview(DocumentVersion documentVersion)
        {
            const string HEADERLABEL = "Document Version Preview";

            bool found = false;
            RadTabItem foundTabItem = null;

            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var content = tabItem.Content as DocumentVersionPreview;
                if (content != null)
                {
                    foundTabItem = tabItem;
                    found = true;
                    break;
                }
            }

            if (found)
            {
                foundTabItem.Content = new DocumentVersionPreview(documentVersion);
            }
            else
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format(HEADERLABEL);
                ti.Header = th;
                ti.Content = new DocumentVersionPreview(documentVersion); //
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();
                MainTabControl.Items.Add(ti);
            }
        }
示例#14
0
        private void OpenDocumentTab(QuickDocument document)
        {
            if (document == null)
                return;

            //Check whether we already have this open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var panel = tabItem.Content as DocumentPanel;

                if (panel != null)
                {
                    if (panel.LoadedDocument.Id == document.Id)
                    {
                        //already open so select it
                        tabItem.IsSelected = true;
                        tabAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                ti.Content = new DocumentPanel(document);
                if (string.IsNullOrEmpty(document.Name))
                {
                    th.headerLabel.Content = String.Format("Document : {0}", document.Id);
                }
                else
                {
                    th.headerLabel.Content = String.Format("Document : {0}", document.Name);
                }

                ti.Header = th;

                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.DocumentTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
示例#15
0
        private void OpenDocumentsSummaryListTab(List<QuickDocument> quickDocuments)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as DocumentsSummaryListView;

                if (view != null)
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("Documents");
                ti.Header = th;
                ti.Content = new DocumentsSummaryListView(quickDocuments.Select(x => x.Id).ToList(), CommonUtils.FavouriteType.All); //
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }
示例#16
0
        private void OpenActiveOverrideSummaryListTab(SummaryViewDataTranferObject dto)
        {
            //Check whether we already have this issue open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var view = tabItem.Content as ActiveOverrideSummaryListView;

                if (view != null)
                {
                    //Issue is already open so select it
                    tabItem.IsSelected = true;
                    tabAlreadyOpen = true;
                    break;
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);
                th.headerLabel.Content = string.Format("Active Overrides");
                ti.Header = th;
                ti.Content = new ActiveOverrideSummaryListView(dto.IncludeRemoved);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);
            }
        }