public static void tableRefresh(In2SqlSvcTool.CurrentTableRecords vCTR, int vIsUndoList = 1) { var vActivCell = SqlEngine.currExcelApp.ActiveCell; if (vCTR.TypeConnection.Contains("ODBC")) { vActivCell.ListObject.QueryTable.CommandText = vCTR.Sql; objRefreshHistory(vActivCell.ListObject, vIsUndoList); if (vIsUndoList == 1) { In2SqlSvcUndoManagment.addToUndoList(vActivCell.ListObject.Name, vCTR.Sql); } } if (vCTR.TypeConnection.Contains("CLOUD")) { In2SqlVBAEngineCloud.createExTable( vCTR.CurrCloudName , vCTR.TableName , vCTR.Sql , 1 , vCTR.CurrCloudExTName); In2SqlSvcTool.addSqlLog(vCTR.Sql); if (vIsUndoList == 1) { In2SqlSvcUndoManagment.addToUndoList(vCTR.CurrCloudExTName, vCTR.Sql); } } }
private void RegularObjecteMenu_Click(object sender, EventArgs e) { if (sender.ToString().Contains("PivotTable")) { intSqlVBAEngine.createPivotTable(miSelectNode.Parent.Parent.Text, miSelectNode.Text); } else if (sender.ToString().Contains("Table")) { if (miSelectNode.Parent.Parent.Tag.ToString().Contains("Cloud")) { In2SqlVBAEngineCloud.createExTable(miSelectNode.Parent.Parent.Text, miSelectNode.Text, null); } else { intSqlVBAEngine.createExTable(miSelectNode.Parent.Parent.Text, miSelectNode.Text); } } /* fix me */ else if (sender.ToString().Contains("generate CSV")) { if (miSelectNode.Parent.Parent.Tag.ToString().ToUpper().Contains("ODBC")) { In2SqlSvcODBC.dumpOdbctoCsv( miSelectNode.Parent.Parent.Text , "select * from " + miSelectNode.Text , In2SqlSvcCsv.getFirstFolder() + miSelectNode.Text + ".csv"); } else if (sender.ToString().Contains("Chart")) { MessageBox.Show(string.Concat("You have Clicked '", sender.ToString(), "' Menu"), "Menu Items Event", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (sender.ToString().Contains("Editor")) { MessageBox.Show(string.Concat("You have Clicked '", sender.ToString(), "' Menu"), "Menu Items Event", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (sender.ToString().Contains("Properties")) { MessageBox.Show(string.Concat("You have Clicked '", sender.ToString(), "' Menu"), "Menu Items Event", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static void RibbonRefresh() { try { //eeee isRefresh = true; var vActivCell = SqlEngine.currExcelApp.ActiveCell; In2SqlSvcTool.CurrentTableRecords vCTR = In2SqlSvcTool.getCurrentSql(); if (vCTR.TypeConnection.Contains("ODBC")) { if ((vActivCell.ListObject != null)) { objRefreshHistory(vActivCell.ListObject); isRefresh = false; return; } if ((vActivCell.PivotTable != null)) { vActivCell.PivotTable.RefreshTable(); isRefresh = false; return; } } if (vCTR.TypeConnection.Contains("CLOUD")) { In2SqlVBAEngineCloud.createExTable( vCTR.CurrCloudName , vCTR.TableName , vCTR.Sql , 1 , vCTR.CurrCloudExTName); isRefresh = false; return; } isRefresh = false; MessageBox.Show(" Please, select cell from the table", " Refresh error"); } catch { isRefresh = false; MessageBox.Show(" Please, select cell from the table", " Refresh error"); } }
public static void RibbonRefreshAll() { try { vInsertList = new List <InsertList>(); var vCurrWorkBook = SqlEngine.currExcelApp.ActiveWorkbook; foreach (Microsoft.Office.Interop.Excel.Worksheet vCurrWorkSheet in vCurrWorkBook.Sheets) { foreach (Microsoft.Office.Interop.Excel.ListObject vTable in vCurrWorkSheet.ListObjects) { In2SqlSvcTool.CurrentTableRecords vCTR = In2SqlSvcTool.getCurrentSql(); if (vCTR.TypeConnection.Contains("ODBC")) { objRefreshHistory(vTable); continue; } if (vCTR.TypeConnection.Contains("CLOUD")) { In2SqlVBAEngineCloud.createExTable( vCTR.CurrCloudName , vCTR.TableName , vCTR.Sql , 1 , vCTR.CurrCloudExTName); isRefresh = false; return; } } foreach (var vTable in vCurrWorkSheet.PivotTables()) { vTable.RefreshTable(); } } } catch { } GetSelectedTab(); }
private void SqlEditTol_Click(object sender, EventArgs e) { if (sender.ToString().Contains("New")) { SqlEditor.Clear(); } else if (sender.ToString().Contains("Open")) { string vSql; vSql = vCurrTable.QueryTable.CommandText; vSql = intSqlVBAEngine.RemoveBetween(vSql, '`', '`'); vSql = vSql.Replace("/**/", ""); SqlEditor.Text = vSql; } else if (sender.ToString().Contains("Save")) { vCurrTable.QueryTable.CommandText = intSqlVBAEngine.setSqlLimit(intSqlVBAEngine.getOdbcNameFromCell(), SqlEditor.Text); } else if (sender.ToString().Contains("Cut")) { SqlEditor.Cut(); } else if (sender.ToString().Contains("Copy")) { SqlEditor.Copy(); } else if (sender.ToString().Contains("Paste")) { SqlEditor.Paste(); } else if (sender.ToString().Contains("Execute")) { SqlEditor.ReadOnly = true; SQLEditToolStrip.Focus(); if (vCTR.TypeConnection.Contains("ODBC")) { vCurrTable.QueryTable.CommandText = intSqlVBAEngine.setSqlLimit(intSqlVBAEngine.getOdbcNameFromObject(vCurrTable), SqlEditor.Text); intSqlVBAEngine.objRefreshHistory(vCurrTable); } if (vCTR.TypeConnection.Contains("CLOUD")) { In2SqlVBAEngineCloud.createExTable( vCTR.CurrCloudName , vCTR.TableName , SqlEditor.Text , 1 , vCTR.CurrCloudExTName); } SqlEditor.ReadOnly = false; } }