public void AssociateWithObject(TreeListViewRow destination)
        {
            try
            {
                // Associate all selected objects
                foreach (var objectItem in ObjectViewModelLocator.GetObjectVM().SelectedItems)
                {
                    // With all selected requirements (m:n)
                    foreach (var requirementItem in RequirementViewModelLocator.GetRequirementVM().SelectedItems)
                    {
                        ObjectRequirementModel objectRequirementItem = new ObjectRequirementModel
                        {
                            IsNew              = true,
                            IsChanged          = false,
                            IsDeleted          = false,
                            Project_ID         = Globals.Project_ID,
                            Object_ID          = objectItem.ID,
                            Requirement_ID     = requirementItem.ID,
                            RequirementType_ID = requirementItem.RequirementType_ID,
                            ArticleNo          = requirementItem.ArticleNo,
                            ArticleHeader      = requirementItem.ArticleHeader,
                            //RequirementType = Globals.DraggedItem.Type,
                            ChildRequirements = new TD.ObservableItemCollection <ObjectRequirementModel>(),
                        };

                        foreach (var childItem in requirementItem.ChildRequirements)
                        {
                            ObjectRequirementModel objectRequirementChildItem = new ObjectRequirementModel
                            {
                                IsNew              = true,
                                IsChanged          = false,
                                IsDeleted          = false,
                                Project_ID         = Globals.Project_ID,
                                Object_ID          = objectRequirementItem.Object_ID,
                                Requirement_ID     = childItem.ID,
                                RequirementType_ID = childItem.RequirementType_ID,
                                //objectFunctionalityChildItem.FunctionParent_ID = childItem.Parent_ID;
                                ArticleNo         = childItem.ArticleNo,
                                ArticleHeader     = childItem.ArticleHeader,
                                ChildRequirements = new TD.ObservableItemCollection <ObjectRequirementModel>()
                            };
                            objectRequirementItem.ChildRequirements.Add(objectRequirementChildItem);
                        }
                        ;

                        ObjectRequirements.Add(objectRequirementItem);
                    }
                }
            }
            catch (Exception ex)
            {
                RadWindow.Alert(ex.Message);
            }
        }
        public void ObjectFilter(object sender, FilterEventArgs e)
        {
            ObjectViewModel ovm = ObjectViewModelLocator.GetObjectVM();
            ObjectModel     om  = ovm.SelectedItem;

            if (e.Item != null && om != null)
            {
                e.Accepted = (e.Item as ObjectRequirementModel).Object_ID == ObjectViewModelLocator.GetObjectVM().SelectedItem.ID&&
                             (e.Item as ObjectRequirementModel).IsDeleted == false;
            }
        }
Example #3
0
        private void SelectType(object p)
        {
            if (p != null)
            {
                TypeModel type = (TypeModel)p;
                // Change the type of the selected item of the type group
                switch (type.TypeGroup)
                {
                case "Object":
                    foreach (var item in ObjectViewModelLocator.GetObjectVM().SelectedItems)
                    {
                        item.ObjectType_ID = type.ID;
                    }
                    break;

                case "ControlObject":
                    foreach (var item in ControlObjectViewModelLocator.GetControlObjectVM().SelectedItems)
                    {
                        item.ControlObjectType_ID = type.ID;
                    }
                    break;

                case "Template":
                    foreach (var item in TemplateViewModelLocator.GetTemplateVM().SelectedItems)
                    {
                        item.TemplateType_ID = type.ID;
                    }
                    break;

                case "Property":
                    foreach (var item in PropertyViewModelLocator.GetPropertyVM().SelectedItems)
                    {
                        item.PropertyType_ID = type.ID;
                    }
                    break;

                case "Requirement":
                    foreach (var item in RequirementViewModelLocator.GetRequirementVM().SelectedItems)
                    {
                        item.RequirementType_ID = type.ID;
                    }
                    break;
                }
                CloseTrigger = true;
            }
        }