示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            _PB = new Podkl_Bazi();
            _PB.Register_set(comboBox1.Text, comboBox2.Text, textBox1.Text, textBox2.Text);
            this.Hide();
            Autorization Form = new Autorization();

            Form.Show();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            _PB           = new Podkl_Bazi();
            _PB.List_Dbs += _Poluechenie_Serverov;
            Podkl_Bazi.DS = comboBox1.Text;
            Podkl_Bazi.UN = textBox1.Text;
            Podkl_Bazi.UP = textBox2.Text;
            Thread Th = new Thread(_PB.Get_Base_List);

            Th.Start();
        }
示例#3
0
        private void Servers_Load(object sender, EventArgs e)
        {
            proverka_serverov      = false;
            poluchit_spis_serverov = false;
            _PB         = new Podkl_Bazi();
            _PB.Status += _PB_Status;
            toolStripStatusLabel3.Text = "Проверка подключения";
            Thread Th1 = new Thread(_PB.Connection_State);;

            Th1.Start();
        }
        public void Vhod(string password_BD)
        {
            try
            {
                _PB = new Podkl_Bazi();
                _PB.Set_Connection();
                _ComandaSQL = new SqlCommand(id_identificator + password_BD + "'", _PB.Connection);
                _PB.Connection.Open();
                Program.identificator = Convert.ToInt32(_ComandaSQL.ExecuteScalar().ToString());
                switch (Program.identificator)
                {
                case (0):
                    MessageBox.Show("У вас нет доступа к этой системе!");
                    break;

                default:
                    _PB = new Podkl_Bazi();
                    _PB.Set_Connection();
                    _PB.Connection.Open();
                    Program.Systemaccess = Convert.ToInt32(_ComandaSQL.ExecuteScalar().ToString());
                    SqlCommand PassSotrCmd          = new SqlCommand(Password + Program.identificator, _PB.Connection);
                    SqlCommand ProgAccessCmd        = new SqlCommand(Prog_access + Program.identificator, _PB.Connection);
                    SqlCommand IngridientsAccessCmd = new SqlCommand(Ingridients_access + Program.identificator, _PB.Connection);
                    SqlCommand EdaAccessCmd         = new SqlCommand(Eda_access + Program.identificator, _PB.Connection);
                    SqlCommand SotrudnikiAccessCmd  = new SqlCommand(Sotrudniki_access + Program.identificator, _PB.Connection);;
                    SqlCommand KlientsAccessCmd     = new SqlCommand(Klients_access + Program.identificator, _PB.Connection);;
                    SqlCommand RekvizitAccessCmd    = new SqlCommand(Rekvezit_access + Program.identificator, _PB.Connection);;
                    SqlCommand ZakazVZaleCmd        = new SqlCommand(Zakaz_V_Zale_access + Program.identificator, _PB.Connection);;
                    SqlCommand ZakazNaDostCmd       = new SqlCommand(Zakaz_Na_dost_access + Program.identificator, _PB.Connection);
                    SqlCommand AdminAccessCmd       = new SqlCommand(Admin_access + Program.identificator, _PB.Connection);
                    Program.ProgAccess        = Convert.ToInt32(ProgAccessCmd.ExecuteScalar().ToString());
                    Program.IngridientsAccess = Convert.ToInt32(IngridientsAccessCmd.ExecuteScalar().ToString());
                    Program.EdaAccess         = Convert.ToInt32(EdaAccessCmd.ExecuteScalar().ToString());
                    Program.SotrudnikiAccess  = Convert.ToInt32(SotrudnikiAccessCmd.ExecuteScalar().ToString());
                    Program.KlientsAccess     = Convert.ToInt32(KlientsAccessCmd.ExecuteScalar().ToString());
                    Program.RekvizitAccess    = Convert.ToInt32(RekvizitAccessCmd.ExecuteScalar().ToString());
                    Program.ZakazVZale        = Convert.ToInt32(ZakazVZaleCmd.ExecuteScalar().ToString());
                    Program.ZakazNaDost       = Convert.ToInt32(ZakazNaDostCmd.ExecuteScalar().ToString());
                    Program.AdminAccess       = Convert.ToInt32(AdminAccessCmd.ExecuteScalar().ToString());
                    Program.Value             = true;
                    _PB.Connection.Close();
                    break;
                }
                _PB.Connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#5
0
        public void _PB_Status(bool value)
        {
            Action Act = () =>
            {
                proverka_serverov = false;
                switch (value)
                {
                case (true):
                    poluchit_spis_serverov     = false;
                    toolStripStatusLabel3.Text = "Подключение установлено!";
                    Autorization Form = new Autorization();
                    this.Hide();
                    Form.Show();
                    break;

                case (false):
                    toolStripStatusLabel3.Text = "Отсутствует подключение!";
                    label1.Visible             = true;
                    label2.Visible             = true;
                    label3.Visible             = true;
                    label4.Visible             = true;
                    comboBox1.Visible          = true;
                    comboBox2.Visible          = true;
                    textBox1.Visible           = true;
                    textBox2.Visible           = true;
                    button1.Visible            = true;
                    button2.Visible            = true;
                    _PB              = new Podkl_Bazi();
                    _PB.List_Server += _PB_List_Server;
                    Thread Th1 = new Thread(_PB.poluchit_spis_serverov);
                    Th1.Start();
                    break;
                }
            };

            Invoke(Act);
        }//Получение данных и проверка подключения к серверу