Exemple #1
0
        private void LogInForm_Load(object sender, EventArgs e)
        {
            if (!new InternetConnection().CheckForInternetConnection())
            {
                MessageBox.Show("На компьютере отсутствует интернет соединение");
                return;
            }

            ClassUpdateCRM update = new ClassUpdateCRM();

            if (update.checkUpdate())
            {
                doUpdate();
            }

            int ban = 0;

            using (var mySqlConnection = new BackDoorConnection().getDBConnection())
            {
                mySqlConnection.Open();
                using (var cmd = new MySqlCommand("SELECT `BAN` FROM `BAN` WHERE 1", mySqlConnection))
                {
                    using (DbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                ban = reader.GetInt32(0);
                            }
                        }
                    }
                }
            }
            if (ban == 1)
            {
                foreach (Control control in this.Controls)
                {
                    control.Enabled = false;
                }
                labelInfo.Enabled = true;
            }
        }
Exemple #2
0
        public bool checkUpdate()
        {
            /*FormLoading loading = new FormLoading();
             * loading.Show();*/

            string productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;

            string update = "";

            using (var mySqlConnection = new BackDoorConnection().getDBConnection())
            {
                mySqlConnection.Open();
                using (var cmd = new MySqlCommand("SELECT `new_build` FROM `UPDATE` WHERE 1", mySqlConnection))
                {
                    using (DbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                update = reader.GetString(0);
                            }
                        }
                    }
                }
            }
            if (update != productVersion)
            {
                return(true);
            }
            else
            {
                //loading.Dispose();
                return(false);
            }
        }