Exemplo n.º 1
0
        ///<summary>Returns command-line arguments for launching Open Dental based off of the settings for the connection passed in.</summary>
        private static string GetArgsFromConnection(CentralConnection centralConnection, bool useDynamicMode)
        {
            string args = "";

            if (centralConnection.DatabaseName != "")
            {
                args += "ServerName=\"" + centralConnection.ServerName + "\" "
                        + "DatabaseName=\"" + centralConnection.DatabaseName + "\" "
                        + "MySqlUser=\"" + centralConnection.MySqlUser + "\" ";
                if (centralConnection.MySqlPassword != "")
                {
                    args += "MySqlPassword=\"" + CentralConnections.Decrypt(centralConnection.MySqlPassword, FormCentralManager.EncryptionKey) + "\" ";
                }
            }
            else if (centralConnection.ServiceURI != "")
            {
                args += "WebServiceUri=\"" + centralConnection.ServiceURI + "\" ";
                if (centralConnection.WebServiceIsEcw)
                {
                    args += "WebServiceIsEcw=True ";
                }
            }
            args += "DynamicMode=\"" + (useDynamicMode.ToString()) + "\" ";
            return(args);
        }
        ///<summary>Returns command-line arguments for launching Open Dental based off of the settings for the connection passed in.</summary>
        public static string GetArgsFromConnection(CentralConnection centralConnection)
        {
            string args = "";

            if (centralConnection.DatabaseName != "")
            {
                args += "ServerName=\"" + centralConnection.ServerName + "\" "
                        + "DatabaseName=\"" + centralConnection.DatabaseName + "\" "
                        + "MySqlUser=\"" + centralConnection.MySqlUser + "\" ";
                if (centralConnection.MySqlPassword != "")
                {
                    args += "MySqlPassword=\"" + CentralConnections.Decrypt(centralConnection.MySqlPassword, FormCentralManager.EncryptionKey) + "\" ";
                }
            }
            else if (centralConnection.ServiceURI != "")
            {
                args += "WebServiceUri=\"" + centralConnection.ServiceURI + "\" ";
                if (centralConnection.WebServiceIsEcw)
                {
                    args += "WebServiceIsEcw=True ";
                }
            }
            if (centralConnection.OdUser != "")
            {
                args += "UserName=\"" + Security.CurUser.UserName + "\" ";
            }
            if (centralConnection.OdPassword != "")
            {
                args += "OdPassword=\"" + Security.PasswordTyped + "\" ";
            }
            return(args);
        }
Exemplo n.º 3
0
 private void FormCentralConnectionEdit_Load(object sender, EventArgs e)
 {
     textServerName.Text            = CentralConnectionCur.ServerName;
     textDatabaseName.Text          = CentralConnectionCur.DatabaseName;
     textMySqlUser.Text             = CentralConnectionCur.MySqlUser;
     textMySqlPassword.Text         = CentralConnections.Decrypt(CentralConnectionCur.MySqlPassword, FormCentralManager.EncryptionKey);
     textMySqlPassword.PasswordChar = textMySqlPassword.Text == ""?default(char):'*';        //if password entered, mask it
     textServiceURI.Text            = CentralConnectionCur.ServiceURI;
     checkWebServiceIsEcw.Checked   = CentralConnectionCur.WebServiceIsEcw;
     textNote.Text = CentralConnectionCur.Note;
     checkClinicBreakdown.Checked = CentralConnectionCur.IsNew ? true : CentralConnectionCur.HasClinicBreakdownReports;
 }
 private void FormCentralConnectionEdit_Load(object sender, EventArgs e)
 {
     textServerName.Text          = CentralConnectionCur.ServerName;
     textDatabaseName.Text        = CentralConnectionCur.DatabaseName;
     textMySqlUser.Text           = CentralConnectionCur.MySqlUser;
     textMySqlPassword.Text       = CentralConnections.Decrypt(CentralConnectionCur.MySqlPassword, FormCentralManager.EncryptionKey);
     textServiceURI.Text          = CentralConnectionCur.ServiceURI;
     checkWebServiceIsEcw.Checked = CentralConnectionCur.WebServiceIsEcw;
     textOdUser.Text     = CentralConnectionCur.OdUser;
     textOdPassword.Text = CentralConnections.Decrypt(CentralConnectionCur.OdPassword, FormCentralManager.EncryptionKey);
     textItemOrder.Text  = CentralConnectionCur.ItemOrder.ToString();
     textNote.Text       = CentralConnectionCur.Note;
 }
