public AdminNavigationControl(MainPage mainPage)
        {
            // Required to initialize variables
            InitializeComponent();
            mMainPage = mainPage;
            Loaded += (s1, e1) => SetSplitterWidth(mMainPage);

            if (CMS.EffectivePrivileges.AdminTab.CanViewConfig || CMS.EffectivePrivileges.AdminTab.CanModifyConfig)
            {
                AdminConfigControl configControl = new AdminConfigControl();

                configControl.ReloadRequired += configControl_ReloadRequired;
                ConfigControl.Content = configControl;
            }

            int allUsers = (from u in CMS.Cache.Users select u).Count();
            int activeUsers = (from u in CMS.Cache.ActiveUsers select u).Count();

            EquipmentSummaryViewModel activeModel = new EquipmentSummaryViewModel("Active Users", activeUsers);
            ActiveUsersTotalControl.DataContext = activeModel;

            EquipmentSummaryViewModel inActiveModel = new EquipmentSummaryViewModel("Inactive Users", (allUsers - activeUsers));
            InactiveUsersTotalControl.DataContext = inActiveModel;
        }
        private void UpdateSummaryTotals()
        {
            var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetElectricalTotalsCompleted += (s, e) =>
            {
                var equipmentSummaryViewModel = new EquipmentSummaryViewModel("Electrical Equipments", e.Result.ElectricalsTotals);
                ElectricalEquipmentSummaryControl.DataContext = equipmentSummaryViewModel;

                var model = new EquipmentSummaryViewModel("Electrical Components", e.Result.ElectricalComponentsTotal);
                ElectricalComponentsSummaryControl.DataContext = model;
            };
            cmsWebServiceClient.GetElectricalTotalsAsync(CMS.EffectivePrivileges.AdminTab.CanView || CMS.EffectivePrivileges.AdminTab.CanModify || CMS.AppSetting.ShowInactiveEquipment);
        }
예제 #3
0
        private void SetUpFilteredLinkControl()
        {
            var filteredViewModel = new EquipmentSummaryViewModel("Filtered", 0) { IsHyperLink = true };

            //filtered link
            filteredViewModel.LinkClickedFunction = () =>
            {
                var summaryViewDataTranferObject = new SummaryViewDataTranferObject(CommonUtils.SummaryViewType.Pipes);
                summaryViewDataTranferObject.Payload = Pipes.Select(x => x.Id).ToList();

                EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(summaryViewDataTranferObject);
                return null;
            };
            FilteredControlDataContext = filteredViewModel;
            RaisePropertyChanged("FilteredControlDataContext");
        }
        public void SetCachedIdsAndFilteredLink()
        {
            //set cached doc ids.
            mFilteredQuickDocuments = telerikResultsGridControl.Items.OfType<QuickDocument>().ToList();
            CMS.Cache.FilteredExportDocIdList = mFilteredQuickDocuments.Select(item => item.Id).ToList();

            //filtered link
            mEquipmentSummaryViewModel = new EquipmentSummaryViewModel("Filtered", CMS.Cache.FilteredExportDocIdList.Count);
            mEquipmentSummaryViewModel.IsHyperLink = true;
            mEquipmentSummaryViewModel.LinkClickedFunction = () =>
            {
                var summaryViewDataTranferObject = new SummaryViewDataTranferObject(CommonUtils.SummaryViewType.Documents);
                summaryViewDataTranferObject.Payload = mFilteredQuickDocuments;

                EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(summaryViewDataTranferObject);
                return null;
            };

            DocumentsTotalSummaryControl.DataContext = mEquipmentSummaryViewModel;
        }
        private void UpdateDocumentTotals()
        {
            var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            //document totals
            cmsWebServiceClient.GetDocumentTotalsCompleted += (s1, e1) =>
            {
                var documentTotal = new EquipmentSummaryViewModel("Documents", e1.Result.DocumentsTotal);
                DocumentsSummaryControl.DataContext = documentTotal;

                var docVersionsModel = new EquipmentSummaryViewModel("Document Versions", e1.Result.DocumentVersionsTotal);
                DocumentVersionsSummaryControl.DataContext = docVersionsModel;

                var checkedOutModel = new EquipmentSummaryViewModel("Document Versions (Checked Out)", e1.Result.DocumentVersionsCheckedOut);
                DocumentVersionsCheckedOutSummaryControl.DataContext = checkedOutModel;
            };
            cmsWebServiceClient.GetDocumentTotalsAsync();
        }