private void AddRelatedIssueHandler(object parameter)
        {
            AddIssueDialog aid = new AddIssueDialog();

            aid.Closed += (s1, e1) =>
            {
                //Hadle dialog closed
                if (aid.DialogResult.HasValue && aid.DialogResult.Value)
                {
                    Issue newIssue = aid.Issue;

                    IssueRelatedMechanicalEquipment issueRelatedMechanicalEquipment = (from x in mMechanicalEquipment.IssueRelatedMechanicalEquipments
                                                                                       where x.IssueId == newIssue.Id
                                                                                             && x.MechanicalEquipmentId == mMechanicalEquipment.Id
                                                                                       select x).FirstOrDefault();
                    if (issueRelatedMechanicalEquipment == null)
                    {
                        IssueRelatedMechanicalEquipment ird = new IssueRelatedMechanicalEquipment
                        {
                            IssueId = newIssue.Id,
                            Issue = newIssue,
                            MechanicalEquipmentId = mMechanicalEquipment.Id,
                            MechanicalEquipment = mMechanicalEquipment
                        };

                        mMechanicalEquipment.IssueRelatedMechanicalEquipments.Add(ird);

                        LoadData();

                        Utils.OnCollectionChanged(EventAggregator, mMechanicalEquipment, "MechanicalRelatedIssuesViewModel", true);

                        OnCollectionChanged();
                    }

                }
            };

            aid.Show();
        }
예제 #2
0
        private void AddIssue()
        {
            var dialog = new AddIssueDialog();
            dialog.Show();

            ////the following never gets hit 0 not sure why but it could be becuase there is another dialog... not sure.   -[JB 4.8.2014]
            //dialog.Closed += (s1, e1) =>
            //{
            //    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            //    {
            //        QuickIssue quickIssue = dialog.QuickIssue;
            //        EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(quickIssue);
            //    }
            //};
        }
        private void AddRelatedIssueHandler(object parameter)
        {
            CMS.UiFactory.StartNew(() =>
            {
                AddIssueDialog aid = new AddIssueDialog();

                aid.Closed += (s1, e1) =>
                {
                    //Hadle dialog closed
                    if (aid.DialogResult.HasValue && aid.DialogResult.Value)
                    {
                        Issue newIssue = aid.Issue;

                        IssueRelatedIssue issueRelatedIssue = (from x in mIssue.IssueRelatedIssues
                            where x.IssueId == mIssue.Id
                                  && x.RelatedIssueId == newIssue.Id
                            select x).FirstOrDefault();

                        if (issueRelatedIssue == null)
                        {
                            IssueRelatedIssue ird = new IssueRelatedIssue
                            {
                                IssueId = mIssue.Id,
                                RelatedIssueId = newIssue.Id,
                            };

                            mIssue.IssueRelatedIssues.Add(ird);
                            mIssue.ModifiedObjects.RelatedIssuesModified = true;

                            ReloadData();

                            Utils.OnCollectionChanged(EventAggregator, mIssue, "IssueRelatedIssuesViewModel", true);

                            OnCollectionChanged();
                        }
                    }
                    else
                    {
                        IsBusy = false;
                    }
                };

                aid.Show();
            });
            IsBusy = true;
        }
        private void AddRelatedIssueHandler(object parameter)
        {
            AddIssueDialog aid = new AddIssueDialog();

            aid.Closed += (s1, e1) =>
            {
                //Hadle dialog closed
                if (aid.DialogResult.HasValue && aid.DialogResult.Value)
                {
                    Issue newIssue = aid.Issue;

                    IssueRelatedPipe issueRelatedPipe = (from x in mPipe.IssueRelatedPipes
                                                                     where x.IssueId == newIssue.Id
                                                                           && x.PipeId == mPipe.Id
                                                                     select x).FirstOrDefault();
                    if (issueRelatedPipe == null)
                    {
                        IssueRelatedPipe ird = new IssueRelatedPipe
                        {
                            IssueId = newIssue.Id,
                            Issue = newIssue,
                            PipeId = mPipe.Id,
                            Pipe = mPipe
                        };

                        mPipe.IssueRelatedPipes.Add(ird);
                        mPipe.ModifiedObjects.RelatedIssuesModified = true;

                        LoadData();

                        Utils.OnCollectionChanged(EventAggregator, mPipe, "PipeRelatedIssuesViewModel", true);

                        OnCollectionChanged();
                    }

                }
            };

            aid.Show();
        }
        private void AddRelatedIssueHandler(object parameter)
        {
            AddIssueDialog aid = new AddIssueDialog();

            aid.Closed += (s1, e1) =>
            {
                //Hadle dialog closed
                if (aid.DialogResult.HasValue && aid.DialogResult.Value)
                {
                    Issue newIssue = aid.Issue;

                    IssueRelatedControlSystem issueRelatedControlSystem = (from x in mControlSystem.IssueRelatedControlSystems
                                                                     where x.IssueId == newIssue.Id
                                                                           && x.ControlSystemId == mControlSystem.Id
                                                                     select x).FirstOrDefault();
                    if (issueRelatedControlSystem == null)
                    {
                        IssueRelatedControlSystem ird = new IssueRelatedControlSystem
                        {
                            IssueId = newIssue.Id,
                            Issue = newIssue,
                            ControlSystemId = mControlSystem.Id,
                            ControlSystem = mControlSystem
                        };

                        mControlSystem.IssueRelatedControlSystems.Add(ird);

                        LoadData();

                        Utils.OnCollectionChanged(EventAggregator, mControlSystem, "ControlSystemRelatedIssuesViewModel", true);

                        OnCollectionChanged();
                    }

                }
            };

            aid.Show();
        }
        private void AddButtonHandler(object parameter)
        {
            AddIssueDialog aid = new AddIssueDialog();

            aid.Closed += (s1, e1) =>
                              {
                                  //Hadle dialog closed
                                  if (aid.DialogResult.HasValue && aid.DialogResult.Value)
                                  {
                                      Issue newIssue = aid.Issue;

                                      IssueRelatedMobilePlant issueRelated = (from x in mMobilePlant.IssueRelatedMobilePlants
                                                                              where x.IssueId == newIssue.Id
                                                                                    && x.MobilePlantId == mMobilePlant.Id
                                                                              select x).FirstOrDefault();
                                      if (issueRelated == null)
                                      {
                                          IssueRelatedMobilePlant ird = new IssueRelatedMobilePlant
                                                                            {
                                                                                IssueId = newIssue.Id,
                                                                                Issue = newIssue,
                                                                                MobilePlantId = mMobilePlant.Id,
                                                                                MobilePlant = mMobilePlant
                                                                            };

                                          mMobilePlant.IssueRelatedMobilePlants.Add(ird);
                                          MobilePlantIssues.Add(ird);

                                          RaisePropertyChanged("MobilePlantIssues");
                                          Utils.OnCollectionChanged(EventAggregator, mMobilePlant, "MobilePlantIssuesViewModel", true);

                                          OnCollectionChanged();
                                      }

                                      //open created issue in a new tab
                                      EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(newIssue);
                                  }
                              };

            aid.Show();
        }