Esempio n. 1
0
        public override void Run()
        {
            if (!(this.Owner is ObjectController))
            {
                return;
            }
            ObjectController objectController = (ObjectController)this.Owner;
            IObjectSpace     objectSpace      = new ODataObjectSpace();
            var selectedId = objectSpace.GetObjectId(objectController.ObjectName, objectController.SelectedObject);
            var parameters = new ActionParameters(objectName, Guid.Empty, ViewShowType.Show)
            {
                { "ProjectId", selectedId },
                { "WorkingMode", workMode }
            };

            if (string.IsNullOrEmpty(objectName))
            {
                objectName = objectController.ObjectName;
                parameters = new ActionParameters(objectName, selectedId, ViewShowType.Show)
                {
                    { "WorkingMode", workMode }
                };
            }
            App.Instance.Invoke(objectName, "Detail", parameters);
        }
Esempio n. 2
0
        public override void Run()
        {
            if (!(this.Owner is ListController))
            {
                return;
            }
            ListController listController = (ListController)this.Owner;
            IObjectSpace   objectSpace    = new ODataObjectSpace();
            var            selectedId     = objectSpace.GetObjectId(listController.ObjectName, listController.SelectedObject);
            var            parameters     = new ActionParameters("ProjectTaskEffort", selectedId, ViewShowType.Show)
            {
                { "WorkingMode", EntityDetailWorkingMode.Edit }
            };

            App.Instance.Invoke("ProjectTaskEffort", "Detail", parameters);
        }
Esempio n. 3
0
        public override void Run()
        {
            if (!(Owner is ObjectController))
            {
                return;
            }
            ObjectController objectController = (ObjectController)Owner;
            string           objectName       = objectController.ObjectName;
            Guid             selectedId       = Guid.Empty;
            IObjectSpace     objectSpace      = new ODataObjectSpace();

            selectedId = objectSpace.GetObjectId(objectName, objectController.SelectedObject);
            var parameters = new ActionParameters(objectName, selectedId, ViewShowType.Show);

            App.Instance.Invoke("TimeTrackingDetail", "TimeTrackingAction", parameters);
        }
Esempio n. 4
0
        private int GetDataSourceIndex(IList datas, Guid oldguid)
        {
            IObjectSpace objectSpace = new ODataObjectSpace();

            int index = 0;

            foreach (object obj in datas)
            {
                Guid guid = objectSpace.GetObjectId(this.ObjectName, obj);
                if (guid == oldguid)
                {
                    return(index);
                }
                index++;
            }

            return(-1);
        }
Esempio n. 5
0
        public override void Run()
        {
            if (!(Owner is ObjectController))
            {
                return;
            }
            ObjectController objectController = (ObjectController)Owner;
            string           objectName       = objectController.ObjectName;
            Guid             selectedId       = Guid.Empty;
            IObjectSpace     objectSpace      = new ODataObjectSpace();

            selectedId = objectSpace.GetObjectId(objectName, objectController.SelectedObject);
            var parameters = new ActionParameters(objectName, selectedId, ViewShowType.Show);

            if (Owner is NoteController)
            {
                parameters.Add("ParentObjectName", ((NoteController)Owner).ParentObjectName);
            }
            App.Instance.Invoke("NoteDetail", "NoteAction", parameters);
        }
Esempio n. 6
0
        public override void Run()
        {
            var detailController = this.Owner as IObjectDetailController;

            if (detailController != null)
            {
                IController controller = this.Owner as IController;

                var message = new ActivateViewMessage(controller.WorkSpaceID, "History");
                message.Parameters = new ActionParameters(detailController.ObjectName, detailController.ObjectId, ViewShowType.Show);
                EventAggregationManager.SendMessage(message);
            }
            else
            {
                ObjectController objectController = (ObjectController)this.Owner;
                IObjectSpace     objectSpace      = new ODataObjectSpace();
                var selectedId = objectSpace.GetObjectId(objectController.ObjectName, objectController.SelectedObject);
                var parameters = new ActionParameters(objectController.ObjectName, selectedId, ViewShowType.Show);
                App.Instance.Invoke("History", "List", parameters);
                //message.Parameters = new ActionParameters(objectController.ObjectName,selectedId, ViewShowType.Show);
            }
        }
