public CommonDocumentEquipmentModel(QuickElectrical quickObject, EquipmentType equipmentType, int documentId = 0)
 {
     EquipmentId = quickObject.Id;
     DocumentId = documentId;
     Name = quickObject.Name;
     Description = quickObject.Description;
     EquipmentType = equipmentType;
     //EquipmentSubTypeId = quickObject.ElectricalEquipmentTypeId;
     IsActive = quickObject.IsActive;
        // Manufacturers = quickObject.Manufacturer;
     //Models = quickObject.Model;
     //MaintSystemId = quickObject.MaintSystemId;
 }
 private void ReinstateElectrical(QuickElectrical quickElectrical)
 {
     var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
         cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) => { mViewModel.ProcessSearchFilter(); };
         cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.ElectricalEquipment, quickElectrical.Id, true, CMS.User.Id);
 }
 private void OpenNewElectricalTab(QuickElectrical equipment)
 {
     EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(equipment);
 }
Ejemplo n.º 4
0
        private void RemoveElectricalEquipment(QuickElectrical quickElectrical)
        {
            if (!CMS.EffectivePrivileges.ElectricalTab.CanDelete && !CMS.EffectivePrivileges.AdminTab.CanModify)
            {
                return;
            }

            var popupDialog = new AddElectricalRevisionHistoryDialog(quickElectrical.Id, quickElectrical.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(quickElectrical);
                        };
                        cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.ElectricalEquipment, quickElectrical.Id, false, CMS.User.Id);
                    }
                };
        }
Ejemplo n.º 5
0
        private void OpenElectricalEquipmentTab(QuickElectrical quickElectrical)
        {
            if (quickElectrical == null || !quickElectrical.IsActive)
            {
                return;
            }

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

                if (mechanicalEquipmentPanel != null && mechanicalEquipmentPanel.ViewModel.Equipment != null)
                {
                    if (mechanicalEquipmentPanel.ViewModel.Equipment.Id == quickElectrical.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("Elect Equip: {0}", quickElectrical.Name);
                ti.Header = th;

                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();
                ti.Content = new ElectricalEquipmentPanel(quickElectrical.Id);
                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.ElectricalTab.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);
                }
            }
        }