Exemplo n.º 1
0
        private void ReadConfig()
        {
            var waypt = new Waypoint();

            if (VerifyDatabaseConnection())
            {
                SQL_search.RunQuery("db_Harbor", "SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");
                if (SQL_search.RecordCount > 0)
                {
                    var dbId      = SQL_search.Ds.Tables[0].Rows[0]["ID"].ToString();
                    var dbVersion = SQL_search.Ds.Tables[0].Rows[0]["VERSION"].ToString();
                    MachineData.appLocation = SQL_search.Ds.Tables[0].Rows[0]["LOCATION"].ToString();
                    LoadApplication(SQL_search.Ds.Tables[0].Rows[0]["APPLICATION"].ToString());
                    //checks for recorded version number -------
                    if (MachineData.appVersion == dbVersion)
                    {
                        return;
                    }
                    //updates new version number -----------
                    SQL_general.UpdateComputer("db_Harbor", MachineData.appVersion, dbId);
                }
                else
                {
                    waypt.Show();
                }
            }
            else
            {
                waypt.Show();
            }
        }
Exemplo n.º 2
0
        private static async void ReadConfig(string versionNum)
        {
            var wayPoint = new Waypoint();

            Navigator.NavigationService = wayPoint.NavigationFrame.NavigationService;

            ResultSet rs = await SQL_search.RunQueryAsync("db_lighthouse", "SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");

            if (rs?.recordCount > 0)
            {
                var dbVer = rs.dataSet.Tables[0].Rows[0]["VERSION"].ToString();
                UserSettings.uniqueId = rs.dataSet.Tables[0].Rows[0]["ID"].ToString();
                UserSettings.pcName   = rs.dataSet.Tables[0].Rows[0]["COMPUTER"].ToString();
                UserSettings.username = rs.dataSet.Tables[0].Rows[0]["USERNAME"].ToString();
                //UserSettings.version = rs.dataSet.Tables[0].Rows[0]["VERSION"].ToString();

                UserSettings.accounting = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_ACCOUNTING"]) == 1 ? true : false;
                UserSettings.shipping   = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_SHIPPING"]) == 1 ? true : false;
                UserSettings.infotech   = Convert.ToInt32(rs.dataSet.Tables[0].Rows[0]["ACCESS_INFOTECH"]) == 1 ? true : false;

                //checks for recorded version number -------
                if (UserSettings.version == dbVer)
                {
                    return;
                }
                //updates new version number -----------
                SQL_general.UpdateComputer("db_lighthouse", versionNum, UserSettings.uniqueId);
            }
            else
            {
                SQL_general.InsertComputer("db_lighthouse", Environment.MachineName, versionNum, versionNum);
            }

            wayPoint.Show();
        }