Beispiel #1
0
        //public RelationshipFilterDTO GetRelationshipFilter(int RelationshipFiltersID)
        //{
        //    List<RelationshipFilterDTO> result = new List<RelationshipFilterDTO>();
        //    using (var projectContext = new DataAccess.MyProjectEntities())
        //    {
        //        var RelationshipFilters = projectContext.RelationshipSearchFilter.First(x => x.ID == RelationshipFiltersID);
        //        return ToRelationshipFilterDTO(RelationshipFilters);
        //    }
        //}
        public RelationshipFilterDTO ToRelationshipFilterDTO(RelationshipSearchFilter item)
        {
            RelationshipFilterDTO result = new RelationshipFilterDTO();

            result.ID = item.ID;
            //result.Enabled = item.Enabled;
            BizEntityRelationshipTail bizEntityRelationshipTail = new BizEntityRelationshipTail();

            //if (item.SearchRelationshipTailID != null)
            //{
            //    result.SearchRelationshipTailID = item.SearchRelationshipTailID.Value;
            //    result.SearchRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);
            //}
            result.RelationshipID          = item.RelationshipID;
            result.SearchColumnID          = item.SearchColumnID;
            result.ValueColumnID           = item.ValueColumnID;
            result.ValueRelationshipTailID = item.ValueRelationshipTailID ?? 0;
            if (item.EntityRelationshipTail != null)
            {
                result.ValueRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);
            }

            //          result.SearchRelationshipTailID = item.SearchRelationshipTailID ?? 0;
            //if (item.EntityRelationshipTail != null)
            //    result.SearchRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);

            //foreach (var column in item.RelationshipFilterColumns)
            //{
            //    result.RelationshipFilterColumns.Add(new RelationshipFilterColumnDTO() { SearchColumnID = column.SearchColumnID, ValueColumnID = column.ValueColumnID });
            //}
            return(result);
        }
        private void SetValueColumns(RelationshipFilterDTO condition)
        {
            colValueColumns.DisplayMemberPath       = "Name";
            colValueColumns.SelectedValueMemberPath = "ID";
            BizTableDrivedEntity biz = new BizTableDrivedEntity();

            if (condition.ValueRelationshipTailID == 0)
            {
                var entity = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), Relatoinship.EntityID1, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
                condition.vwValueColumns = entity.Columns;;
            }
            else
            {
                var relationshipTail = bizEntityRelationshipTail.GetEntityRelationshipTail(MyProjectManager.GetMyProjectManager.GetRequester(), condition.ValueRelationshipTailID);
                var entity           = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), relationshipTail.TargetEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
                condition.vwValueColumns = entity.Columns;
            }
        }