Esempio n. 7
0
        public override void Run()
        {
            Guard.ObjectIsInstanceOfType(Owner, typeof(ISelection), "Owner");
            Guard.ObjectIsInstanceOfType(Owner, typeof(IObjectAware), "Owner");
            var selection   = (ISelection)Owner;
            var objectAware = (IObjectAware)Owner;

            IObjectSpace objectSpace = new ODataObjectSpace();
            Guid         selectedId  = Guid.Empty;

            if (_workMode != EntityDetailWorkingMode.Add)
            {
                selectedId = objectSpace.GetObjectId(objectAware.ObjectName, selection.SelectedObject);
            }
            var parameters = new ActionParameters(objectAware.ObjectName, selectedId, ViewShowType.Show)
            {
                { "WorkingMode", _workMode }
            };
            var controllerName = objectAware.ObjectName;

            App.Instance.Invoke(controllerName, "Detail", parameters);
        }
Esempio n. 8
0
        public override void Run()
        {
            if (!(this.Owner is ObjectController))
            {
                return;
            }
            ObjectController objectController = (ObjectController)this.Owner;
            IObjectSpace     objectSpace      = new ODataObjectSpace();
            var selectedId = objectSpace.GetObjectId(objectController.ObjectName, objectController.SelectedObject);
            var parameters = new ActionParameters(objectName, Guid.Empty, ViewShowType.Show)
            {
                { "ProjectId", selectedId },
                { "WorkingMode", workMode }
            };

            if (string.IsNullOrEmpty(objectName))
            {
                objectName = objectController.ObjectName;
                parameters = new ActionParameters(objectName, selectedId, ViewShowType.Show)
                {
                    { "WorkingMode", workMode }
                };
            }
            BaseController filterController = objectController.Context.ControllerFinder.FindController <BaseController>("BaseControllerList");

            if (filterController != null)
            {
                Guid?projectId   = filterController.GetSelectedFilterProjectId();
                Guid?memberId    = filterController.GetSelectedMemberId();
                Guid?iterationId = filterController.GetSelectedIterationId();
                parameters.Add("ProjectId", projectId);
                parameters.Add("MemberId", memberId);
                parameters.Add("IterationId", iterationId);
            }
            App.Instance.Invoke(objectName, "Detail", parameters);
        }
