public void openDestination(string conStr, string conName) { try { if (RightDS.isConnected() == false) { RightDS = new Datasource(conStr, conName); if (RightDS.isConnected() == true) { RightQ = new QueryerForm(RightDS, "right"); RightQ.nameindex = "Destination"; RightQ.MdiParent = this; RightQ.Show(); RightQ.Focus(); } } else { if (RightQ.Visible == false) { RightQ = new QueryerForm(RightDS, "right"); } RightQ.MdiParent = this; RightQ.Show(); RightQ.Focus(); } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }
public void openSource(string conStr, string conName) { try { if (LeftDS.isConnected() == false) { LeftDS = new Datasource(conStr, conName); if (LeftDS.isConnected() == true) { LeftQ = new QueryerForm(LeftDS, "left"); LeftQ.nameindex = "Source"; LeftQ.MdiParent = this; LeftQ.Show(); LeftQ.Focus(); } } else { if (LeftQ.Visible == false) { LeftQ = new QueryerForm(LeftDS, "left"); } LeftQ.MdiParent = this; LeftQ.Show(); LeftQ.Focus(); } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }
public void openQueryer(string conectionString, string conName) { try { Datasource QueryerDS = new Datasource(conectionString, conName); if (QueryerDS.isConnected() == true) { QueryerForm QueryerQ = new QueryerForm(QueryerDS, "mid"); if (QueryerQS != null) { QueryerQ.index = QueryerQS.Length; } if (QueryerADS != null) { QueryerDS.index = QueryerADS.Length; } QueryerQ.nameindex = "Queryer" + QueryerQ.index; QueryerQ.MdiParent = this; QueryerQ.Show(); QueryerQ.Focus(); QueryerQS = QueryerQS.AddItemToArray(QueryerQ); QueryerADS = QueryerADS.AddItemToArray(QueryerDS); } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }
private void queryerToolStripMenuItem_Click(object sender, EventArgs e) { using (var rform = new ConnectForm()) { var result = rform.ShowDialog(); if (result == DialogResult.OK) { string conStr = rform.conStr; string conName = rform.connectionName; Datasource QueryerDS = new Datasource(conStr, conName); if (QueryerDS.isConnected() == true) { QueryerForm QueryerQ = new QueryerForm(QueryerDS, "mid"); if (QueryerQS != null) { QueryerQ.index = QueryerQS.Length; } if (QueryerADS != null) { QueryerDS.index = QueryerADS.Length; } QueryerQ.nameindex = "Queryer" + QueryerQ.index; QueryerQ.MdiParent = this; QueryerQ.Show(); QueryerQ.Focus(); QueryerQS = QueryerQS.AddItemToArray(QueryerQ); QueryerADS = QueryerADS.AddItemToArray(QueryerDS); } } } }
private void connectLeftMenu_Click(object sender, EventArgs e) { try { if (LeftDS.isConnected() == false) { using (var rform = new ConnectForm()) { var result = rform.ShowDialog(); if (result == DialogResult.OK) { string conStr = rform.conStr; string conName = rform.connectionName; LeftDS = new Datasource(conStr, conName); if (LeftDS.isConnected() == true) { LeftQ = new QueryerForm(LeftDS, "left"); LeftQ.nameindex = "Source"; LeftQ.MdiParent = this; LeftQ.Show(); LeftQ.Focus(); } } } } else { if (LeftQ.Visible == false) { LeftQ = new QueryerForm(LeftDS, "left"); } LeftQ.MdiParent = this; LeftQ.Show(); LeftQ.Focus(); } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }
private void convertToolStripMenuItem_Click(object sender, EventArgs e) { try { string schema = ""; string path = ""; string[] files = new string[0]; using (var rform = new ConvertForm()) { var result = rform.ShowDialog(); if (result == DialogResult.OK) { files = files.AddItemToArray(rform.outputFile); } } if (files != null) { if (files.Count() > 0) { if (IsDirectory(files[0]) == true) { path = files[0]; } else { path = Path.GetDirectoryName(files[0]); } if (File.Exists(path + "\\Schema.ini")) { schema = File.ReadAllText(path + "\\Schema.ini"); } foreach (string file in Directory.GetFiles(path)) { if (file.Contains(".csv")) { if (schema.Contains(Path.GetFileName(file).ToString()) == false) { System.IO.StreamReader tmpf = new System.IO.StreamReader(file); string line = tmpf.ReadLine(); string delimiter = ""; if (line != "") { if (line.Contains(" ")) { delimiter = "Delimited( )"; } if (line.Contains("|")) { delimiter = "Delimited(|)"; } if (line.Contains("\t")) { delimiter = "TabDelimited"; } if (line.Contains(";")) { delimiter = "Delimited(;)"; } } tmpf.Close(); if (delimiter != "") { schema = schema + "[" + Path.GetFileName(file).ToString() + "]\r\n"; schema = schema + "Format=" + delimiter + "\r\n\r\n"; } } } } if (schema != "") { File.WriteAllText(path + "\\Schema.ini", schema); } if (path != "") { string conStr = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + path + ";Extensions=asc,csv,tab,txt;"; Datasource QueryerDS = new Datasource(conStr, Path.GetFileName(path)); if (QueryerDS.isConnected() == true) { QueryerForm QueryerQ = new QueryerForm(QueryerDS, "mid"); if (QueryerQS != null) { QueryerQ.index = QueryerQS.Length; } if (QueryerADS != null) { QueryerDS.index = QueryerADS.Length; } QueryerQ.nameindex = "Queryer" + QueryerQ.index; QueryerQ.MdiParent = this; QueryerQ.Show(); QueryerQ.Focus(); QueryerQS = QueryerQS.AddItemToArray(QueryerQ); QueryerADS = QueryerADS.AddItemToArray(QueryerDS); } } } } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }