Exemplo n.º 1
0
        private void bLogin_Click(object sender, EventArgs e)
        {
            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `users` set `Valutka`=`Valutka`+@namz WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value   = id;
            command.Parameters.Add("@namz", MySqlDbType.VarChar).Value = balnc.Text;



            db.openConnection();


            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Баланс успешно пополнен");
            }

            else
            {
                MessageBox.Show("Ошибка");
            }


            db.closeConnection();


            DB        dbb    = new DB();
            DataTable ttable = new DataTable();

            MySqlDataAdapter aadapter = new MySqlDataAdapter();

            MySqlCommand ccommand = new MySqlCommand("SELECT * FROM `users` WHERE `id`=@id", dbb.GetConnection());

            ccommand.Parameters.Add("@id", MySqlDbType.VarChar).Value = id;

            aadapter.SelectCommand = ccommand;
            aadapter.Fill(ttable);

            valll = ttable.Rows[0][7].ToString();

            dbb.openConnection();

            if (ad == "1")
            {
                this.Hide();
                AdminPanel adminPanel = new AdminPanel();
                adminPanel.Show();
                adminPanel.id.Text      = id;
                adminPanel.admin        = ad;
                adminPanel.Valutka.Text = valll;
            }
            if (ad == "2")
            {
                this.Hide();
                AvtoMesh avtoMesh = new AvtoMesh();
                avtoMesh.id.Text      = id;
                avtoMesh.admin        = ad;
                avtoMesh.Valutka.Text = valll;
            }
            if (ad == "0")
            {
                this.Hide();
                Menu mainMenu = new Menu();
                mainMenu.Show();
                mainMenu.id.Text      = id;
                mainMenu.admin        = ad;
                mainMenu.Valutka.Text = valll;
            }



            dbb.closeConnection();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Zakazi())
            {
                return;
            }


            DB db = new DB();

            MySqlCommand command = new MySqlCommand("INSERT INTO `zapic` (`nameZ`, `uid`, `vidwork`, `mark`, `date`, `idAv`, `nameAv`, `Payment`,`Status`,`idAvu`, `idMen`) VALUES (@naz, @id, @vid, @marka, @data,'0','0','0','0','0','0')", db.GetConnection());

            command.Parameters.Add("@naz", MySqlDbType.VarChar).Value   = nazv.Text;
            command.Parameters.Add("@id", MySqlDbType.VarChar).Value    = label9.Text;
            command.Parameters.Add("@vid", MySqlDbType.VarChar).Value   = vidrab.Text;
            command.Parameters.Add("@marka", MySqlDbType.VarChar).Value = marka.Text;
            command.Parameters.Add("@data", MySqlDbType.VarChar).Value  = data.Text;

            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Запись на рассмотрение");
                this.Hide();
                Menu mainMenu = new Menu();
                mainMenu.Show();
                mainMenu.id.Text      = id8;
                mainMenu.admin        = admin;
                mainMenu.Valutka.Text = valll;
            }
            else
            {
                MessageBox.Show("Нет мест");
            }
            db.closeConnection();
        }
