public CommonDocumentEquipmentModel(QuickInstrument quickObject, EquipmentType equipmentType, int documentId = 0)
 {
     EquipmentId = quickObject.Id;
     DocumentId = documentId;
     Name = quickObject.Name;
     Description = quickObject.Description;
     EquipmentType = equipmentType;
     //EquipmentSubTypeId = quickObject.InstrumentTypeId;
     IsActive = quickObject.IsActive;
     //Manufacturers = quickObject.Manufacturer;
     //Models = quickObject.Model;
     //MaintSystemId = quickObject.MaintSystemId;
 }
Beispiel #2
0
 private void RemoveInstrument(QuickInstrument quickInstrument)
 {
     if (!CMS.EffectivePrivileges.InstrumentTab.CanDelete && !CMS.EffectivePrivileges.AdminTab.CanModify)
     {
         return;
     }
     var popupDialog = new AddInstrumentRevisionHistoryDialog(quickInstrument.Id, quickInstrument.Name);
     popupDialog.Show();
     popupDialog.Closed +=
         (s2, e2) =>
         {
             if (popupDialog.DialogResult.HasValue && popupDialog.DialogResult.Value)
             {
                 var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
                 cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) =>
                 {
                     //Calls MainPage.CloseTab()
                     EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(quickInstrument);
                 };
                 cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Instrument, quickInstrument.Id, false, CMS.User.Id);
             }
         };
 }
Beispiel #3
0
        private void OpenInstrumentTab(QuickInstrument quickInstrument)
        {
            if (quickInstrument == null || !quickInstrument.IsActive)
            {
                return;
            }

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

                if (instrumentPanel != null && instrumentPanel.ViewModel.Instrument != null)
                {
                    if (instrumentPanel.ViewModel.Instrument.Id == quickInstrument.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("Instrument: {0}", quickInstrument.Name);
                ti.Header = th;
                ti.Content = new InstrumentPanel(quickInstrument.Id);
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();

                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.InstrumentTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
        public void OpenEquipmentHandler(object parameter)
        {
            CommonDocumentEquipmentModel model = parameter as CommonDocumentEquipmentModel;
            if (model != null)
            {
                //Opens OpenTab in MainPage.xaml.cs

                object publish = null;

                if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.ELECT.ToString())
                {
                    publish = new QuickElectrical { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive};
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.MECH.ToString())
                {
                    publish = new QuickMechanical { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.MOB.ToString())
                {
                    publish = new QuickMobilePlant { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.INSTR.ToString())
                {
                    publish = new QuickInstrument { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.PIPE.ToString())
                {
                    publish = new QuickPipe { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.CONTR.ToString())
                {
                    publish = new QuickControlSystem() { Id = model.EquipmentId, Name = model.Name };
                }

                if (publish != null)
                {
                    EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(publish);
                }
            }
        }
 private void ReinstateInstrument(QuickInstrument quickInstrument)
 {
     var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) => { mViewModel.ProcessSearchFilter(); ; };
     cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Instrument, quickInstrument.Id, true, CMS.User.Id);
 }
 private void OpenNewTab(QuickInstrument equipment)
 {
     EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(equipment);
 }