Пример #1
0
 ///<summary>Updates the passed in ChooseDatabaseModel with the current database/middle tier connection. Only updates values that are stored in
 ///FreeDentalConfig and are also kept in memory.</summary>
 public static void UpdateChooseDatabaseModelFromCurrentConnection(ChooseDatabaseModel chooseDatabaseModel)
 {
     if (string.IsNullOrEmpty(RemotingClient.ServerURI))             //Direct connection
     {
         chooseDatabaseModel.CentralConnectionCur.ServerName    = DataConnection.GetServerName();
         chooseDatabaseModel.CentralConnectionCur.DatabaseName  = DataConnection.GetDatabaseName();
         chooseDatabaseModel.CentralConnectionCur.MySqlUser     = DataConnection.GetMysqlUser();
         chooseDatabaseModel.CentralConnectionCur.MySqlPassword = DataConnection.GetMysqlPass();
         chooseDatabaseModel.CentralConnectionCur.ServiceURI    = "";
     }
     else              //using Middle Tier
     {
         chooseDatabaseModel.CentralConnectionCur.ServiceURI    = RemotingClient.ServerURI;
         chooseDatabaseModel.CentralConnectionCur.ServerName    = "";
         chooseDatabaseModel.CentralConnectionCur.DatabaseName  = "";
         chooseDatabaseModel.CentralConnectionCur.MySqlUser     = "";
         chooseDatabaseModel.CentralConnectionCur.MySqlPassword = "";
     }
 }
Пример #2
0
 public override bool TryGetModelFromView(out ChooseDatabaseModel model)
 {
     model = null;
     try {
         _model.CentralConnectionCur.ServerName    = comboComputerName.Text;
         _model.CentralConnectionCur.DatabaseName  = comboDatabase.Text;
         _model.CentralConnectionCur.MySqlUser     = textUser.Text;
         _model.CentralConnectionCur.MySqlPassword = textPassword.Text;
         _model.NoShow = (checkNoShow.Checked ? YN.Yes : YN.No);
         _model.CentralConnectionCur.ServiceURI      = (checkConnectServer.Checked ? textURI.Text : "");
         _model.CentralConnectionCur.OdUser          = textUser2.Text;
         _model.CentralConnectionCur.OdPassword      = textPassword2.Text;
         _model.CentralConnectionCur.WebServiceIsEcw = checkUsingEcw.Checked;
         _model.DbType           = (listType.SelectedIndex == 1 ? DatabaseType.Oracle : DatabaseType.MySql);
         _model.ConnectionString = textConnectionString.Text;
         _model.CentralConnectionCur.IsAutomaticLogin = checkBoxAutomaticLogin.Checked;
     }
     catch (Exception) {
         return(false);
     }
     model = _model.Copy();
     return(true);
 }
Пример #3
0
        ///<summary>Every optional parameter provided should coincide with a command line argument.
        ///The values passed in will typically override any settings loaded in from the config file.
        ///Passing in a value for webServiceUri or databaseName will cause the config file to not even be considered.</summary>
        public static ChooseDatabaseModel GetChooseDatabaseModelFromConfig(string webServiceUri = "", YN webServiceIsEcw  = YN.Unknown, string odUser = ""
                                                                           , string serverName  = "", string databaseName = "", string mySqlUser      = "", string mySqlPassword = "", string mySqlPassHash = "", YN noShow = YN.Unknown
                                                                           , string odPassword  = "", bool useDynamicMode = false, string odPassHash  = "")
        {
            ChooseDatabaseModel chooseDatabaseModel = new ChooseDatabaseModel();

            //Even if we are passed a URI as a command line argument we still need to check the FreeDentalConfig file for middle tier automatic log in.
            //The only time we do not need to do that is if a direct DB has been passed in.
            if (string.IsNullOrEmpty(databaseName))
            {
                CentralConnections.GetChooseDatabaseConnectionSettings(out chooseDatabaseModel.CentralConnectionCur, out chooseDatabaseModel.ConnectionString
                                                                       , out chooseDatabaseModel.NoShow, out chooseDatabaseModel.DbType, out chooseDatabaseModel.ListAdminCompNames, out chooseDatabaseModel.UseDynamicMode
                                                                       , out chooseDatabaseModel.AllowAutoLogin);
            }
            //Command line args should always trump settings from the config file.
            #region Command Line Arguements
            if (webServiceUri != "")           //if a URI was passed in
            {
                chooseDatabaseModel.CentralConnectionCur.ServiceURI = webServiceUri;
            }
            if (webServiceIsEcw != YN.Unknown)
            {
                chooseDatabaseModel.CentralConnectionCur.WebServiceIsEcw = (webServiceIsEcw == YN.Yes ? true : false);
            }
            if (odUser != "")
            {
                chooseDatabaseModel.CentralConnectionCur.OdUser = odUser;
            }
            if (odPassword != "")
            {
                chooseDatabaseModel.CentralConnectionCur.OdPassword = odPassword;
            }
            if (!string.IsNullOrEmpty(odPassHash))
            {
                chooseDatabaseModel.CentralConnectionCur.OdPassHash = odPassHash;
            }
            if (serverName != "")
            {
                chooseDatabaseModel.CentralConnectionCur.ServerName = serverName;
            }
            if (databaseName != "")
            {
                chooseDatabaseModel.CentralConnectionCur.DatabaseName = databaseName;
            }
            if (mySqlUser != "")
            {
                chooseDatabaseModel.CentralConnectionCur.MySqlUser = mySqlUser;
            }
            if (mySqlPassword != "")
            {
                chooseDatabaseModel.CentralConnectionCur.MySqlPassword = mySqlPassword;
            }
            if (mySqlPassHash != "")
            {
                string decryptedPwd;
                CDT.Class1.Decrypt(mySqlPassHash, out decryptedPwd);
                chooseDatabaseModel.CentralConnectionCur.MySqlPassword = decryptedPwd;
            }
            if (noShow != YN.Unknown)
            {
                chooseDatabaseModel.NoShow = noShow;
            }
            if (odUser != "" && odPassword != "")
            {
                chooseDatabaseModel.NoShow = YN.Yes;
            }
            //If they are overridding to say to use dynamic mode.
            if (useDynamicMode)
            {
                chooseDatabaseModel.UseDynamicMode = useDynamicMode;
            }
            #endregion
            return(chooseDatabaseModel);
        }
Пример #4
0
 public FormChooseDatabase(ChooseDatabaseModel model)
 {
     InitializeComponent();
     Lan.F(this);
     Model = model;
 }