private TableDrivedEntityDTO GetTableDrivedDTO(DR_Requester requester, int entityID) { if (Entities.Any(x => x.ID == entityID)) { return(Entities.First(x => x.ID == entityID)); } else { var entity = bizTableDrivedEntity.GetSimpleEntity(requester, entityID); Entities.Add(entity); return(entity); } }
public long GetExternalReportKey(DR_Requester requester, int reportID, int entityID, DP_SearchRepository searchItem) { BizEntityExternalReport bizEntityExternalReport = new BizEntityExternalReport(); BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity(); SearchRequestManager searchRequestManager = new SearchRequestManager(); var query = searchRequestManager.GetSelectFromExternal(requester, entityID, searchItem, true); var entity = bizTableDrivedEntity.GetSimpleEntity(requester, entityID); if (query != null) { // var transactionresult = ConnectionManager.ExecuteTransactionalQueryItems(allQueryItems.Where(x => !string.IsNullOrEmpty(x.Query)).ToList()); //var guid = Guid.NewGuid().ToString(); var id = 0; using (var model = new MyIdeaDataDBEntities()) { var newItem = new ExternalReportKeys(); newItem.DateTime = DateTime.Now; newItem.RequesterID = requester.Identity; newItem.ReportID = reportID; model.ExternalReportKeys.Add(newItem); model.SaveChanges(); id = newItem.ID; } if (id != 0) { var inserted = bizEntityExternalReport.InsertDataIntoExternalReportTable(requester, reportID, entityID, id, query.Item2); if (inserted) { return(id); } } } return(0); }
//public DP_EntityActionActivitiesResult GetEntityActionActivities(DP_EntityActionActivitiesRequest request) //{ // return bizPackageManager.GetEntityActionActivities(request); //} public TableDrivedEntityDTO GetSimpleEntity(DR_Requester requester, int entityID, List <SecurityAction> specificActions = null) { return(bizTableDrivedEntity.GetSimpleEntity(requester, entityID, specificActions)); }
public DataMenuResult GetDataMenu(DR_Requester requester, DP_DataView dataItem, int dataMenuSettingID) { DataMenuResult result = new DataMenuResult(); List <DataMenu> resultMenus = new List <DataMenu>(); result.DataMenus = resultMenus; var entityID = dataItem.TargetEntityID; var simpleEntity = bizTableDrivedEntity.GetSimpleEntity(requester, entityID); if (simpleEntity == null) { return(null); } DataMenuSettingDTO dataMenuSetting = null; if (dataMenuSettingID != 0) { dataMenuSetting = GetDataMenuSetting(requester, dataMenuSettingID, true); } else { dataMenuSetting = GetDefaultDataMenuSetting(requester, entityID, true); } if (dataMenuSetting != null) { result.DataMenuSettingName = dataMenuSetting.Name; } if (simpleEntity.IsView) { if (dataMenuSetting != null) { if (dataMenuSetting.RelationshipID != 0 && dataMenuSetting.TargetDataMenuSettingID != 0) { var relationship = bizRelationship.GetRelationship(dataMenuSetting.RelationshipID); var dataView = CreateDataView(requester, dataItem, relationship); return(GetDataMenu(requester, dataView, dataMenuSetting.TargetDataMenuSettingID)); } } //var fullEntity = bizTableDrivedEntity.GetTableDrivedEntity(requester, entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships); //if (fullEntity.Relationships.Any()) //{ // foreach (var relationsip in fullEntity.Relationships) // { // var dataView = CreateDataView(dataItem, relationsip); // var menu = AddMenu(result, relationsip.Alias, "", DataMenuType.ViewRel); // menu.ViewRelTargetDataItem = dataView; // } //} } else { var dataEntryRootMenu = AddMenu(resultMenus, "نمایش/اصلاح داده", "", DataMenuType.Form, dataItem); //آرشیو داده // BizArchive bizArchive = new BizArchive(); if (bizTableDrivedEntity.DataIsAccessable(requester, entityID, new List <SecurityAction>() { SecurityAction.ArchiveView, SecurityAction.ArchiveEdit })) { var archiveRootMenu = AddMenu(resultMenus, "آرشیو", "", DataMenuType.Archive, dataItem); } //نامه های داده // BizLetterTemplate bizLetterTemplate = new BizLetterTemplate(); if (bizTableDrivedEntity.DataIsAccessable(requester, entityID, new List <SecurityAction>() { SecurityAction.LetterView, SecurityAction.LetterEdit })) { var letterRootMenu = AddMenu(resultMenus, "نامه ها", "", DataMenuType.Letter, dataItem); } //جریان کارهای مرتبط if (bizProcess.EntityHasAnyProcess(entityID)) { var workflowRootMenu = AddMenu(resultMenus, "جریان کار", "", DataMenuType.Workflow, dataItem); } ////لینک های داده //BizDataLink bizDataLink = new MyModelManager.BizDataLink(); //var datalinks = bizDataLink.GetDataLinkByEntitiyID(requester, entityID); //if (datalinks.Any()) //{ // var dataViewRootMenu = AddMenu(resultMenus, "لینک داده", "", DataMenuType.Folder,null); // foreach (var datalink in datalinks) // { // var datalinkMenu = AddMenu(dataViewRootMenu.SubMenus, datalink.ReportTitle, "", DataMenuType.DataLink, dataItem); // datalinkMenu.Datalink = datalink; // } //} //گزارشهای داده های مرتبط if (dataMenuSetting != null) { if (dataMenuSetting.SearchableReportRelationships.Any()) { var relationshipReportRootMenu = AddMenu(resultMenus, "گزارش داده های مرتبط", "", DataMenuType.Folder, null); foreach (var group in dataMenuSetting.SearchableReportRelationships.GroupBy(x => x.Group1 ?? "")) { DataMenu parentGroupMenu = GetGroupMenu(relationshipReportRootMenu, group.Key); foreach (var rel in group) { var menu = AddMenu(parentGroupMenu.SubMenus, rel.SearchableReportReport.ReportTitle, "", DataMenuType.RelationshipTailSearchableReport, dataItem); menu.SearchableReportRelationshipTail = rel; } } } //نمای داده های مرتبط if (dataMenuSetting.DataViewRelationships.Any()) { var dataViewRootMenu = AddMenu(resultMenus, "نمایش داده های مرتبط", "", DataMenuType.Folder, null); foreach (var group in dataMenuSetting.DataViewRelationships.GroupBy(x => x.Group1 ?? "")) { DataMenu parentGroupMenu = GetGroupMenu(dataViewRootMenu, group.Key); foreach (var rel in group) { var dataViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.RelationshipTail.TargetEntityAlias, rel.RelationshipTail.EntityPath, DataMenuType.RelationshipTailDataView, dataItem); dataViewRelMenu.DataviewRelationshipTail = rel.RelationshipTail; dataViewRelMenu.TargetDataMenuSettingID = rel.TargetDataMenuSettingID; } } } if (dataMenuSetting.GridViewRelationships.Any()) { var gridViewRootMenu = AddMenu(resultMenus, "گرید داده های مرتبط", "", DataMenuType.Folder, null); foreach (var group in dataMenuSetting.GridViewRelationships.GroupBy(x => x.Group1 ?? "")) { DataMenu parentGroupMenu = GetGroupMenu(gridViewRootMenu, group.Key); foreach (var rel in group) { var gridViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.RelationshipTail.TargetEntityAlias, rel.RelationshipTail.EntityPath, DataMenuType.RelationshipTailDataGrid, dataItem); gridViewRelMenu.GridviewRelationshipTail = rel.RelationshipTail; gridViewRelMenu.TargetDataMenuSettingID = rel.TargetDataMenuSettingID; } } } if (dataMenuSetting.DataItemReports.Any()) { var gridViewRootMenu = AddMenu(resultMenus, "گزارشات مورد داده", "", DataMenuType.Folder, null); foreach (var group in dataMenuSetting.DataItemReports.GroupBy(x => x.Group1 ?? "")) { DataMenu parentGroupMenu = GetGroupMenu(gridViewRootMenu, group.Key); foreach (var rel in group) { var gridViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.EntityDataItemReport.ReportTitle, "", DataMenuType.DataItemReport, dataItem); gridViewRelMenu.DataItemReport = rel.EntityDataItemReport; } } } } } return(result); }