public DP_SearchRepository ToSearchRepositoryDTO(SearchRepository SearchRepository) { DP_SearchRepository searchRepository = null; if (SearchRepository.SourceRelationID == null) { searchRepository = new DP_SearchRepository(SearchRepository.TableDrivedEntityID); searchRepository.Title = SearchRepository.TableDrivedEntity.Alias; } else { var relDTO = new BizRelationship().ToRelationshipDTO(SearchRepository.Relationship); searchRepository = new DP_SearchRepository(relDTO.EntityID2); searchRepository.Title = relDTO.Name; searchRepository.HasNotRelationshipCheck = SearchRepository.HasNotRelationshipCheck; searchRepository.RelationshipFromCount = SearchRepository.RelationshipFromCount; searchRepository.RelationshipToCount = SearchRepository.RelationshipToCount; //searchRepository.SourceEntityID = relDTO.EntityID1; searchRepository.SourceRelationship = relDTO; } searchRepository.ID = SearchRepository.ID; searchRepository.Title = SearchRepository.Title; searchRepository.EntitySearchID = SearchRepository.EntitySearchID ?? 0; searchRepository.IsSimpleSearch = SearchRepository.IsSimpleSearch; SetLogicPhraseDTO(SearchRepository.LogicPhrase, searchRepository); return(searchRepository); }
public SuperToSubRelationshipDTO ToSuperToSubRelationshipDTO(SuperToSubRelationshipType item, RelationshipDTO baseRelationship = null) { BizRelationship biz = new BizRelationship(); if (baseRelationship == null) { baseRelationship = biz.ToRelationshipDTO(item.RelationshipType.Relationship); } Mapper.Initialize(cfg => cfg.CreateMap <RelationshipDTO, SuperToSubRelationshipDTO>()); var result = AutoMapper.Mapper.Map <RelationshipDTO, SuperToSubRelationshipDTO>(baseRelationship); result.ISARelationship = ToISARelationshipDTO(item.ISARelationship); foreach (var val in item.SuperToSubDeterminerValue) { result.DeterminerColumnValues.Add(new SuperToSubDeterminerValueDTO() { ID = val.ID, Value = val.DeterminerValue }); } if (item.SuperEntityDeterminerColumnID != null) { BizColumn bizColumn = new BizColumn(); result.SuperEntityDeterminerColumnID = item.SuperEntityDeterminerColumnID.Value; result.SuperEntityDeterminerColumn = bizColumn.GetColumn(result.SuperEntityDeterminerColumnID, true); } return(result); }
private void Node_Expanded(object sender, RoutedEventArgs e) { var treeItem = e.Source as RadTreeViewItem; if (treeItem != null) { bool firstTime = false; if (treeItem.Items.Count > 0) { var firstItem = treeItem.Items[0]; if (firstItem is string && firstItem.ToString() == "Loading...") { firstTime = true; } } if (firstTime) { treeItem.Items.Clear(); BizRelationship bizRelationship = new BizRelationship(); var objectDTO = treeItem.DataContext as TreeRelationshipItem; var entityID = objectDTO.Relationship.EntityID2; var cEntity = bizEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships); TreeRelationshipItem relItem = new TreeRelationshipItem(); PopulateTreeItems(treeItem.Items, cEntity, objectDTO.RelationshipPath, objectDTO.EntityPath); } } }
private void Node_Expanded(object sender, RoutedEventArgs e) { var treeItem = e.Source as RadTreeViewItem; if (treeItem != null) { bool firstTime = false; if (treeItem.Items.Count > 0) { var firstItem = treeItem.Items[0]; if (firstItem is string && firstItem.ToString() == "Loading...") { firstTime = true; } } if (firstTime) { treeItem.Items.Clear(); BizRelationship bizRelationship = new BizRelationship(); var objectDTO = treeItem.DataContext as RelationshipDTO; var entityID = objectDTO.EntityID2;// bizRelationship.GetOtherSideEntityID(Convert.ToInt32(objectDTO.ID)); PopulateTreeItems(treeItem.Items, entityID); } } }
private void InsertMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) { var menu = sender as RadMenuItem; var contextMenu = menu.Parent as RadContextMenu; RadTreeViewItem item = contextMenu.GetClickedElement <RadTreeViewItem>(); int entityID = 0; if (item != null) { var fItem = item.DataContext as FormulaItemDTO; if (fItem.ItemType == FormuaItemType.Relationship) { BizRelationship bizRelationship = new BizRelationship(); var rel = bizRelationship.GetRelationship(fItem.ItemID); entityID = rel.EntityID2; } } else { entityID = (int)lokEntity.SelectedValue; } if (entityID != 0) { frmPropertySelector frm = new frmPropertySelector(entityID); frm.PropertySelected += (sender1, e1) => Frm_PropertySelected(sender1, e1, item); MyProjectManager.GetMyProjectManager.ShowDialog(frm, "انتخاب خصوصیت", Enum_WindowSize.Vertical); } }
public frmRelationshipFilter(int relatoinshipID) { InitializeComponent(); RelatoinshipID = relatoinshipID; BizRelationship bizRelationship = new BizRelationship(); Relatoinship = bizRelationship.GetRelationship(relatoinshipID); //SetSearchRelationshipTails(); SetValueRelationshipTails(); //SetSearchRelationshipTails(); var list = bizRelationshipFilter.GetRelationshipFilters(MyProjectManager.GetMyProjectManager.GetRequester(), relatoinshipID); foreach (var item in list) { SetValueColumns(item); SetSearchColumns(item); } dtgRelationshipFilterColumns.ItemsSource = list; dtgRelationshipFilterColumns.RowLoaded += DtgConditions_RowLoaded; dtgRelationshipFilterColumns.CellEditEnded += DtgConditions_CellEditEnded; colValueRelationshipTail.EditItemClicked += ColValueRelationshipTail_EditItemClicked; // colSearchRelationshipTail.EditItemClicked += ColSearchRelationshipTail_EditItemClicked; ControlHelper.GenerateContextMenu(dtgRelationshipFilterColumns); }
public frmCreateManyToManyRelationship(int associativeTableID) { InitializeComponent(); TableID = associativeTableID; BizRelationship bizRelationship = new BizRelationship(); dtgList.ItemsSource = bizRelationship.GetRelationshipsByTableID(TableID).Where(x => x.TypeEnum == Enum_RelationshipType.ManyToOne); BizTable bizTable = new BizTable(); var table = bizTable.GetTable(TableID); txtName.Text = table.Name; }
public SuperToSubRelationshipDTO ToSuperToSubRelationshipDTO(SuperToSubRelationshipType item, RelationshipDTO baseRelationship = null) { BizRelationship biz = new BizRelationship(); if (baseRelationship == null) { baseRelationship = biz.ToRelationshipDTO(item.RelationshipType.Relationship); } Mapper.Initialize(cfg => cfg.CreateMap <RelationshipDTO, SuperToSubRelationshipDTO>()); var result = AutoMapper.Mapper.Map <RelationshipDTO, SuperToSubRelationshipDTO>(baseRelationship); result.ISARelationship = ToISARelationshipDTO(item.ISARelationship); return(result); }
private void SetArcGroupGrid() { BizArcRelationship biz = new BizArcRelationship(); dtgArcGroup.ItemsSource = biz.GetArcRelationshipGroups(TableDrivedEntityID); //روابط هر دو طرف تکرار میشوند BizRelationship bizRelationship = new BizRelationship(); BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity(); var entity = bizTableDrivedEntity.GetTableDrivedEntity(TableDrivedEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships); var listRelationships = entity.Relationships; var rel = dtgArcRelationships.Columns[0] as GridViewComboBoxColumn; rel.ItemsSource = listRelationships; rel.DisplayMemberPath = "Name"; rel.SelectedValueMemberPath = "ID"; }
public List <SubUnionToSuperUnionRelationshipDTO> GetSubUnionToSuperUnionRelationship(int UnionRelationshipID) { List <SubUnionToSuperUnionRelationshipDTO> result = new List <SubUnionToSuperUnionRelationshipDTO>(); using (var projectContext = new DataAccess.MyProjectEntities()) { //projectContext.Configuration.LazyLoadingEnabled = false; var UnionRelationship = projectContext.UnionRelationshipType.FirstOrDefault(x => x.ID == UnionRelationshipID); if (UnionRelationship != null) { BizRelationship biz = new BizRelationship(); foreach (var item in UnionRelationship.SubUnionToUnionRelationshipType) { result.Add(ToSubUnionToSuperUnionRelationshipDTO(item)); } } } return(result); }
public List <SubToSuperRelationshipDTO> GetSubToSuperRelationship(int iSARelationshipID) { List <SubToSuperRelationshipDTO> result = new List <SubToSuperRelationshipDTO>(); using (var projectContext = new MyIdeaEntities()) { //projectContext.Configuration.LazyLoadingEnabled = false; var iSaRelationship = projectContext.ISARelationship.FirstOrDefault(x => x.ID == iSARelationshipID); if (iSaRelationship != null) { BizRelationship biz = new BizRelationship(); foreach (var item in iSaRelationship.SubToSuperRelationshipType) { result.Add(ToSubToSuperRelationshipDTO(item)); } } } return(result); }
private void SetColumnValueGrid() { // BizColumnValue biz = new BizColumnValue(); ////dtgColumnValues.ItemsSource = biz.GetColumnValues(ColumnID); BizColumn bizColumn = new BizColumn(); var col = dtgColumnValue_Columns.Columns[0] as GridViewComboBoxColumn; col.ItemsSource = bizColumn.GetOtherColums(ColumnID); col.DisplayMemberPath = "Name"; col.SelectedValueMemberPath = "ID"; var rel = dtgColumnValue_Relationships.Columns[0] as GridViewComboBoxColumn; var column = bizColumn.GetColumn(ColumnID, true); BizRelationship bizRelationship = new BizRelationship(); rel.ItemsSource = bizRelationship.GetRelationshipsByTableID(column.TableID); rel.DisplayMemberPath = "Name"; rel.SelectedValueMemberPath = "ID"; }
//private frmEditSubEntity GetSubEntityForm(TableDrivedEntityDTO e) //{ // foreach (var item in tabControl.Items) // { // if ((item as TabItem).Content is frmEditSubEntity) // { // if (((item as TabItem).Content as frmEditSubEntity).Message == e) // return (item as TabItem).Content as frmEditSubEntity; // } // } // return null; //} //private void MoveColumnFromBaseToDrived(frmEditSubEntity view, ColumnDTO column, bool showMessage) //{ //} //private void MoveColumnFromDrivedToBase(frmEditSubEntity view, ColumnDTO column, bool showMessage) //{ // if (column.PrimaryKey) // { // if (showMessage) // MessageBox.Show("ستون کلید اصلی میباشد"); // return; // } // Message.BaseEntity.Columns.Add(column); // view.RemoveColumn(column); // dtgColumns.ItemsSource = null; // dtgColumns.ItemsSource = Message.BaseEntity.Columns; //} void AddRelationship(TableDrivedEntityDTO sourceEntity, RelationshipDTO sourceRelationship, TableDrivedEntityDTO targetEntity, bool move , RadGridView sourceRelationshipDataGrid, RadGridView targetRelationshipDataGrid, RadGridView sourceColumnDataGrid, RadGridView targetColumnDataGrid) { BizRelationship bizRelationship = new BizRelationship(); if (sourceEntity == Message.BaseEntity && bizRelationship.RelationshipIsNotNulable(sourceRelationship.ID)) { var message = " این رابطه اجباری میباشند و امکان انتخاب شدن برای موجودیت های مشتق شده را ندارند"; MessageBox.Show(message, "روابط اجباری"); return; } if (sourceRelationship.MastertTypeEnum == Enum_MasterRelationshipType.FromForeignToPrimary) { if (!sourceRelationship.RelationshipColumns.Any(x => x.FirstSideColumn.PrimaryKey)) { foreach (var col in sourceRelationship.RelationshipColumns) { var fColumn = sourceEntity.Columns.FirstOrDefault(x => x.ID == col.FirstSideColumnID); if (fColumn != null) { AddColumn(sourceEntity, fColumn, targetEntity, move, sourceColumnDataGrid, targetColumnDataGrid, false); } } } } if (!targetEntity.Relationships.Any(x => x.ID == sourceRelationship.ID)) { targetEntity.Relationships.Add(sourceRelationship); targetRelationshipDataGrid.ItemsSource = null; targetRelationshipDataGrid.ItemsSource = targetEntity.Relationships; } if (move) { sourceEntity.Relationships.Remove(sourceRelationship); sourceRelationshipDataGrid.ItemsSource = null; sourceRelationshipDataGrid.ItemsSource = sourceEntity.Relationships; } }
public RelationshipDTO GetRelationship(int relationshipID) { BizRelationship bizRelationship = new BizRelationship(); return(bizRelationship.GetRelationship(relationshipID)); }
private TableDrivedEntityDTO ToTableDrivedEntityDTO(TableDrivedEntity item, EntityColumnInfoType columnInfoType, EntityRelationshipInfoType relationshipInfoType) { //var cachedItem = CacheManager.GetCacheManager().GetCachedItem(CacheItemType.Entity, item.ID.ToString(), columnInfoType.ToString(), relationshipInfoType.ToString()); //if (cachedItem != null) // return (cachedItem as TableDrivedEntityDTO); TableDrivedEntityDTO result = new TableDrivedEntityDTO(); result.Name = item.Name; result.ID = item.ID; result.TableID = item.TableID; result.TableName = item.Table.Name; // result.Schema = item.Table.DBSchema.Name; result.EntityListViewID = item.EntityListViewID ?? 0; result.DatabaseID = item.Table.DBSchema.DatabaseInformationID; result.DatabaseName = item.Table.DBSchema.DatabaseInformation.Name; result.RelatedSchemaID = item.Table.DBSchemaID; result.RelatedSchema = item.Table.DBSchema.Name; result.ServerID = item.Table.DBSchema.DatabaseInformation.DBServerID; result.Alias = item.Alias; result.Criteria = item.Criteria; //result.SecurityObjectID = item.SecurityObjectID.Value; //if (result.UnionTypeEntities == "") // if (item.Relationship.Any(x => (x.RelationshipType == null && x.Relationship2 != null && x.TableDrivedEntity != x.TableDrivedEntity1 && !x.RelationshipColumns.All(y => y.Column.PrimaryKey == true)) // || (x.Relationship2 == null && x.TableDrivedEntity != x.TableDrivedEntity1 && !x.RelationshipColumns.All(y => y.Column1.PrimaryKey == true)))) // result.UnionTypeEntities = "Choose UnionType"; result.BatchDataEntry = item.BatchDataEntry; result.IsAssociative = item.IsAssociative; result.IsDataReference = item.IsDataReference; result.IsStructurReferencee = item.IsStructurReferencee; BizColumn bizColumn = new BizColumn(); if (columnInfoType == EntityColumnInfoType.WithSimpleColumns) { result.Columns = bizColumn.GetColumns(item, true); } else if (columnInfoType == EntityColumnInfoType.WithFullColumns) { result.Columns = bizColumn.GetColumns(item, false); } if (relationshipInfoType == EntityRelationshipInfoType.WithRelationships) { BizISARelationship bizISARelationship = new BizISARelationship(); BizUnionRelationship bizUnionRelationship = new Paper_MetadataManagement.BizUnionRelationship(); BizRelationship bizRelationship = new BizRelationship(); foreach (var relationship in item.Relationship) { var relationshipDTO = bizRelationship.ToRelationshipDTO(relationship); result.Relationships.Add(relationshipDTO); if (relationship.RelationshipType != null) { if (relationship.RelationshipType.OneToManyRelationshipType != null) { result.OneToManyRelationships.Add(bizRelationship.ToOneToManyRelationship(relationship.RelationshipType.OneToManyRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.ManyToOneRelationshipType != null) { result.ManyToOneRelationships.Add(bizRelationship.ToManyToOneRelationshipDTO(relationship.RelationshipType.ManyToOneRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.ImplicitOneToOneRelationshipType != null) { result.ImplicitOneToOneRelationships.Add(bizRelationship.ToImplicitOneToOneRelationshipDTO(relationship.RelationshipType.ImplicitOneToOneRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.ExplicitOneToOneRelationshipType != null) { result.ExplicitOneToOneRelationships.Add(bizRelationship.ToExplicitOneToOneRelationshipDTO(relationship.RelationshipType.ExplicitOneToOneRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.SuperToSubRelationshipType != null) { result.SuperToSubRelationships.Add(bizISARelationship.ToSuperToSubRelationshipDTO(relationship.RelationshipType.SuperToSubRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.SubToSuperRelationshipType != null) { result.SubToSuperRelationships.Add(bizISARelationship.ToSubToSuperRelationshipDTO(relationship.RelationshipType.SubToSuperRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.UnionToSubUnionRelationshipType != null) { result.SuperUnionToSubUnionRelationships.Add(bizUnionRelationship.ToSuperUnionToSubUnionRelationshipDTO(relationship.RelationshipType.UnionToSubUnionRelationshipType, relationshipDTO)); } else if (relationship.RelationshipType.SubUnionToUnionRelationshipType != null) { result.SubUnionToSuperUnionRelationships.Add(bizUnionRelationship.ToSubUnionToSuperUnionRelationshipDTO(relationship.RelationshipType.SubUnionToUnionRelationshipType, relationshipDTO)); } } } } //CacheManager.GetCacheManager().AddCacheItem(result, CacheItemType.Entity, item.ID.ToString(), columnInfoType.ToString(), relationshipInfoType.ToString()); return(result); }