private void LoadSampleData() { Logger.WriteLog($"Start Load Table in Form"); ErrorObject.Flag = Errors.Ok; try { //FileDs.HeaderExist = true; //FileDs.fromline = 0; //FileDs.toline = 100; // FileDs.SourceEntityData = bs.DataSource = (DataTable)FileDs.GetEntity(entityname, null); //FileDs.SourceEntityData; bs.ResetBindings(true); SampledataGridView.DataSource = null; SampledataGridView.AutoGenerateColumns = true; SampledataGridView.Columns.Clear(); Logger.WriteLog($"Reset Grid Columns"); SampledataGridView.DataSource = bs; bs.ResumeBinding(); SampledataGridView.Refresh(); Logger.WriteLog($"Reset Datasource"); // bindingSource1.ResetBindings(true); //DataGridViewEdit.Refresh(); // ShowViewonTree(MyDataView); } catch (Exception ex) { MessageBox.Show(ex.Message); ErrorObject.Flag = Errors.Failed; ErrorObject.Ex = ex; Logger.WriteLog($"Error in Loading Table in Grid ({ex.Message}) "); } }
public void SetConfig(IDMEEditor pbl, IDMLogger plogger, IUtil putil, string[] args, PassedArgs e, IErrorsInfo per) { Passedarg = e; Logger = plogger; ErrorObject = per; DMEEditor = pbl; FileDs = (IDataSource)e.DataSource; fieldsDataGridView.DataError += FieldsDataGridView_DataError; FileDs.GetEntitesList(); //if (e.EventType == "FILESHEETSELECTED") //{ // entityname = e.ObjectName; //} //else //{ // if (FileDs.Entities.Count() == 1) // { // entityname = e.ObjectName; // } //} entityname = e.CurrentEntity; EntityData = FileDs.Entities.Where(c => c.EntityName == entityname).FirstOrDefault(); if (EntityData == null) { EntityData = FileDs.GetEntityStructure(entityname, false); FileDs.Entities.Add(EntityData); DMEEditor.ConfigEditor.SaveDataconnectionsValues(); } fieldtype.DataSource = pbl.typesHelper.GetNetDataTypes2(); entitiesBindingSource.DataSource = EntityData; SampledataGridView.RowPostPaint += SampledataGridView_RowPostPaint; LoadSampleDatabutton.Click += LoadSampleDatabutton_Click; SaveConfigbutton.Click += SaveConfigbutton_Click; }