示例#1
0
        public string ConnectToDatabase(ConnectionDetails currConnectionDetails, bool checkCustomConfig)
        {
            string exceptionString = dbInteraction.ConnectoToDB(currConnectionDetails, checkCustomConfig);

            try
            {
                OMETrace.Initialize();
            }
            catch (Exception ex)
            {
                ex.ToString(); //ignore
            }
            try
            {
                ExceptionHandler.Initialize();
            }
            catch (Exception ex)
            {
                ex.ToString(); //ignore
            }
            return exceptionString;
        }
示例#2
0
 public static void SaveRecentConnection(ConnectionDetails connDetails)
 {
     ManageConnectionDetails manage = new ManageConnectionDetails(GetCurrentConnParams());
     manage.SaveConnectionDetails(connDetails);
 }
示例#3
0
		public static string ConnectoToDB(ConnectionDetails recConnection, bool customConfig)
		{
			DBConnect db = new DBConnect();
			return db.dbConnection(recConnection.ConnParam, customConfig );                     

		}
示例#4
0
文件: Login.cs 项目: Galigator/db4o
	    private void SaveConnectionAndCreateToolWindows(ConnectionDetails currConnectionDetails)
	    {
	        OMEInteraction.SetCurrentRecentConnection(currConnectionDetails.ConnParam );
	        OMEInteraction.SaveRecentConnection(currConnectionDetails);
	        dbInteraction.SaveAssemblyPath(currConnectionDetails.ConnParam.Connection);
	        AfterSuccessfullyConnected();
            dbInteraction.SetAssemblyPathtoNull();
	        loginToolWindow.Close(vsSaveChanges.vsSaveChangesNo);
	        Helper.CheckIfLoginWindowIsVisible = false;
	        ObjectBrowserToolWin.CreateObjectBrowserToolWindow();
	        ObjectBrowserToolWin.ObjBrowserWindow.Visible = true;

	        PropertyPaneToolWin.CreatePropertiesPaneToolWindow(true);
	        PropertyPaneToolWin.PropWindow.Visible = true;
	    }
示例#5
0
文件: Login.cs 项目: Galigator/db4o
        private void ConnectAfterCreatingNewAppDomain(ConnParams conparam)
        {
            ConnectionDetails currConnectionDetails = new ConnectionDetails(conparam);
            long id = OMEInteraction.ChkIfRecentConnIsInDb(conparam);
            if (id > 0)
            {
                currConnectionDetails = OMEInteraction.GetConnectionDetailsObject(id);
                if (currConnectionDetails != null)
                    currConnectionDetails.ConnParam.ConnectionReadOnly = chkReadOnly.Checked;
            }

            currConnectionDetails.CustomConfigAssemblyPath = txtCustomConfigAssemblyPath.Text.Trim();
            string exceptionString = AssemblyInspectorObject.Connection.ConnectToDatabase(currConnectionDetails,
                                                                                          checkCustomConfig);

            if (exceptionString == string.Empty)
            {
                SaveConnectionAndCreateToolWindows(currConnectionDetails);
                CreateQueryBuilderToolWindow();
            }
            else
            {
                AssemblyInspectorObject.Connection.Closedb();
                textBoxConnection.Clear();
                MessageBox.Show(exceptionString,
                                Helper.GetResourceString(Common.Constants.PRODUCT_CAPTION),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                AppDomain.Unload(appDomain.workerAppDomain);
                dbInteraction.SetAssemblyPathtoNull();
            }
        }
示例#6
0
		private void SaveIndex()
		{
           
		    ConnParams conparam = null;
		    bool customConfig = false;
		    SaveIndexClass saveIndexInstance = null;
			try
			{
				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();

				conparam = OMEInteraction.GetCurrentConnParams();
			    OMEInteraction.CloseOMEdb();
                customConfig = AssemblyInspectorObject.Connection.CheckForCustomConfig();   
				AssemblyInspectorObject.Connection.Closedb();
			    AssemblyInspectorObject.Connection.SaveIndex(saveIndexInstance.Fieldname, saveIndexInstance.Classname,
			                                                 saveIndexInstance.Indexed, conparam.Connection,customConfig );
                MessageBox.Show("Index Saved Successfully!", Helper.GetResourceString(Constants.PRODUCT_CAPTION), MessageBoxButtons.OK);
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
            try
            {
                ConnectionDetails currConnectionDetails = new ConnectionDetails(conparam);
                 long id = OMEInteraction.ChkIfRecentConnIsInDb();
                 if (id > 0)
                 {
                     ConnectionDetails tempConnectionDetails = OMEInteraction.GetConnectionDetailsObject(id);

                     if (tempConnectionDetails != null)
                         currConnectionDetails = tempConnectionDetails;
                     currConnectionDetails.Timestamp = DateTime.Now;


                     AssemblyInspectorObject.Connection.ConnectToDatabase(currConnectionDetails, customConfig);
                     OMEInteraction.SetCurrentRecentConnection(currConnectionDetails.ConnParam );

                     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;
                 }
            }
            catch (Exception Ex)
            {
                LoggingHelper.ShowMessage(Ex);
            }
			
		}