public bool SaveRecentConnection(RecentQueries recentQueries) { try { recentQueries.Timestamp = DateTime.Now; RecentQueries temprc = Db4oClient.CurrentRecentConnection.ChkIfRecentConnIsInDb(); if (temprc != null) { temprc.Timestamp = DateTime.Now; temprc.QueryList = recentQueries.QueryList; temprc.ConnParam.ConnectionReadOnly = recentQueries.ConnParam.ConnectionReadOnly; } else { temprc = recentQueries; temprc.TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis(); } IObjectContainer dbrecentConn = Db4oClient.RecentConn; dbrecentConn.Store(temprc); dbrecentConn.Commit(); Db4oClient.CloseRecentConnectionFile(); } catch (Exception oEx) { LoggingHelper.HandleException(oEx); return(false); } return(true); }
private void LoadQueries() { RecentQueries.Clear(); RecentQueries.AddRange(PerDatabaseState.QueryHistoryManager.RecentQueries.Where(q => !q.IsPinned)); PinnedQueries.Clear(); PinnedQueries.AddRange(PerDatabaseState.QueryHistoryManager.RecentQueries.Where(q => q.IsPinned).OrderBy(q => q.IndexName).ThenBy(q => q.Query)); }
private void GenerateDatabase() { string databaseFile = Path.GetTempFileName(); Db4oClient.conn = new ConnParams(databaseFile,false); RecentQueries currRecentQueries = new RecentQueries(Db4oClient.conn); Db4oClient.CurrentRecentConnection = currRecentQueries; Store(); }
private void GenerateDatabase() { string databaseFile = Path.GetTempFileName(); Db4oClient.conn = new ConnParams(databaseFile, false); RecentQueries currRecentQueries = new RecentQueries(Db4oClient.conn); Db4oClient.CurrentRecentConnection = currRecentQueries; Store(); }
private void SaveIndex() { try { SaveIndexClass saveIndexInstance = new SaveIndexClass(Helper.ClassName); foreach (DataGridViewRow row in dbGridViewProperties.Rows) { bool boolValue = Convert.ToBoolean(row.Cells[2].Value); saveIndexInstance.Fieldname.Add(row.Cells[0].Value.ToString()); saveIndexInstance.Indexed.Add(boolValue); } CloseQueryResultToolWindows(); ConnParams conparam = dbInteraction.GetCurrentRecentConnection().ConnParam; dbInteraction.CloseCurrDb(); saveIndexInstance.SaveIndex(); RecentQueries currRecentConnection = new RecentQueries(conparam); Db4oClient.conn = conparam; RecentQueries tempRc = currRecentConnection.ChkIfRecentConnIsInDb(); if (tempRc != null) currRecentConnection = tempRc; currRecentConnection.Timestamp = DateTime.Now; dbInteraction.ConnectoToDB(currRecentConnection); dbInteraction.SetCurrentRecentConnection(currRecentConnection); //Only if following line is added the index is saved. OMQuery omQuery = new OMQuery(saveIndexInstance.Classname , DateTime.Now); long[] objectid = dbInteraction.ExecuteQueryResults(omQuery); if (ObjectBrowser.Instance.ToolStripButtonAssemblyView.Checked) ObjectBrowser.Instance.DbtreeviewObject.FindNSelectNode(ObjectBrowser.Instance.DbAssemblyTreeView.Nodes[0], saveIndexInstance.Classname, ObjectBrowser.Instance.DbAssemblyTreeView); else ObjectBrowser.Instance.DbtreeviewObject.FindNSelectNode(ObjectBrowser.Instance.DbtreeviewObject.Nodes[0], saveIndexInstance.Classname, ObjectBrowser.Instance.DbtreeviewObject); tabStripProperties.SelectedItem = tabItemClassProperties; MessageBox.Show("Index Saved Successfully!", Helper.GetResourceString(Constants.PRODUCT_CAPTION), MessageBoxButtons.OK); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public void LoadAppropriatedata() { DefaultSetting(); Helper.ClassName = null; dbInteractionObject = new dbInteraction(); storedclasses = dbInteractionObject.FetchAllStoredClasses(); if (storedclasses != null) { classCount = storedclasses.Count; } //Assembly view disabled for java db. I don't know any other way ICollection keysCollection = storedclasses.Keys; foreach (string str in keysCollection) { if (!str.Contains(",")) { toolStripButtonAssemblyView.Enabled = false; break; } } //Populate the TreeView dbtreeviewObject.AddFavouritFolderFromDatabase(); dbtreeviewObject.AddTreeNode(storedclasses, null); SelectFirstClassNode(); propertiesTab = PropertiesTab.Instance; if (classCount == 0) { propertiesTab.ShowClassProperties = false; toolStripButtonAssemblyView.Enabled = toolStripButtonFlatView.Enabled = false; } recConnection = dbInteraction.GetCurrentRecentConnection(); PopulateSearchStrings(); dbtreeviewObject.Focus(); dbtreeviewObject.Refresh(); OMETrace.WriteFunctionEnd(); instance = this; }
private void RefreshConnectionData(string filepath) { ConnParams conParams = new ConnParams(filepath, false); RecentQueries recQueries = new RecentQueries(conParams); recQueries = recQueries.ChkIfRecentConnIsInDb(); if (recQueries != null) { FavouriteList favList = new FavouriteList(conParams); favList.RemoveFavouritFolderForAConnection(); GroupofSearchStrings grpSearchString = new GroupofSearchStrings(conParams); grpSearchString.RemovesSearchStringsForAConnection(); recQueries.deleteRecentQueriesForAConnection(); } }
public static void Create() { try { dbInteraction.CreateDemoDb(demoFilePath); ConnParams conparam = new ConnParams(demoFilePath,false); RecentQueries currRecentConnection = new RecentQueries(conparam); RecentQueries tempRc = currRecentConnection.ChkIfRecentConnIsInDb(); if (tempRc != null) currRecentConnection = tempRc; currRecentConnection.Timestamp = DateTime.Now; currRecentConnection.ConnParam = conparam; dbInteraction.ConnectoToDB(currRecentConnection); dbInteraction.SetCurrentRecentConnection(currRecentConnection); } catch (Exception e) { LoggingHelper.ShowMessage(e); } }
public static void Create() { try { dbInteraction.CreateDemoDb(demoFilePath); ConnParams conparam = new ConnParams(demoFilePath, false); RecentQueries currRecentConnection = new RecentQueries(conparam); RecentQueries tempRc = currRecentConnection.ChkIfRecentConnIsInDb(); if (tempRc != null) { currRecentConnection = tempRc; } currRecentConnection.Timestamp = DateTime.Now; currRecentConnection.ConnParam = conparam; dbInteraction.ConnectoToDB(currRecentConnection); dbInteraction.SetCurrentRecentConnection(currRecentConnection); } catch (Exception e) { LoggingHelper.ShowMessage(e); } }
private void RefreshConnectionData(string filepath) { ConnParams conParams = new ConnParams(filepath, false); RecentQueries recQueries = new RecentQueries(conParams); recQueries = recQueries.ChkIfRecentConnIsInDb(); if (recQueries != null) { FavouriteList favList = new FavouriteList(conParams); favList.RemoveFavouritFolderForAConnection(); GroupofSearchStrings grpSearchString = new GroupofSearchStrings(conParams); grpSearchString.RemovesSearchStringsForAConnection(); recQueries.deleteRecentQueriesForAConnection(); } }
private void buttonConnect_Click(object sender, EventArgs e) { try { ConnParams conparam = null; if (radioButtonLocal.Checked) { if (!(Validations.ValidateLocalLoginParams(ref comboBoxFilePath, ref textBoxConnection))) { return; } conparam = new ConnParams(textBoxConnection.Text.Trim(), chkReadOnly.Checked); } else { if (!(Validations.ValidateRemoteLoginParams(ref comboBoxFilePath, ref textBoxHost, ref textBoxPort, ref textBoxUserName, ref textBoxPassword))) { return; } string connection = STRING_SERVER + textBoxHost.Text.Trim() + STRING_COLON + textBoxPort.Text.Trim() + STRING_COLON + textBoxUserName.Text.Trim(); conparam = new ConnParams(connection, textBoxHost.Text.Trim(), textBoxUserName.Text.Trim(), textBoxPassword.Text.Trim(), Convert.ToInt32(textBoxPort.Text.Trim())); } RecentQueries currRecentQueries = new RecentQueries(conparam); RecentQueries tempRecentQueries = currRecentQueries.ChkIfRecentConnIsInDb(); if (tempRecentQueries != null) { currRecentQueries = tempRecentQueries; currRecentQueries.ConnParam.ConnectionReadOnly = chkReadOnly.Checked; } string exceptionString = dbInteraction.ConnectoToDB(currRecentQueries); if (exceptionString == string.Empty) { dbInteraction.SetCurrentRecentConnection(currRecentQueries); dbInteraction.SaveRecentConnection(currRecentQueries); AfterSuccessfullyConnected(); loginToolWindow.Close(vsSaveChanges.vsSaveChangesNo); Helper.CheckIfLoginWindowIsVisible = false; ObjectBrowserToolWin.CreateObjectBrowserToolWindow(); ObjectBrowserToolWin.ObjBrowserWindow.Visible = true; PropertyPaneToolWin.CreatePropertiesPaneToolWindow(true); PropertyPaneToolWin.PropWindow.Visible = true; CreateQueryBuilderToolWindow(); } else { dbInteraction.CloseCurrDb(); textBoxConnection.Clear(); MessageBox.Show(exceptionString, Helper.GetResourceString(Common.Constants.PRODUCT_CAPTION), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void buttonConnect_Click(object sender, EventArgs e) { try { ConnParams conparam = null; if (radioButtonLocal.Checked) { if (!(Validations.ValidateLocalLoginParams(ref comboBoxFilePath, ref textBoxConnection))) return; conparam = new ConnParams(textBoxConnection.Text.Trim(), chkReadOnly.Checked); } else { if (!(Validations.ValidateRemoteLoginParams(ref comboBoxFilePath, ref textBoxHost, ref textBoxPort, ref textBoxUserName, ref textBoxPassword))) return; string connection = STRING_SERVER + textBoxHost.Text.Trim() + STRING_COLON + textBoxPort.Text.Trim() + STRING_COLON + textBoxUserName.Text.Trim(); conparam = new ConnParams(connection, textBoxHost.Text.Trim(), textBoxUserName.Text.Trim(), textBoxPassword.Text.Trim(), Convert.ToInt32(textBoxPort.Text.Trim())); } RecentQueries currRecentQueries = new RecentQueries(conparam); RecentQueries tempRecentQueries = currRecentQueries.ChkIfRecentConnIsInDb(); if (tempRecentQueries != null) { currRecentQueries = tempRecentQueries; currRecentQueries.ConnParam.ConnectionReadOnly = chkReadOnly.Checked; } string exceptionString = dbInteraction.ConnectoToDB(currRecentQueries); if (exceptionString == string.Empty) { dbInteraction.SetCurrentRecentConnection(currRecentQueries); dbInteraction.SaveRecentConnection(currRecentQueries); AfterSuccessfullyConnected(); loginToolWindow.Close(vsSaveChanges.vsSaveChangesNo); Helper.CheckIfLoginWindowIsVisible = false; ObjectBrowserToolWin.CreateObjectBrowserToolWindow(); ObjectBrowserToolWin.ObjBrowserWindow.Visible = true; PropertyPaneToolWin.CreatePropertiesPaneToolWindow(true); PropertyPaneToolWin.PropWindow.Visible = true; CreateQueryBuilderToolWindow(); } else { dbInteraction.CloseCurrDb(); textBoxConnection.Clear(); MessageBox.Show(exceptionString, Helper.GetResourceString(Common.Constants.PRODUCT_CAPTION), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public static long GetTimeforRecentQueriesCreation(ConnParams conn) { RecentQueries rQueries = new RecentQueries(conn); return(rQueries.ReturnTimeWhenRecentQueriesCreated()); }
public static void SaveRecentConnection(RecentQueries recQueries) { Config.Config.Instance.SaveRecentConnection(recQueries); }
public static void RemoveRecentQueries(ConnParams conn) { RecentQueries recentQueries = new RecentQueries(conn); recentQueries.deleteRecentQueriesForAConnection(); }
public static string ConnectoToDB(RecentQueries recConnection) { DBConnect db = new DBConnect(); return db.dbConnection(recConnection.ConnParam); }
public static void SetCurrentRecentConnection(RecentQueries conn) { Db4oClient.CurrentRecentConnection = conn; }
public static long GetTimeforRecentQueriesCreation(ConnParams conn) { RecentQueries rQueries = new RecentQueries(conn); return rQueries.ReturnTimeWhenRecentQueriesCreated(); }
public static string ConnectoToDB(RecentQueries recConnection) { DBConnect db = new DBConnect(); return(db.dbConnection(recConnection.ConnParam)); }
public static void SetCurrentRecentConnection(RecentQueries conn) { Db4oClient.CurrentRecentConnection = conn; }
public static void RemoveRecentQueries(ConnParams conn) { RecentQueries recentQueries = new RecentQueries(conn); recentQueries.deleteRecentQueriesForAConnection(); }
public static void SaveRecentConnection(RecentQueries recQueries) { Config.Config.Instance.SaveRecentConnection(recQueries); }