public DP_DataView ToDataViewDTO(DR_Requester requester, MyDataItem dbDataItem, bool lastInfo) { DP_DataView result = null; bool error = false; if (lastInfo) { DP_SearchRepository searchDataItem = new DP_SearchRepository(dbDataItem.TableDrivedEntityID); foreach (var property in dbDataItem.MyDataItemKeyColumns) { searchDataItem.Phrases.Add(new SearchProperty() { ColumnID = property.ColumnID, Value = property.Value }); } DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchDataItem); var searchResult = searchRequestManager.Process(request); if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone) { result = searchResult.ResultDataItems.FirstOrDefault(); } else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown) { error = true; } } if (!lastInfo || error) { result = new DP_DataView(dbDataItem.TableDrivedEntityID, ""); result.DataItemID = dbDataItem.ID; //result.TargetEntityID = dbDataItem.TableDrivedEntityID; // List<EntityInstanceProperty> listProperties = new List<EntityInstanceProperty>(); BizColumn bizColumn = new BizColumn(); foreach (var property in dbDataItem.MyDataItemKeyColumns) { result.Properties.Add(new EntityInstanceProperty(bizColumn.GetColumn(property.ColumnID, true)) { Value = property.Value }); } } return(result); //result.SetProperties(listProperties); }
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 void btnImportKeyValues_Click(object sender, RoutedEventArgs e) { //if (optValueComesFromTitle.IsChecked == false && optValueComesFromValue.IsChecked == false) //{ // MessageBox.Show("لطفا نوع جایگذاری مقادیر ستون در عنوان یا مقدار را مشخص نمایید"); // return; //} BizDatabase bizDatabase = new BizDatabase(); BizColumn bizColumn = new BizColumn(); var column = bizColumn.GetColumn(ColumnID, true); var database = bizDatabase.GetDatabaseByTableID(column.TableID); var dbHelper = MyModelGenerator.ModelGenerator.GetDatabaseImportHelper(database); var result = dbHelper.GetColumnValueRange(ColumnID); if (result != null) { Message.Details = result.Details; dtgColumnKeyValue.ItemsSource = null; dtgColumnKeyValue.ItemsSource = Message.Details; } }