Exemplo n.º 3
0
        public Boolean Zakazi()
        {
            String nazvi = nazv.Text;
            DB     db    = new DB();

            DataTable dataTable = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("SELECT * FROM `zapic` WHERE `nameZ` = @naz", db.GetConnection());

            command.Parameters.Add("@naz", MySqlDbType.VarChar).Value = nazvi;

            adapter.SelectCommand = command;
            adapter.Fill(dataTable);


            if (dataTable.Rows.Count > 0)
            {
                MessageBox.Show("Такой заказ уже есть, введите другой");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        private void udal_Click(object sender, EventArgs e)
        {
            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("DELETE FROM `users` WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value = id1;
            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Ваш профиль успешно удален");
                this.Hide();
                Login login = new Login();
                login.Show();
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("Update `zapic` set `vidwork` =@new , `date` =@srok  where uid = @id", db.GetConnection());



            command.Parameters.Add("@id", MySqlDbType.VarChar).Value  = id;
            command.Parameters.Add("@new", MySqlDbType.VarChar).Value = textBox1.Text;

            command.Parameters.Add("@srok", MySqlDbType.VarChar).Value = textBox3.Text;

            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Запись изменена");
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 6
0
        private void label8_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView2.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `zapic` set `idAv`='0', `Payment`=@namz, `Status`=@vidwork WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value      = row.Cells[0].Value.ToString();
            command.Parameters.Add("@namz", MySqlDbType.VarChar).Value    = textBox1.Text;
            command.Parameters.Add("@vidwork", MySqlDbType.VarChar).Value = 3;


            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Чек отправлен");
                this.Hide();
                AvtoMesh avto = new AvtoMesh();
                avto.Show();
                avto.id.Text      = id;
                avto.nameAv       = nameAv;
                avto.admin        = ad;
                avto.Valutka.Text = valll;
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DB               db      = new DB();
            DataTable        table   = new DataTable();
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("Update `users` set `login`=@login, `pass` =@pass, `Name`=@Name, `Famil`=@Famil, `Otche`=@Otche WHERE `id` =@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value    = id1;
            command.Parameters.Add("@login", MySqlDbType.VarChar).Value = nazv.Text;
            command.Parameters.Add("@pass", MySqlDbType.VarChar).Value  = id.Text;
            command.Parameters.Add("@Name", MySqlDbType.VarChar).Value  = vidrab.Text;
            command.Parameters.Add("@Famil", MySqlDbType.VarChar).Value = marka.Text;
            command.Parameters.Add("@Otche", MySqlDbType.VarChar).Value = data.Text;

            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Данные обновлены");
            }
            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 8
0
        private void label4_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("SELECT * FROM `users` WHERE `Admin`=@ad ", db.GetConnection());

            command.Parameters.Add("@ad", MySqlDbType.VarChar).Value = 2;


            adapter.SelectCommand = command;
            adapter.Fill(table);

            if (table.Rows.Count == 0)
            {
                MessageBox.Show("Никого нету");
                return;
            }

            db.openConnection();
            MySqlDataReader reader = command.ExecuteReader();
            List <string[]> data   = new List <string[]>();

            while (reader.Read())
            {
                data.Add(new string[6]);
                data[data.Count - 1][0] = reader[0].ToString();
                data[data.Count - 1][1] = reader[1].ToString();
                data[data.Count - 1][2] = reader[2].ToString();
                data[data.Count - 1][3] = reader[3].ToString();
                data[data.Count - 1][4] = reader[4].ToString();
                data[data.Count - 1][5] = reader[5].ToString();
            }
            reader.Close();
            foreach (string[] s in data)
            {
                dataGridView1.Rows.Add(s);
            }
            if (table.Rows.Count > 0)
            {
                MessageBox.Show("Обновленно");
            }
            else
            {
                MessageBox.Show("Заказов нету");
            }


            db.closeConnection();
        }
Exemplo n.º 9
0
        private void label5_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("DELETE FROM `users` WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value   = row.Cells[0].Value.ToString();
            command.Parameters.Add("@namz", MySqlDbType.VarChar).Value = row.Cells[1].Value.ToString();
            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Запись удалить");
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 10
0
        public void bLogin_Click(object sender, EventArgs e)
        {
            String loginUser = loginField.Text;
            String passUser  = passField.Text;

            DB db = new DB();

            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("SELECT * FROM `users` WHERE `login`=@uL AND `pass`=@uP AND `Admin` != 'NULL'", db.GetConnection());

            command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = loginUser;
            command.Parameters.Add("@uP", MySqlDbType.VarChar).Value = passUser;


            adapter.SelectCommand = command;
            adapter.Fill(table);
            if (table.Rows.Count == 0

                )
            {
                MessageBox.Show("Такого аккаунта не существует");
                return;
            }


            admin = table.Rows[0][6].ToString();
            if (table.Rows.Count > 0 && admin == "0")
            {
                this.Hide();
                Menu mainForm = new Menu();
                mainForm.Show();
                mainForm.id.Text      = table.Rows[0][0].ToString();
                mainForm.admin        = table.Rows[0][6].ToString();
                mainForm.Valutka.Text = table.Rows[0][7].ToString();
            }

            else if (table.Rows.Count > 0 && admin == "1")
            {
                this.Hide();
                AdminPanel adminchik = new AdminPanel();
                adminchik.Show();
                adminchik.id.Text      = table.Rows[0][0].ToString();
                adminchik.admin        = table.Rows[0][6].ToString();
                adminchik.Valutka.Text = table.Rows[0][7].ToString();
            }
            else if (table.Rows.Count > 0 && admin == "2")
            {
                this.Hide();
                AvtoMesh adminc = new AvtoMesh();
                adminc.Show();
                adminc.id.Text      = table.Rows[0][0].ToString();
                adminc.admin        = table.Rows[0][6].ToString();
                adminc.nameAv       = table.Rows[0][3].ToString();
                adminc.Valutka.Text = table.Rows[0][7].ToString();
            }
            else
            {
                MessageBox.Show("No");
            }
        }
Exemplo n.º 11
0
        private void label2_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `users` set `login`=@namz, `pass`=@vidwork, `Name`=@mark,`Famil`=@data, `Otche`=@Otche WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value      = row.Cells[0].Value.ToString();
            command.Parameters.Add("@namz", MySqlDbType.VarChar).Value    = row.Cells[1].Value.ToString();
            command.Parameters.Add("@vidwork", MySqlDbType.VarChar).Value = row.Cells[2].Value.ToString();
            command.Parameters.Add("@mark", MySqlDbType.VarChar).Value    = row.Cells[3].Value.ToString();
            command.Parameters.Add("@data", MySqlDbType.VarChar).Value    = row.Cells[4].Value.ToString();
            command.Parameters.Add("@Otche", MySqlDbType.VarChar).Value   = row.Cells[5].Value.ToString();

            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Запись изменена");
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 12
0
        private void label6_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `zapic` set `Status`=@val  WHERE `id`=@id", db.GetConnection());

            if (table.Rows.Count == 0)
            {
                MessageBox.Show("Выберите заказ");
                return;
            }
            command.Parameters.Add("@id", MySqlDbType.VarChar).Value  = row.Cells[0].Value.ToString();
            command.Parameters.Add("@val", MySqlDbType.VarChar).Value = 0;

            status = row.Cells[6].Value.ToString();

            if (status == "2")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }

            if (status == "1")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }
            if (status == "0")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }

            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
            }

            else
            {
                MessageBox.Show("Ошибка");
            }



            MySqlCommand ccommand = new MySqlCommand("UPDATE `users` set `Valutka`=`Valutka`+((@val*90)/100)  WHERE `id`=@id", db.GetConnection());

            ccommand.Parameters.Add("@id", MySqlDbType.VarChar).Value  = row.Cells[7].Value.ToString();
            ccommand.Parameters.Add("@val", MySqlDbType.VarChar).Value = row.Cells[3].Value.ToString();

            if (status == "2")
            {
                return;
            }
            if (status == "1")
            {
                return;
            }
            if (status == "0")
            {
                return;
            }


            if (ccommand.ExecuteNonQuery() == 1)
            {
            }

            else
            {
                MessageBox.Show("Ошибка");
            }



            MySqlCommand cccommand = new MySqlCommand("UPDATE `users` set `Valutka`=`Valutka`+((@val*10)/100)  WHERE `id`=@id", db.GetConnection());

            cccommand.Parameters.Add("@id", MySqlDbType.VarChar).Value  = row.Cells[4].Value.ToString();
            cccommand.Parameters.Add("@val", MySqlDbType.VarChar).Value = row.Cells[3].Value.ToString();

            if (status == "2")
            {
                return;
            }
            if (status == "1")
            {
                return;
            }
            if (status == "0")
            {
                return;
            }


            if (cccommand.ExecuteNonQuery() == 1)
            {
            }

            else
            {
                MessageBox.Show("Ошибка");
            }



            MySqlCommand scommand = new MySqlCommand("DELETE FROM `zapic` WHERE `id`=@id", db.GetConnection());

            scommand.Parameters.Add("@id", MySqlDbType.VarChar).Value = row.Cells[0].Value.ToString();

            status = row.Cells[6].Value.ToString();
            if (status == "2")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }


            if (status == "1")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }
            if (status == "0")
            {
                MessageBox.Show("Этот заказ нельзя оплатить");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                return;
            }



            if (scommand.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Оплачено");
                if (label5.Visible == false)
                {
                    label5.Visible = true;
                }
                if (label2.Visible == false)
                {
                    label2.Visible = true;
                }
                if (label6.Visible == true)
                {
                    label6.Visible = false;
                }
                if (label8.Visible == true)
                {
                    label8.Visible = false;
                }
                this.label4_Click(sender, e);
            }
            else
            {
                MessageBox.Show("Ошибка");
            }


            db.closeConnection();
        }
