private void Savebutton_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.nameTextBox.Text) || string.IsNullOrEmpty(this.titleTextBox.Text) || string.IsNullOrEmpty(this.subTitleTextBox.Text)) { DMEEditor.AddLogMessage("Fail", $"Please Check All required Fields entered", DateTime.Now, 0, null, Errors.Ok); MessageBox.Show($"Please Check All required Fields entered"); } else { blockColumnsBindingSource.MoveFirst(); blocksBindingSource.MoveFirst(); reportsBindingSource.MoveFirst(); blockColumnsBindingSource.EndEdit(); this.blocksBindingSource.EndEdit(); this.reportsBindingSource.EndEdit(); DMEEditor.ConfigEditor.SaveReportDefinitionsValues(); RootBranch.CreateChildNodes(); MessageBox.Show($"Generated Report:{nameTextBox.Text}"); DMEEditor.AddLogMessage("Success", $"Generated Report", DateTime.Now, 0, null, Errors.Ok); this.ParentForm.Close(); } } catch (Exception ex) { string errmsg = "Error in Generating Report"; DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed); } }
public IErrorsInfo RemoveChildEntities(int EntityID) { try { // CurrentEntity = CurrentView.Entity[EntityListIndex(ViewID, EntityID)]; var ls = DataView.Entities.Where(x => x.ParentId == EntityID); foreach (EntityStructure item in ls.ToList()) { if (DataView.Entities.Where(y => y.ParentId == item.Id).Any()) { RemoveChildEntities(item.Id); } DataView.Entities.Remove(DataView.Entities[EntityListIndex(item.Id)]); EntitiesNames.Remove(DataView.Entities[EntityListIndex(item.Id)].EntityName); } DMEEditor.AddLogMessage("Success", "Removed Child entities", DateTime.Now, 0, null, Errors.Ok); } catch (Exception ex) { string mes = "Could not Remove Child entities"; DMEEditor.AddLogMessage(ex.Message, mes, DateTime.Now, -1, mes, Errors.Failed); }; return(DMEEditor.ErrorObject); }
//private void BlockColumnsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) //{ // var senderGrid = (DataGridView)sender; // if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && // e.RowIndex >= 0) // { // //if ((object)column == (object)color) // //{ // // colorDialog.Color = Color.Blue; // // colorDialog.ShowDialog(); // //} // } //} //private void BlockColumnsDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) //{ // // Ignore clicks that are not in our // if (e.ColumnIndex == blockColumnsDataGridView.Columns["MyButtonColumn"].Index && e.RowIndex >= 0) // { // Console.WriteLine("Button on row {0} clicked", e.RowIndex); // } //} private void BlocksBindingSource_CurrentChanged(object sender, EventArgs e) { ReportBlock x = (ReportBlock)blocksBindingSource.Current; if (x.BlockColumns.Count() == 0) { if (!string.IsNullOrEmpty(this.viewIDComboBox.Text)) { ds = (DataViewDataSource)DMEEditor.GetDataSource(this.viewIDComboBox.Text); EntityStructure ent = ds.GetEntityStructure(this.entityIDComboBox.Text, true); List <ReportBlockColumns> ls = new List <ReportBlockColumns>(); if (ent != null) { int i = 0; foreach (EntityField item in ent.Fields) { ReportBlockColumns c = new ReportBlockColumns(); c.ColumnName = item.fieldname; c.ColumnSeq = i; c.DisplayName = item.fieldname; c.Show = true; i += 1; ls.Add(c); } x.BlockColumns = ls; } } } }
public bool GetBlockDataIntoTables() { int blocknumber = 0; //bool retval=false; Tables = new List<DataTable>(); try { for (int i = 0; i < Definition.Blocks.Where(p=>p.ViewID!=null).Count(); i++) { blocknumber = i; DataTable tb = CopyReportDefinition(blocknumber); // tb.Wait(); Tables.Add(tb); } DMEEditor.AddLogMessage("Success", $"Getting Data into Tables", DateTime.Now, 0, null, Errors.Ok); return true; } catch (Exception ex) { string errmsg = "Error in Getting Data into Tables"; DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed); return false; } }
public IErrorsInfo RunReport(ReportType reportType, string outputFile) { try { reportOutput = new ReportOutput(); reportOutput.Definition = Definition; reportOutput.DMEEditor = DMEEditor; if (reportOutput.GetBlockDataIntoTables()) { CreateDocument(); PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); pdfRenderer.PdfDocument.Save(outputFile); OutputFile = outputFile; } } catch (Exception ex) { string errmsg = "Error Saving Function Mapping "; DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed); } return(DMEEditor.ErrorObject); }
public IDMDataView GenerateView(string ViewName, string ConnectionName) { DMEEditor.ErrorObject.Flag = Errors.Ok; IDMDataView retval = null; try { retval = new DMDataView(); retval.ViewID = 0; retval.EntityDataSourceID = ViewName; retval.ViewName = ViewName; retval.DataViewDataSourceID = ViewName; retval.Viewtype = ViewType.Table; retval.VID = Guid.NewGuid().ToString(); //EntityStructure viewheader = new EntityStructure() { Id = 1, EntityName = ViewName }; //viewheader.EntityName = ViewName; //viewheader.ViewID = retval.ViewID; //viewheader.ParentId = 0; //retval.Entities.Add(viewheader); } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Error in creating View ({ex.Message}) ", DateTime.Now, 0, ViewName, Errors.Failed); } return(retval); }
public IErrorsInfo CopyEntitiesData(IDataSource sourceds, IDataSource destds, List <string> entities, IProgress <PassedArgs> progress, CancellationToken token, bool CreateMissingEntity = true) { try { var ls = from e in sourceds.Entities from r in entities where e.EntityName == r select e; foreach (EntityStructure item in ls) { if ((item.EntityName != item.DatasourceEntityName) && (!string.IsNullOrEmpty(item.DatasourceEntityName))) { CopyEntityData(sourceds, destds, item.DatasourceEntityName, item.EntityName, progress, token, CreateMissingEntity); } else { CopyEntityData(sourceds, destds, item.EntityName, item.EntityName, progress, token, CreateMissingEntity); } } } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Error copying Data ({ex.Message})", DateTime.Now, -1, "CopyDatabase", Errors.Failed); } return(DMEEditor.ErrorObject); }
public List <string> GetEntitesList() { try { // List<EntityStructure> entlist = new List<EntityStructure>(); if (ConnectionStatus != ConnectionState.Open) { // Reader.OpenStore(Dataconnection.ConnectionProp.Url); } if (ConnectionStatus == ConnectionState.Open) { EntitiesNames = new List <string>(); // EntitiesNames = Reader.GetEntities().ToList(); } // DMEEditor.ConfigEditor.DataConnections.Where(c => c.FileName == DatasourceName).FirstOrDefault().Entities =entlist ; Logger.WriteLog("Successfully Retrieve Entites list "); } catch (Exception ex) { string mes = ""; DMEEditor.AddLogMessage(ex.Message, "Could not Open Store in MongoDB " + mes, DateTime.Now, -1, mes, Errors.Failed); }; return(EntitiesNames); }
public IErrorsInfo ReadWorkbook(string path) { try { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); // Try to read workbook as XLSX: try { book = new XSSFWorkbook(fs); } catch { book = null; } // If reading fails, try to read workbook as XLS: if (book == null) { book = new HSSFWorkbook(fs); } DMEEditor.AddLogMessage("Success", "Opened Workbook", DateTime.Now, 0, path, Errors.Ok); } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", "Could not Open Workbook", DateTime.Now, 0, path, Errors.Failed); } return(DMEEditor.ErrorObject); }
private void ComboBox1_SelectedIndexChanged(object sender, EventArgs e) { ds = (IDataSource)DMEEditor.DataSources.Where(f => f.DatasourceName == dataSourceIDComboBox.Items[dataSourceIDComboBox.SelectedIndex].ToString()).FirstOrDefault(); ConnectionProperties cn = DMEEditor.ConfigEditor.DataConnections.Where(f => f.ConnectionName == dataSourceIDComboBox.Items[dataSourceIDComboBox.SelectedIndex].ToString()).FirstOrDefault(); if (ds == null) { ds = DMEEditor.GetDataSource(dataSourceIDComboBox.Items[dataSourceIDComboBox.SelectedIndex].ToString()); try { if (ds != null) { // ds.ConnectionStatus = SourceConnection.Dataconnection.OpenConnection(); DMEEditor.OpenDataSource(dataSourceIDComboBox.Items[dataSourceIDComboBox.SelectedIndex].ToString()); if (ErrorObject.Flag == Errors.Ok) { DMEEditor.DataSources.Add(SourceConnection); } else { MessageBox.Show($"Error in opening the Database ,{ErrorObject.Message}"); Logger.WriteLog($"Error in opening the Database ,{ErrorObject.Message}"); } } } catch (Exception e1) { // Logger.WriteLog($"Error in opening the Database ,{e1.Message}"); MessageBox.Show($"Error in opening the Database ,{e1.Message}"); } } }
public IMapping_rep CreateMapping(IMapping_rep x) { DMEEditor.ErrorObject.Flag = Errors.Ok; try { IDataSource ds1 = DMEEditor.GetDataSource(x.Entity1DataSource); IDataSource ds2 = DMEEditor.GetDataSource(x.Entity2DataSource); if (ds1 == null || ds2 == null) { DMEEditor.ErrorObject.Flag = Errors.Failed; DMEEditor.ErrorObject.Message = "one of the Datasources Dont Exist"; DMEEditor.Logger.WriteLog($"one of the Datasources Dont Exist"); } else { EntityStructure dt1 = ds1.GetEntityStructure(x.EntityName1, false); EntityStructure dt2 = ds2.GetEntityStructure(x.EntityName2, false); x.Entity1Fields = dt1.Fields; x.Entity2Fields = dt2.Fields; DMEEditor.Logger.WriteLog($"Successful in Creating Mapping"); } } catch (System.Exception ex) { DMEEditor.ErrorObject.Flag = Errors.Failed; DMEEditor.ErrorObject.Ex = ex; x = null; DMEEditor.Logger.WriteLog($"Error in Creating Mapping({ex.Message})"); } return(x); }
private void ListBox1_DragDrop(object sender, DragEventArgs e) { string dsnamewithentiy = (string)e.Data.GetData(DataFormats.Text); // ITreeBranch br = (ITreeBranch)e.Data.GetData(typeof(ITreeBranch)); if (dsnamewithentiy != null) { string[] splitstring = dsnamewithentiy.Split(','); string dsname = splitstring[0]; string entityname = splitstring[1]; // entityname = br.BranchText; // dsname = br.ParentNode.Text; mappingsBindingSource.AddNew(); this.mappingNameTextBox.Text = dsname + "_" + entityname + "_"; entity1DataSourceComboBox.SelectedText = dsname; entityName1ComboBox.SelectedText = entityname; ds1 = DMEEditor.GetDataSource(dsname); if (ds1 != null) { ds1.GetEntitesList(); entityName1ComboBox.Items.Clear(); foreach (string s in ds1.EntitiesNames) { entityName1ComboBox.Items.Add(s); } } } }
public object GetEntity(string EntityName, List <ReportFilter> filter) { ErrorObject.Flag = Errors.Ok; try { int noofrows = 0; if (filter != null) { if (filter.Count > 0) { if (!string.IsNullOrEmpty(filter[0].FilterValue) && !string.IsNullOrWhiteSpace(filter[0].FilterValue)) { noofrows = Convert.ToInt32(filter[0].FilterValue); } } } return(GetData(noofrows)); } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Error in getting File Data({ ex.Message}) ", DateTime.Now, -1, "", Errors.Failed); return(null); } }
private ConnectionState OpenConn() { ReplaceValueFromConnectionString(); if (Path.Combine(ConnectionProp.FilePath, ConnectionProp.FileName) != null) { if (File.Exists(Path.Combine(ConnectionProp.FilePath, ConnectionProp.FileName))) { string str = $"Found File ,{Path.Combine(ConnectionProp.FilePath, ConnectionProp.FileName)}"; // DMEEditor.AddLogMessage("Success", str, DateTime.Now, -1, "", Errors.Ok); ConnectionStatus = ConnectionState.Open; } else { string str = $"Error in finding File ,{Path.Combine(ConnectionProp.FilePath, ConnectionProp.FileName)}"; DMEEditor.AddLogMessage("Fail", str, DateTime.Now, -1, "", Errors.Failed); ConnectionStatus = ConnectionState.Broken; //ErrorObject.Ex = e; } } else { string str = $"Error No Path Exist ,{ConnectionProp.FilePath}"; DMEEditor.AddLogMessage("Fail", str, DateTime.Now, -1, "", Errors.Failed); ConnectionStatus = ConnectionState.Closed; } DMEEditor.AddLogMessage("Success", $"File Found {ConnectionProp.FileName}", DateTime.Now, -1, "", Errors.Ok); return(ConnectionStatus); }
public override DataTable GetTableSchema(string TableName) { ErrorObject.Flag = Errors.Ok; DataTable tb = new DataTable(); OracleDataReader reader; OracleCommand cmd = (OracleCommand)GetDataCommandForOracle(); try { if (!string.IsNullOrEmpty(Dataconnection.ConnectionProp.SchemaName) && !string.IsNullOrWhiteSpace(Dataconnection.ConnectionProp.SchemaName)) { TableName = Dataconnection.ConnectionProp.SchemaName + "." + TableName; } cmd.CommandText = "Select * from " + TableName.ToLower();// + " where 1=2"; reader = cmd.ExecuteReader(CommandBehavior.KeyInfo); tb = reader.GetSchemaTable(); reader.Close(); cmd.Dispose(); } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"unsuccessfully Executed Sql ({ex.Message})", DateTime.Now, 0, TableName, Errors.Failed); } //} return(tb); }
private void SaveAppDefinitionbutton_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.ouputFolderTextBox.Text) || string.IsNullOrEmpty(this.appTitleTextBox.Text) || string.IsNullOrEmpty(this.dataViewDataSourceNameComboBox.Text) || string.IsNullOrEmpty(this.appNameTextBox.Text)) { DMEEditor.AddLogMessage("Fail", $"Please Check All required Fields entered", DateTime.Now, 0, null, Errors.Ok); MessageBox.Show($"Please Check All required Fields entered"); } else { appsBindingSource.EndEdit(); DMEEditor.ConfigEditor.SaveAppValues(); RootAppBranch.CreateChildNodes(); DMEEditor.AddLogMessage("Success", $"Generated App:{appNameTextBox.Text}", DateTime.Now, 0, null, Errors.Ok); MessageBox.Show($"Generated App:{appNameTextBox.Text}"); this.ParentForm.Close(); } } catch (Exception ex) { string errmsg = "Error in Generating App"; DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed); MessageBox.Show($"{errmsg}:{ex.Message}"); } }
private ConnectionState OpenConn() { string filen = Path.Combine(ConnectionProp.FilePath, ConnectionProp.FileName); if (filen != null) { if (File.Exists(filen)) { string str = $"Found File ,{filen}"; ConnectionStatus = ConnectionState.Open; } else { string str = $"Error in finding File ,{filen}"; ConnectionStatus = ConnectionState.Broken; //ErrorObject.Ex = e; } } else { DMEEditor.AddLogMessage("Fail", $"Error No Path Exist ,{filen}", DateTime.Now, -1, "", Errors.Failed); ConnectionStatus = ConnectionState.Closed; } return(ConnectionStatus); }
public OracleCommand GetDataCommandForOracle() { OracleCommand cmd = null; ErrorObject.Flag = Errors.Ok; OracleConnection conn = (OracleConnection)RDBMSConnection.DbConn; try { if (Dataconnection.OpenConnection() == ConnectionState.Open) { cmd = conn.CreateCommand(); } else { cmd = null; DMEEditor.AddLogMessage("Fail", $"Error in Creating Data Command, Cannot get DataSource", DateTime.Now, -1, DatasourceName, Errors.Failed); } } catch (Exception ex) { cmd = null; DMEEditor.AddLogMessage("Fail", $"Error in Creating Data Command {ex.Message}", DateTime.Now, -1, ex.Message, Errors.Failed); } return(cmd); }
public IErrorsInfo CopyEntityStructure(IDataSource sourceds, IDataSource destds, string srcentity, string destentity, IProgress <PassedArgs> progress, CancellationToken token, bool CreateMissingEntity = true) { try { EntityStructure item = sourceds.GetEntityStructure(srcentity, true); if (item != null) { if (destds.Category == DatasourceCategory.RDBMS) { IRDBSource rDB = (IRDBSource)destds; rDB.DisableFKConstraints(item); } if (destds.CreateEntityAs(item)) { DMEEditor.AddLogMessage("Success", $"Creating Entity {item.EntityName} on {destds.DatasourceName}", DateTime.Now, 0, null, Errors.Ok); } else { DMEEditor.AddLogMessage("Fail", $"Error : Could not Create Entity {item.EntityName} on {destds.DatasourceName}", DateTime.Now, 0, null, Errors.Failed); } if (destds.Category == DatasourceCategory.RDBMS) { IRDBSource rDB = (IRDBSource)destds; rDB.EnableFKConstraints(item); } } } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Error Could not Create Entity {srcentity} on {destds.DatasourceName} ({ex.Message})", DateTime.Now, -1, "CopyDatabase", Errors.Failed); } return(DMEEditor.ErrorObject); }
public List <SyncEntity> GetCreateEntityScript(IDataSource ds, List <string> entities, IProgress <PassedArgs> progress, CancellationToken token) { List <SyncEntity> rt = new List <SyncEntity>(); try { foreach (string item in entities) { var t = Task.Run <EntityStructure>(() => { return(ds.GetEntityStructure(item, true)); }); t.Wait(); EntityStructure t1 = t.Result; t1.Created = false; } if (ds.Entities.Count > 0) { var t = Task.Run <List <SyncEntity> >(() => { return(GetCreateEntityScript(ds, ds.Entities, progress, token)); }); t.Wait(); rt.AddRange(t.Result); } } catch (System.Exception ex) { DMEEditor.AddLogMessage("Fail", $"Error in getting entities from Database ({ex.Message})", DateTime.Now, -1, "CopyDatabase", Errors.Failed); } return(rt); }
public List <DatabaseCollection> GetDatabaseNames() { try { var dbList = Client.ListDatabases().ToList(); Databases = new List <DatabaseCollection>(); foreach (string item in dbList) { IMongoDatabase db = Client.GetDatabase(item); DatabaseCollection t = new DatabaseCollection(); t.DatabasName = item; t.Collections = db.ListCollectionNames().ToList(); foreach (string col in t.Collections) { Entities.Add(GetEntityStructure(col)); } } return(Databases); } catch (Exception ex) { DMEEditor.AddLogMessage("Error", "Could not Get Databases From RavenDB " + ConnProp.ConnectionName, DateTime.Now, -1, ConnProp.Url, Errors.Failed); return(null); } }
public virtual ConnectionState CloseConn() { if (DbConn != null) { if (DbConn.State == ConnectionState.Open) { ErrorObject.Flag = Errors.Ok; try { DbConn.Close(); ConnectionStatus = ConnectionState.Closed; } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Could not close Connetion Database Function End {ex.Message}", DateTime.Now, 0, null, Errors.Failed); } return(DbConn.State); } else { ConnectionStatus = ConnectionState.Closed; return(ConnectionStatus); } } else { ConnectionStatus = ConnectionState.Closed; DMEEditor.AddLogMessage("Fail", $"Closing RDBMS Connection {ConnectionProp.ConnectionName}", DateTime.Now, 0, ConnectionProp.ConnectionName, Errors.Ok); return(ConnectionStatus); } }
private void Entity2DataSourceComboBox_SelectedValueChanged(object sender, EventArgs e) { if (entity2DataSourceComboBox.SelectedItem == null) { } else { ds2 = DMEEditor.GetDataSource(entity2DataSourceComboBox.SelectedItem.ToString()); if (ds2 != null) { ds2.GetEntitesList(); entityName2ComboBox.Items.Clear(); foreach (string s in ds2.EntitiesNames) { entityName2ComboBox.Items.Add(s); } } else { MessageBox.Show($"Error Could not Open Datasource {entity2DataSourceComboBox.SelectedValue.ToString()} : {DMEEditor.ErrorObject.Message}"); } } }
private void CreateDataSources() { Mapping_rep x = (Mapping_rep)mappingsBindingSource.Current; ds1 = DMEEditor.GetDataSource(x.Entity1DataSource); ds2 = DMEEditor.GetDataSource(x.Entity2DataSource); }
private void Getfields() { ds = new DataSet();; Entities = new List <EntityStructure>(); if (File.Exists(Path.Combine(Dataconnection.ConnectionProp.FilePath, Dataconnection.ConnectionProp.FileName)) == true) { try { string json = File.ReadAllText(Path.Combine(Dataconnection.ConnectionProp.FilePath, Dataconnection.ConnectionProp.FileName)); ds = DMEEditor.ConfigEditor.JsonLoader.DeserializeSingleObject <DataSet>(json); int i = 0; foreach (DataTable tb in ds.Tables) { EntityStructure entityData = new EntityStructure(); string sheetname; sheetname = tb.TableName; entityData.EntityName = sheetname; entityData.DataSourceID = Dataconnection.ConnectionProp.ConnectionName; // entityData.SchemaOrOwnerOrDatabase = Database; List <EntityField> Fields = new List <EntityField>(); int y = 0; foreach (DataColumn field in tb.Columns) { Console.WriteLine(" " + field.ColumnName + ": " + field.DataType); EntityField f = new EntityField(); // f.tablename = sheetname; f.fieldname = field.ColumnName; f.fieldtype = field.DataType.ToString(); f.ValueRetrievedFromParent = false; f.EntityName = sheetname; f.FieldIndex = y; Fields.Add(f); y += 1; } i += 1; entityData.Fields = new List <EntityField>(); entityData.Fields.AddRange(Fields); Entities.Add(entityData); } } catch (Exception) { } } else { DMEEditor.AddLogMessage("Error", "Json File Not Found " + Dataconnection.ConnectionProp.FileName, DateTime.Now, -1, "", Errors.Failed); } }
private IDMDataView AddViewFile() { IDMDataView DataView = null; try { string viewname = null; string fullname = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = DMEEditor.ConfigEditor.Config.Folders.Where(i => i.FolderFilesType == FolderFileTypes.DataView).FirstOrDefault().FolderPath; openFileDialog1.Filter = "json files (*.json)|*.txt|All files (*.*)|*.*"; openFileDialog1.DefaultExt = "json"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { viewname = Path.GetFileName(openFileDialog1.FileName); if ((viewname != null) && DMEEditor.ConfigEditor.DataConnectionExist(viewname + ".json") == false) { fullname = openFileDialog1.FileName; //Path.Combine(Path.GetDirectoryName(openFileDialog1.FileName), Path.GetFileName(openFileDialog1.FileName)); ConnectionProperties f = new ConnectionProperties { FileName = Path.GetFileName(fullname), FilePath = Path.GetDirectoryName(fullname), Ext = Path.GetExtension(fullname), ConnectionName = Path.GetFileName(fullname) }; f.Category = DatasourceCategory.VIEWS; f.DriverVersion = "1"; f.DriverName = "DataViewReader"; DMEEditor.ConfigEditor.DataConnections.Add(f); DMEEditor.ConfigEditor.SaveDataconnectionsValues(); DataViewDataSource ds = (DataViewDataSource)DMEEditor.GetDataSource(f.ConnectionName); DataView = ds.DataView; } DMEEditor.AddLogMessage("Success", "Added View", DateTime.Now, 0, null, Errors.Ok); } else { Visutil.controlEditor.MsgBox("DM Engine", "Please Try another name . DataSource Exist"); } } catch (Exception ex) { string mes = "Could not Added View "; DMEEditor.AddLogMessage(ex.Message, mes, DateTime.Now, -1, mes, Errors.Failed); }; return(DataView); }
private void save() { try { DMEEditor.ConfigEditor.SaveTablesEntities(); } catch (Exception ex) { DMEEditor.AddLogMessage("Fail", $"Could not Save Entity Creation Script {ex.Message}", DateTime.Now, -1, "", Errors.Failed); } }
public IErrorsInfo RunWorker(PassedArgs passedArgs) { args = passedArgs; DME = (DMEEditor)args.Objects.Where(c => c.Name == "DMEEDITOR").FirstOrDefault().obj; // Reset the variable for percentage tracking. highestPercentageReached = 0; args = passedArgs; // Start the asynchronous operation. backgroundWorker1.RunWorkerAsync(args); return(DME.ErrorObject); }
private IErrorsInfo RunCopyData() { try { //----------- Chceck if both Source and Target Exist ----- if (InParameters.Count > 0) { if (OutParameters.Count > 0) { Inds = DMEEditor.GetDataSource(InParameters[0].DatasourceName); if (Inds == null) { DMEEditor.AddLogMessage("Error", " No DataSource exists ", DateTime.Now, -1, "", Errors.Failed); } else { if (DMEEditor.ErrorObject.Flag == Errors.Ok) // --- Successful in Getting Data { Outds = DMEEditor.GetDataSource(OutParameters[0].DatasourceName); if (Outds == null) { DMEEditor.AddLogMessage("Error", "Getting Data From Source ", DateTime.Now, -1, "", Errors.Failed); } else //---- Everything Checks OK we can Procceed with Data Loading { try { RunCopyDataBackWorker(); DMEEditor.AddLogMessage("Success", $"Copied Data to {OutParameters[0].DatasourceName}", DateTime.Now, -1, "", Errors.Ok); } catch (Exception ex) { DMEEditor.AddLogMessage("Error", "Getting Destination Table " + ex.Message, DateTime.Now, -1, "", Errors.Failed); } } } } } else { DMEEditor.AddLogMessage("Error", " No Target Table Data exist ", DateTime.Now, -1, "", Errors.Failed); } } else { DMEEditor.AddLogMessage("Error", " No Source Table Data exist", DateTime.Now, -1, "", Errors.Failed); } } catch (Exception ex) { DMEEditor.AddLogMessage("Error", "Loading Data" + ex.Message, DateTime.Now, -1, "", Errors.Failed); } return(ErrorObject); }
private IDMDataView CreateViewUsingTable(EntityStructure EntitySource) { IDMDataView DataView = null; IDataSource DataSource = null; IDataSource EntityDataSource = null; try { string viewname = null; string fullname = null; if (Visutil.controlEditor.InputBox("Create View", "Please Enter Name of View (Name Should not exist already in Views)", ref viewname) == System.Windows.Forms.DialogResult.OK) { if ((viewname != null) && DMEEditor.ConfigEditor.DataConnectionExist(viewname + ".json") == false) { fullname = Path.Combine(DMEEditor.ConfigEditor.Config.Folders.Where(x => x.FolderFilesType == FolderFileTypes.DataView).FirstOrDefault().FolderPath, viewname + ".json"); ConnectionProperties f = new ConnectionProperties { FileName = Path.GetFileName(fullname), FilePath = Path.GetDirectoryName(fullname), Ext = Path.GetExtension(fullname), ConnectionName = Path.GetFileName(fullname) }; f.Category = DatasourceCategory.VIEWS; f.DriverVersion = "1"; f.DriverName = "DataViewReader"; DMEEditor.ConfigEditor.DataConnections.Add(f); DataViewDataSource ds = (DataViewDataSource)DMEEditor.GetDataSource(f.ConnectionName); EntityDataSource = DMEEditor.GetDataSource(EntitySource.DataSourceID); if (EntitySource != null) { int x = ds.AddEntitytoDataView(EntityDataSource, EntitySource.EntityName, EntityDataSource.Dataconnection.ConnectionProp.SchemaName, null); } ds.WriteDataViewFile(fullname); DataSource = DMEEditor.GetDataSource(f.ConnectionName); DataView = ds.DataView; DataView.EntityDataSourceID = EntityDataSource.DatasourceName; } DMEEditor.AddLogMessage("Success", "Added View", DateTime.Now, 0, null, Errors.Ok); } else { Visutil.controlEditor.MsgBox("DM Engine", "Please Try another name . DataSource Exist"); } } catch (Exception ex) { string mes = "Could not Added View "; DMEEditor.AddLogMessage(ex.Message, mes, DateTime.Now, -1, mes, Errors.Failed); }; return(DataView); }