public CommonDocumentEquipmentModel(QuickPipe quickObject, EquipmentType equipmentType, int documentId = 0)
 {
     EquipmentId = quickObject.Id;
     DocumentId = documentId;
     Name = quickObject.Name;
     Description = quickObject.Description;
     EquipmentType = equipmentType;
     //EquipmentSubTypeId = quickObject.ClassId;
     IsActive = quickObject.IsActive;
     //Manufacturers = quickObject.Manufacturer;
     //Models = quickObject.Model;
     MaintSystemId = string.Empty; //Pipe doent have MaintSystemId property
 }
Exemple #2
0
        private void RemovePipe(QuickPipe quickPipe)
        {
            if (!CMS.EffectivePrivileges.PipeTab.CanDelete && !CMS.EffectivePrivileges.AdminTab.CanModify)
            {
                return;
            }

            var popupDialog = new AddPipeRevisionHistoryDialog(quickPipe.Id, quickPipe.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(quickPipe);
                        };
                        cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Pipe, quickPipe.Id, false, CMS.User.Id);
                    }

                };
        }
Exemple #3
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());
                }
            }
        }
        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);
                }
            }
        }
        public void OpenPipeHandler(object parameter)
        {
            IssueRelatedPipe issueRelatedPipe = parameter as IssueRelatedPipe;
            if (issueRelatedPipe == null) throw new ArgumentNullException("parameter");

            //Opens OpenTab in MainPage.xaml.cs

            var quickPipe = new QuickPipe { Id = issueRelatedPipe.PipeId, IsActive = issueRelatedPipe.Pipe.IsActive };

            if (!string.IsNullOrEmpty(issueRelatedPipe.Pipe.FormattedName))
            {
                quickPipe.Name = issueRelatedPipe.Pipe.FormattedName;
            }
            else
            {
                quickPipe.Name = String.Format("{0}{1:D3}-{2}-{3}-{4}-{5}",
                issueRelatedPipe.Pipe.Area != null ? issueRelatedPipe.Pipe.Area.AreaNumber.ToString() : string.Empty,
                issueRelatedPipe.Pipe.SequenceNo,
                issueRelatedPipe.Pipe.PipeClass != null ? issueRelatedPipe.Pipe.PipeClass.Name : string.Empty,
                issueRelatedPipe.Pipe.PipeSize != null ? issueRelatedPipe.Pipe.PipeSize.Name : string.Empty,
                issueRelatedPipe.Pipe.PipeFluidCode != null ? issueRelatedPipe.Pipe.PipeFluidCode.Name : string.Empty,
                issueRelatedPipe.Pipe.PipeSpecialFeature != null ? issueRelatedPipe.Pipe.PipeSpecialFeature.Name : string.Empty);
            }

            EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(quickPipe);
        }
 private void ReinstatePipe(QuickPipe quickPipe)
 {
     var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) => { mViewModel.ProcessSearchFilter(); ; };
     cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Pipe, quickPipe.Id, true, CMS.User.Id);
 }
 private void OpenNewPipeTab(QuickPipe quickPipe)
 {
     if (quickPipe.IsActive)
     {
         EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(quickPipe);
     }
 }