private DataMenuSettingDTO ToDataMenuSettingDTO(DR_Requester requester, DataMenuSetting entity, bool withDetails) { var result = new DataMenuSettingDTO(); if (withDetails) { foreach (var item in entity.DataMenuSearchableReportRelationship) { //دسترسی به خود گزارش هم کنترل شود if (bizEntityRelationshipTail.DataIsAccessable(requester, item.EntityRelationshipTail)) { if (bizEntityReport.DataIsAccessable(requester, item.EntitySearchableReport.EntityReport)) { var tail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail); var entityReportDTO = new EntitySearchableReportDTO(); bizEntitySearchableReport.ToEntitySearchableReportDTO(item.EntitySearchableReport, entityReportDTO, withDetails); result.SearchableReportRelationships.Add(ToDataMenuSearchableReportRelationshipDTO(item, tail, entityReportDTO)); } } } foreach (var item in entity.DataMenuDataViewRelationship) { if (bizEntityRelationshipTail.DataIsAccessable(requester, item.EntityRelationshipTail)) { var tail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail); result.DataViewRelationships.Add(ToDataMenuDataViewRelationshipDTO(item, tail)); } } foreach (var item in entity.DataMenuGridViewRelationship) { if (bizEntityRelationshipTail.DataIsAccessable(requester, item.EntityRelationshipTail)) { var tail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail); result.GridViewRelationships.Add(ToDataMenuGridViewRelationshipDTO(item, tail)); } } foreach (var item in entity.DataMenuDataItemReportRelationship) { if (bizEntityReport.DataIsAccessable(requester, item.EntityDataItemReportID)) { var entityReportDTO = new EntityDataItemReportDTO(); bizEntityDataItemReport.ToEntityDataItemReportDTO(item.EntityDataItemReport, entityReportDTO, false); result.DataItemReports.Add(ToDataMenuDataItemReportRelationshipDTO(item, entityReportDTO)); } } } result.EntityID = entity.TableDrivedEntityID; result.EntityListViewID = entity.EntityListViewID; result.Name = entity.Name; if (entity.DataMenuForViewEntity.Any()) { result.RelationshipID = entity.DataMenuForViewEntity.First().RelationshipID; if (withDetails) { if (bizRelationship.DataIsAccessable(requester, entity.DataMenuForViewEntity.First().Relationship, false, true)) { result.Relationship = bizRelationship.ToRelationshipDTO(entity.DataMenuForViewEntity.First().Relationship); } } result.TargetDataMenuSettingID = entity.DataMenuForViewEntity.First().TargetDataMenuSettingID; if (withDetails) { result.DataMenuSetting = ToDataMenuSettingDTO(requester, entity.DataMenuForViewEntity.First().DataMenuSetting1, false); } } result.ID = entity.ID; if (withDetails) { result.IconContent = entity.IconContent; } return(result); }