private void ValidateFieldsbutton_Click(object sender, EventArgs e) { if (EntityStructure.Drawn == true) { SourceConnection = DMEEditor.GetDataSource(dataSourceIDComboBox.Text); if (SourceConnection == null) { DMEEditor.AddLogMessage("Error", "Could not Find DataSource " + EntityStructure.DataSourceID, DateTime.Now, EntityStructure.Id, EntityStructure.EntityName, Errors.Failed); MessageBox.Show($"{ErrorObject.Message}"); } else { EntityStructure ent = SourceConnection.GetEntityStructure(EntityStructure.EntityName, true); EntityStructure.Fields = ent.Fields; this.dataHierarchyBindingSource.ResetBindings(true); this.fieldsBindingSource.ResetBindings(true); } } }
public void SetConfig(IDMEEditor pbl, IDMLogger plogger, IUtil putil, string[] args, PassedArgs e, IErrorsInfo per) { Passedarg = e; Logger = plogger; ErrorObject = per; DMEEditor = pbl; SourceConnection = DMEEditor.GetDataSource(e.DatasourceName); Visutil = (IVisUtil)e.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj; branch = (IBranch)e.Objects.Where(c => c.Name == "Branch").FirstOrDefault().obj; if (e.Objects.Where(c => c.Name == "ParentBranch").Any()) { Parentbranch = (IBranch)e.Objects.Where(c => c.Name == "ParentBranch").FirstOrDefault().obj; //ParentEntity = SourceConnection.GetEntityStructure(Parentbranch.BranchText, true); } foreach (ConnectionProperties c in DMEEditor.ConfigEditor.DataConnections) { var t = dataSourceIDComboBox.Items.Add(c.ConnectionName); } foreach (var item in Enum.GetValues(typeof(ViewType))) { viewtypeComboBox.Items.Add(item); } this.dataSourceIDComboBox.SelectedIndexChanged += ComboBox1_SelectedIndexChanged; this.ValidateQuerybutton.Click += ValidateQuerybutton_Click; this.ValidateFKbutton.Click += ValidateFKbutton_Click; this.SaveEntitybutton.Click += SaveEntitybutton_Click; this.ValidateFieldsbutton.Click += ValidateFieldsbutton_Click; if (e.CurrentEntity != null) { EntityName = e.CurrentEntity; } else { EntityName = ""; } EntityStructure = SourceConnection.GetEntityStructure(EntityName, false); if (EntityStructure == null) { if (!string.IsNullOrEmpty(e.ParameterString1)) { EntityStructure = SourceConnection.GetEntityStructure(e.ParameterString1, false); } } if (EntityStructure == null) { if (!string.IsNullOrEmpty(e.ParameterString2)) { EntityStructure = SourceConnection.GetEntityStructure(e.ParameterString2, false); } } if (EntityStructure == null) { if (!string.IsNullOrEmpty(e.ParameterString3)) { EntityStructure = SourceConnection.GetEntityStructure(e.ParameterString3, false); } } if (EntityStructure == null) { MessageBox.Show("Cannot Find Entity in DataSource"); } else { this.dataHierarchyBindingSource.ResetBindings(true); this.fieldsBindingSource.ResetBindings(true); dataHierarchyBindingSource.DataSource = EntityStructure; //ConnectionProperties connection = DMEEditor.ConfigEditor.DataConnections.Where(o => o.ConnectionName.Equals(this.SourceConnection.DatasourceName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); //ConnectionDriversConfig conf = DMEEditor.Utilfunction.LinkConnection2Drivers(connection); //if (conf != null) // { // dataTypesMapBindingSource.DataSource = DMEEditor.ConfigEditor.DataTypesMap.Where(p => p.DataSourceName.Equals(conf.classHandler, StringComparison.OrdinalIgnoreCase)).Distinct(); // } DMEEditor.ConfigEditor.ReadDataTypeFile(); this.fieldtypeDataGridViewTextBoxColumn.DataSource = DMEEditor.typesHelper.GetNetDataTypes2(); // fieldtypeDataGridViewTextBoxColumn.DataSource = dataTypesMapBindingSource; } this.fieldsDataGridView.DataError += FieldsDataGridView_DataError; }