Exemplo n.º 13
0
        private void label2_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `zapic` set `nameZ`=@val  WHERE `uid`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value  = row.Cells[4].Value.ToString();
            command.Parameters.Add("@val", MySqlDbType.VarChar).Value = row.Cells[2].Value.ToString();



            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Запись изменена");
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 14
0
        private void label4_Click(object sender, EventArgs e)
        {
            if (dataGridView2.Visible == true)
            {
                dataGridView2.Visible = false;
            }
            if (dataGridView1.Visible == false)
            {
                dataGridView1.Visible = true;
            }
            if (label2.Visible == true)
            {
                label2.Visible = false;
            }
            if (label5.Visible == false)
            {
                label5.Visible = true;
            }

            dataGridView1.Rows.Clear();

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("SELECT * FROM `zapic` WHERE `idAV`='0' AND `nameAv` = '0' AND `Status` = '1'", db.GetConnection());


            adapter.SelectCommand = command;
            adapter.Fill(table);

            if (table.Rows.Count == 0)
            {
                MessageBox.Show("Заказов нету");
                return;
            }

            db.openConnection();
            MySqlDataReader reader = command.ExecuteReader();
            List <string[]> data   = new List <string[]>();

            while (reader.Read())
            {
                data.Add(new string[9]);
                data[data.Count - 1][0] = reader[0].ToString();
                data[data.Count - 1][1] = reader[1].ToString();
                data[data.Count - 1][2] = reader[2].ToString();
                data[data.Count - 1][3] = reader[3].ToString();
                data[data.Count - 1][4] = reader[4].ToString();
                data[data.Count - 1][5] = reader[5].ToString();
                data[data.Count - 1][6] = reader[6].ToString();
                data[data.Count - 1][7] = reader[7].ToString();
                data[data.Count - 1][8] = reader[9].ToString();
            }

            reader.Close();
            foreach (string[] s in data)
            {
                dataGridView1.Rows.Add(s);
            }
            if (table.Rows.Count > 0)
            {
                MessageBox.Show("Обновленно");
            }
            else
            {
                MessageBox.Show("Заказов нету");
            }


            db.closeConnection();
        }
