private void LinkIssueButtonHandler(object parameter)
        {
            AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        List<Issue> toAdd = dialog.SelectedIssues.ToList();

                        foreach (var issue in toAdd)
                        {
                            var existing = (from x in mMechanicalEquipment.IssueRelatedMechanicalEquipments
                                            where x.IssueId == issue.Id
                                                  && x.MechanicalEquipmentId == mMechanicalEquipment.Id
                                            select x).FirstOrDefault();

                            if (existing == null)
                            {
                                IssueRelatedMechanicalEquipment ird = new IssueRelatedMechanicalEquipment
                                {
                                    IssueId = issue.Id,
                                    Issue = issue,
                                    MechanicalEquipmentId = mMechanicalEquipment.Id,
                                    MechanicalEquipment = mMechanicalEquipment
                                };

                                mMechanicalEquipment.IssueRelatedMechanicalEquipments.Add(ird);

                            }
                        }

                        if (toAdd.Any())
                        {
                            LoadData();

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

                            OnCollectionChanged();
                        }
                    }
                };
        }
Пример #2
0
        private void AddIssueButtonHandler(object parameter)
        {
            AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        List<Issue> toAdd = dialog.SelectedIssues.ToList();

                        foreach (var issue in toAdd)
                        {
                            //if (mTimesheet.TimesheetRows.FirstOrDefault(x => x.IssueId == issue.Id) == null) //Add only issue that don't exist in timesheets yet
                            //{
                            AddIssueToTimesheets(issue);
                            //}
                        }
                        mView.TelerikGrid.Rebind();
                        RaisePropertyChanged("IssueTimesheetRowModels");
                    }
                };
        }
        private void LinkIssueButtonHandler(object parameter)
        {
            CMS.UiFactory.StartNew(() =>
            {

                AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();
                dialog.Show();
                dialog.Closed +=
                    (s1, e1) =>
                    {
                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            List<Issue> toAdd = dialog.SelectedIssues.ToList();

                            foreach (var issue in toAdd)
                            {
                                var existing = (from x in mIssue.IssueRelatedIssues
                                    where x.IssueId == mIssue.Id
                                          && x.RelatedIssueId == issue.Id
                                    select x).FirstOrDefault();

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

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

                            if (toAdd.Any())
                            {
                                ReloadData();

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

                                OnCollectionChanged();
                            }
                        }
                        else
                        {
                            IsBusy = false;
                        }
                    };
            });
            IsBusy = true;
        }
        private void LinkIssueButtonHandler(object parameter)
        {
            AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        List<Issue> toAdd = dialog.SelectedIssues.ToList();

                        foreach (var issue in toAdd)
                        {
                            var existing = (from x in mPipe.IssueRelatedPipes
                                            where x.IssueId == issue.Id
                                                  && x.PipeId == mPipe.Id
                                            select x).FirstOrDefault();

                            if (existing == null)
                            {
                                IssueRelatedPipe ird = new IssueRelatedPipe
                                {
                                    IssueId = issue.Id,
                                    Issue = issue,
                                    PipeId = mPipe.Id,
                                    Pipe = mPipe
                                };

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

                            }
                        }

                        if (toAdd.Any())
                        {
                            LoadData();

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

                            OnCollectionChanged();
                        }
                    }
                };
        }
        private void LinkIssueButtonHandler(object parameter)
        {
            AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        List<Issue> toAdd = dialog.SelectedIssues.ToList();

                        foreach (var issue in toAdd)
                        {
                            var existing = (from x in mControlSystem.IssueRelatedControlSystems
                                            where x.IssueId == issue.Id
                                                  && x.ControlSystemId == mControlSystem.Id
                                            select x).FirstOrDefault();

                            if (existing == null)
                            {
                                IssueRelatedControlSystem ird = new IssueRelatedControlSystem
                                {
                                    IssueId = issue.Id,
                                    Issue = issue,
                                    ControlSystemId = mControlSystem.Id,
                                    ControlSystem = mControlSystem
                                };

                                mControlSystem.IssueRelatedControlSystems.Add(ird);

                            }
                        }

                        if (toAdd.Any())
                        {
                            LoadData();

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

                            OnCollectionChanged();
                        }
                    }
                };
        }
        private void LinkButtonHandler(object parameter)
        {
            AddRelatedIssueDialog dialog = new AddRelatedIssueDialog();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        List<Issue> toAdd = dialog.SelectedIssues.ToList();

                        foreach (var issue in toAdd)
                        {
                            IssueRelatedMobilePlant existing = (from x in mMobilePlant.IssueRelatedMobilePlants
                                                                where x.IssueId == issue.Id
                                                                      && x.MobilePlantId == mMobilePlant.Id
                                                                select x).FirstOrDefault();
                            if (existing == null)
                            {
                                IssueRelatedMobilePlant mpi = new IssueRelatedMobilePlant
                                                                  {
                                                                      IssueId = issue.Id,
                                                                      Issue = issue,
                                                                      MobilePlantId = mMobilePlant.Id,
                                                                      MobilePlant = mMobilePlant
                                                                  };

                                mMobilePlant.IssueRelatedMobilePlants.Add(mpi);
                                MobilePlantIssues.Add(mpi);
                            }
                        }

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

            dialog.Show();
        }