Exemplo n.º 5
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            CentralConnection conn = (CentralConnection)gridMain.Rows[e.Row].Tag;

            if (conn.ConnectionStatus == "OFFLINE")
            {
                MsgBox.Show(this, "Server Offline.  Fix connection and check status again to connect.");
                return;
            }
            if (conn.ConnectionStatus != "OK")
            {
                MsgBox.Show(this, "Version mismatch.  Either update your program or update the remote server's program and check status again to connect.");
                return;
            }
            string args = "";

            if (conn.DatabaseName != "")
            {
                //ServerName=localhost DatabaseName=opendental MySqlUser=root MySqlPassword=
                args += "ServerName=\"" + conn.ServerName + "\" "
                        + "DatabaseName=\"" + conn.DatabaseName + "\" "
                        + "MySqlUser=\"" + conn.MySqlUser + "\" ";
                if (conn.MySqlPassword != "")
                {
                    args += "MySqlPassword=\"" + CentralConnections.Decrypt(conn.MySqlPassword, EncryptionKey) + "\" ";
                }
            }
            else if (conn.ServiceURI != "")
            {
                args += "WebServiceUri=\"" + conn.ServiceURI + "\" ";          //Command line args expects WebServiceUri explicitly. Case sensitive.
                if (conn.WebServiceIsEcw)
                {
                    args += "WebServiceIsEcw=True ";
                }
            }
            else
            {
                MessageBox.Show("Either a database or a Middle Tier URI must be specified in the connection.");
                return;
            }
            if (checkAutoLog.Checked)
            {
                args += "UserName=\"" + Security.CurUser.UserName + "\" ";
                args += "OdPassword=\"" + Security.PasswordTyped + "\" ";
            }
                        #if DEBUG
            Process.Start("C:\\Development\\OPEN DENTAL SUBVERSION\\head\\OpenDental\\bin\\Debug\\OpenDental.exe", args);
                        #else
            Process.Start("OpenDental.exe", args);
                        #endif
        }
Exemplo n.º 6
0
        ///<summary>Sets the current data connection settings of the central manager to the connection settings passed in.  Setting refreshCache to true will cause the entire local cache to get updated with the cache from the connection passed in if the new connection settings are successful.</summary>
        public static bool SetCentralConnection(CentralConnection centralConnection, bool refreshCache)
        {
            UTF8Encoding enc = new UTF8Encoding();

            byte[] EncryptionKey = enc.GetBytes("mQlEGebnokhGFEFV");          //Gotten from FormCentralManager constructor. Only place that does anything like this.
            string computerName  = "";
            string database      = "";
            string user          = "";
            string password      = "";

            if (centralConnection.ServerName != "")           //Direct connection
            {
                computerName = centralConnection.ServerName;
                database     = centralConnection.DatabaseName;
                user         = centralConnection.MySqlUser;
                if (centralConnection.MySqlPassword != "")
                {
                    password = CentralConnections.Decrypt(centralConnection.MySqlPassword, EncryptionKey);
                }
                try {
                    DataConnection.DBtype = DatabaseType.MySql;
                    DataConnection dcon = new DataConnection();
                    dcon.SetDbT(computerName, database, user, password, "", "", DataConnection.DBtype);
                    RemotingClient.SetRemotingRoleT(RemotingRole.ClientDirect);
                    if (refreshCache)
                    {
                        Cache.Refresh(InvalidType.AllLocal);
                    }
                }
                catch {
                    return(false);
                }
            }
            else if (centralConnection.ServiceURI != "")           //Middle tier connection
            {
                RemotingClient.SetServerURIT(centralConnection.ServiceURI);
                RemotingClient.SetRemotingRoleT(RemotingRole.ClientWeb);
            }
            else
            {
                MessageBox.Show("Either a database or a Middle Tier URI must be specified in the connection.");
                return(false);
            }
            return(true);
        }
Exemplo n.º 7
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            string args = "";

            if (ConnList[e.Row].DatabaseName != "")
            {
                //ServerName=localhost DatabaseName=opendental MySqlUser=root MySqlPassword=
                args += "ServerName=\"" + ConnList[e.Row].ServerName + "\" "
                        + "DatabaseName=\"" + ConnList[e.Row].DatabaseName + "\" "
                        + "MySqlUser=\"" + ConnList[e.Row].MySqlUser + "\" ";
                if (ConnList[e.Row].MySqlPassword != "")
                {
                    args += "MySqlPassword=\"" + CentralConnections.Decrypt(ConnList[e.Row].MySqlPassword, EncryptionKey) + "\" ";
                }
            }
            else if (ConnList[e.Row].ServiceURI != "")
            {
                args += "WebServiceURI=\"" + ConnList[e.Row].ServiceURI + "\" ";
                if (ConnList[e.Row].WebServiceIsEcw)
                {
                    args += "WebServiceIsEcw=True ";
                }
            }
            else
            {
                MessageBox.Show("Either a database or a Middle Tier URI must be specified in the connection.");
                return;
            }
            //od username and password always allowed
            if (ConnList[e.Row].OdUser != "")
            {
                args += "UserName=\"" + ConnList[e.Row].OdUser + "\" ";
            }
            if (ConnList[e.Row].OdPassword != "")
            {
                args += "OdPassword=\"" + CentralConnections.Decrypt(ConnList[e.Row].OdPassword, EncryptionKey) + "\" ";
            }
                        #if DEBUG
            Process.Start("E:\\My Documents\\OPEN DENTAL SUBVERSION\\head\\OpenDental\\bin\\Debug\\OpenDental.exe", args);
                        #else
            Process.Start("OpenDental.exe", args);
                        #endif
        }