Пример #1
0
        private void label2_Click(object sender, EventArgs e)
        {
            Glavnaya glavnaya = new Glavnaya();

            glavnaya.Show();
            this.Close();
        }
Пример #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Glavnaya glavnaya = new Glavnaya();

            glavnaya.Show();
            this.Close();
        }
Пример #3
0
        //вход в программу
        private void metroLabel3_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection con = BDconnect.GetBDConnection();
                //DeShifrovka a = new DeShifrovka();
                //a.DeShifrowka(metroTextBox1.Text, "YchetPO");
                con.Open();
                string        log = Shifrovka(metroTextBox1.Text, "YchetPO");
                string        pas = Shifrovka(metroTextBox2.Text, "YchetPO");
                SqlCommand    sc  = new SqlCommand("Select * from polzv where[Логин] = '" + log + "' and[Пароль] = '" + pas + "'", con); //выбор данных из таблицы БД
                SqlDataReader dr;
                dr = sc.ExecuteReader();
                int count = 0;
                while (dr.Read())
                {
                    count += 1;
                }
                dr.Close();

                if (count == 1)
                {
                    SqlCommand IP = new SqlCommand("select [I_P] from polz where[login] = '" + log + "' ", con);
                    Program.namepolz = DeShifrovka(IP.ExecuteScalar().ToString(), "YchetPO");

                    //Автоматический вход с помощью реестра
                    if (metroToggle1.Checked)
                    {
                        try
                        {
                            RegistryKey saveKey = Registry.LocalMachine.CreateSubKey("software\\Ychpo");
                            saveKey.SetValue("Polz", "Auto");
                            saveKey.SetValue("login", log);
                            saveKey.SetValue("name", Program.namepolz);
                            saveKey.Close();
                        }
                        catch
                        {
                            MessageBox.Show("Пожалуйста запустите программу от имени администратора");
                            Application.Exit();
                        }
                    }

                    Program.loginpolz = log;
                    Glavnaya glavnaya = new Glavnaya();
                    glavnaya.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Неверный логин или пароль");
                }
            }
            catch
            {
                MessageBox.Show("Отсутствует подключение к базе данных");
            }
        }
Пример #4
0
        private async void Zastavka_Load(object sender, EventArgs e)
        {
            List <string> list = new List <string>();

            for (int i = 0; i < 1000; i++)
            {
                list.Add(i.ToString());
            }
            metroLabel1.Text = "Working...";
            var progressReport = new Progress <ProgressReport>();

            progressReport.ProgressChanged += (o, report) =>
            {
                metroLabel1.Text        = string.Format("Загрузка...{0}%", report.PercentComplete);
                metroProgressBar1.Value = report.PercentComplete;
                metroProgressBar1.Update();
            };
            await ProcessImport(list, progressReport);

            try
            {
                RegistryKey readKey    = Registry.LocalMachine.OpenSubKey("software\\Ychpo");
                string      loadString = (string)readKey.GetValue("Polz");
                readKey.Close();
                if (loadString == "Auto")
                {
                    Glavnaya glavnaya = new Glavnaya();
                    glavnaya.Show();
                    this.Hide();
                }
                else
                {
                    Autoriz autoriz = new Autoriz();
                    autoriz.Show();
                    this.Hide();
                }
            }
            catch
            {
                Autoriz autoriz = new Autoriz();
                autoriz.Show();
                this.Hide();
            }
        }