public CommonDocumentEquipmentModel(QuickMobilePlant quickObject, EquipmentType equipmentType, int documentId = 0) { EquipmentId = quickObject.Id; DocumentId = documentId; Name = quickObject.Name; Description = quickObject.Description; EquipmentType = equipmentType; //EquipmentSubTypeId = quickObject.MobilePlantTypeId; IsActive = quickObject.IsActive; //Manufacturers = quickObject.Manufacturer; //Models = quickObject.Model; //MaintSystemId = quickObject.MaintSystemId; }
private void RemoveMobilePlant(QuickMobilePlant quickMobilePlant) { if (!CMS.EffectivePrivileges.MobilePlantTab.CanDelete && !CMS.EffectivePrivileges.AdminTab.CanModify) { return; } var popupDialog = new AddMobilePlantRevisionHistoryDialog(quickMobilePlant.Id, quickMobilePlant.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(quickMobilePlant); }; cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.MobilePlant, quickMobilePlant.Id, false, CMS.User.Id); } }; }
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()); } } }
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 ReinstateMobile(QuickMobilePlant quickMobilePlant) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) => { mViewModel.ProcessSearchFilter(); ; }; cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.MobilePlant, quickMobilePlant.Id, true, CMS.User.Id); }
private void OpenNewTab(QuickMobilePlant mobilePlant) { if (mobilePlant.IsActive) { EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(mobilePlant); } }