Exemplo n.º 15
0
        private void bRegister_Click(object sender, EventArgs e)
        {
            if (loginReg.Text == "Введите логин")
            {
                MessageBox.Show("Введите логин");
                return;
            }

            if (checkuser())
            {
                return;
            }


            DB           db      = new DB();
            MySqlCommand command = new MySqlCommand("INSERT INTO `users` (`login`, `pass`, `Name`, `Famil`, `Otche`,`Admin`,`Valutka`) VALUES (@login, @pass, @name, @famil, @otche, @Admin,'0')", db.GetConnection());

            command.Parameters.Add("@login", MySqlDbType.VarChar).Value = loginReg.Text;
            command.Parameters.Add("@pass", MySqlDbType.VarChar).Value  = passReg.Text;
            command.Parameters.Add("@Name", MySqlDbType.VarChar).Value  = NameU.Text;
            command.Parameters.Add("@Famil", MySqlDbType.VarChar).Value = FamilU.Text;
            command.Parameters.Add("@Otche", MySqlDbType.VarChar).Value = OtcheU.Text;
            command.Parameters.Add("@Admin", MySqlDbType.VarChar).Value = Admin.Text;

            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Аккаунт был создан");
                this.Hide();
                Login debil = new Login();
                debil.Show();
            }
            else
            {
                MessageBox.Show("Аккаунт не был создан");
            }

            db.closeConnection();
        }
Exemplo n.º 16
0
        private void button1_Click(object sender, EventArgs e)
        {
            DB               db      = new DB();
            DataTable        table   = new DataTable();
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("DELETE FROM `zapic` WHERE `uid`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value = id;


            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Удалено");
            }
            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }
Exemplo n.º 17
0
        public Boolean checkuser()
        {
            DB db = new DB();

            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("SELECT * FROM `users` WHERE `login`= @uL", db.GetConnection());

            command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = loginReg.Text;

            adapter.SelectCommand = command;
            adapter.Fill(table);

            if (table.Rows.Count > 0)
            {
                MessageBox.Show("Такой логин уже есть, введите другой");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 18
0
        private void label6_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            DB        db    = new DB();
            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("UPDATE `zapic` set `Status`=@namz, `idMen`= @men WHERE `id`=@id", db.GetConnection());

            command.Parameters.Add("@id", MySqlDbType.VarChar).Value   = row.Cells[0].Value.ToString();
            command.Parameters.Add("@namz", MySqlDbType.VarChar).Value = 1;
            command.Parameters.Add("@men", MySqlDbType.VarChar).Value  = id1;
            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Заказ одобрен");
                this.label4_Click(sender, e);
            }

            else
            {
                MessageBox.Show("Ошибка");
            }

            db.closeConnection();
        }