Esempio n. 9
0
        private void ShowRelatedView(string relatedObjectName, string objectName, object selectedEntity)
        {
            var relationshipRoles = MetadataRepository.EntityRelationshipRoles.Where(role => role.Entity.PhysicalName == objectName && role.NavPanelDisplayOption == 1);
            EntityRelationship entityRelationship = relationshipRoles.Where(c =>
                                                                            c.EntityRelationship.EntityRelationshipRoles
                                                                            .FirstOrDefault(r => r != c &&
                                                                                            r.RelationshipRoleType != (int)RelationshipRoleType.Relationship &&
                                                                                            r.Entity.PhysicalName == relatedObjectName) != null).FirstOrDefault().EntityRelationship;
            EntityRelationshipType relationshipType = (EntityRelationshipType)entityRelationship.EntityRelationshipType;
            IObjectSpace           objectSpace      = new ODataObjectSpace();
            var    currentEntityRelationRole        = entityRelationship.EntityRelationshipRoles.Single(r => r.Entity.PhysicalName == objectName);
            string relationTitle = GetLocationCaption(currentEntityRelationRole.Entity.PhysicalName) + "-";

            if (relationshipType == EntityRelationshipType.OneToMany)
            {
                var roleType     = (RelationshipRoleType)currentEntityRelationRole.RelationshipRoleType;
                var relationship = entityRelationship.EntityRelationshipRelationships.Single().Relationship;
                if (roleType == RelationshipRoleType.OneToMany)
                {
                    var desiredEntityName   = relationship.ReferencingEntity.PhysicalName;
                    var entityId            = objectSpace.GetObjectId(objectName, selectedEntity);
                    CriteriaOperator filter = new BinaryOperator(relationship.ReferencingAttribute.Name, entityId, BinaryOperatorType.Equal);
                    var result = objectSpace.GetObjects(desiredEntityName, filter, null);
                    if (result.Count > 0)
                    {
                        var parameters = new ActionParameters(relatedObjectName, Guid.Empty, ViewShowType.Show)
                        {
                            { "FixedFilter", filter }
                        };
                        App.Instance.Invoke(relatedObjectName, "List", parameters);
                    }
                    else
                    {
                        XtraMessageBox.Show(GetLocationCaption("NoRelatedData"), GetLocationCaption("Katrin"),
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    var    entityName          = relationship.ReferencedEntity.PhysicalName;
                    string desiredPropertyName = relationship.ReferencingAttribute.PhysicalName;
                    Guid   currentId           = objectSpace.GetObjectId(objectName, selectedEntity);
                    var    currentObject       = objectSpace.GetOrNew(objectName, currentId, null);
                    var    propertyInfo        = currentObject.GetType().GetProperty(desiredPropertyName);
                    var    id = propertyInfo.GetValue(currentObject, null);
                    if (id != null)
                    {
                        var relatedObject = objectSpace.GetOrNew(this.Parameter, (Guid)id, string.Empty);
                        if (relatedObject == null)
                        {
                            MessageService.ShowMessage(GetLocationCaption("NoRelatedData"));
                            return;
                        }
                        string detail     = "Detail";
                        var    parameters = new ActionParameters(relatedObjectName, (Guid)id, ViewShowType.Show)
                        {
                            { "WorkingMode", EntityDetailWorkingMode.View }
                        };
                        App.Instance.Invoke(relatedObjectName, detail, parameters);
                    }
                    else
                    {
                        XtraMessageBox.Show(GetLocationCaption("NoRelatedData"),
                                            GetLocationCaption("Katrin"),
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                var relationshipRole = entityRelationship.EntityRelationshipRoles
                                       .Single(r => (RelationshipRoleType)r.RelationshipRoleType == RelationshipRoleType.Relationship);
                var desiredEntityRole = entityRelationship.EntityRelationshipRoles
                                        .Single(r => r != relationshipRole && r != currentEntityRelationRole);
                var desiredEntityPropertyName =
                    entityRelationship.EntityRelationshipRelationships.Select(r => r.Relationship)
                    .Single(r => r.ReferencedEntity.EntityId == desiredEntityRole.Entity.EntityId).
                    ReferencedAttribute.PhysicalName;
                var knownPropertyName = entityRelationship.EntityRelationshipRelationships.Select(r => r.Relationship)
                                        .Single(r => r.ReferencedEntity.EntityId == currentEntityRelationRole.Entity.EntityId).
                                        ReferencedAttribute.PhysicalName;

                CriteriaOperator filter = new BinaryOperator(knownPropertyName, objectSpace.GetObjectId(objectName, selectedEntity));
                var relationships       = objectSpace.GetObjects(relationshipRole.Entity.PhysicalName, filter, null);

                List <object>    desiredEntityIds = new List <object>();
                CriteriaOperator relatedFilter    = null;
                for (int index = 0; index < relationships.Count; index++)
                {
                    var relatedObject   = relationships[index];
                    var propertyInfo    = relatedObject.GetType().GetProperty(desiredEntityPropertyName);
                    var desiredEntityId = propertyInfo.GetValue(relatedObject, null);
                    desiredEntityIds.Add(desiredEntityId);
                    relatedFilter |= new BinaryOperator(desiredEntityPropertyName, desiredEntityId);
                }
                if (desiredEntityIds.Any())
                {
                    if (desiredEntityIds.Count == 1)
                    {
                        string detail     = "Detail";
                        var    parameters = new ActionParameters(relatedObjectName, (Guid)desiredEntityIds[0], ViewShowType.Show)
                        {
                            { "WorkingMode", EntityDetailWorkingMode.View }
                        };
                        App.Instance.Invoke(desiredEntityRole.Entity.PhysicalName, detail, parameters);
                    }
                    else
                    {
                        var parameters = new ActionParameters(desiredEntityRole.Entity.PhysicalName, Guid.Empty, ViewShowType.Show)
                        {
                            { "FixedFilter", relatedFilter }
                        };
                        App.Instance.Invoke(desiredEntityRole.Entity.PhysicalName, "List", parameters);
                    }
                }
                else
                {
                    XtraMessageBox.Show(GetLocationCaption("NoRelatedData"),
                                        GetLocationCaption("Katrin"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }