示例#1
0
        private void button7_Click(object sender, EventArgs e)
        {
            Form7 frm7 = new Form7();       //实例化一个子窗口

            frm7.TopLevel = false;          //设置子窗口不显示为顶级窗口
            frm7.Dock     = DockStyle.Fill; //填充
            this.panel1.Controls.Clear();   //清空Panel里面的控件
            this.panel1.Controls.Add(frm7); //加入控件
            frm7.Show();                    //让窗体显示
        }
示例#2
0
文件: Form6.cs 项目: Zakharchyk/ATM-
        private void button15_Click(object sender, EventArgs e)
        {
            soundButton();
            if (int.Parse(sum) > 1000)
            {
                MessageBox.Show("Вы нарушили лимит", "Ошибка");
            }
            else
            {
                BD      bD        = new BD();
                DataSet dataTable = new DataSet();

                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());
                command.Parameters.Add("@uc", MySqlDbType.VarChar).Value = key;

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

                int summa  = int.Parse(textBox2.Text);
                int amount = 0;
                if (dataTable.Tables[0].Rows.Count > 0)
                {
                    amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
                }

                MySqlConnection conn   = bD.getConnection();
                string          result = (amount - summa).ToString();
                if (amount < summa)
                {
                    MessageBox.Show("Недостаточно средств", "Ошибка");
                }
                else
                {
                    MySqlCommand command1 = conn.CreateCommand();
                    command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                    command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                    command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;
                    conn.Open();
                    command1.ExecuteNonQuery();
                    conn.Close();

                    Form7 form7 = new Form7(summa, opertaion);
                    form7.Show();
                    this.Hide();
                }
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)//สมัครสมาชิก
        {
            Form7 a = new Form7();

            a.Show();
        }
示例#4
0
        private void promanage_Click_1(object sender, EventArgs e)
        {
            Form7 form = new Form7();

            form.Show();
        }
示例#5
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form7 git = new Form7();

            git.Show();
        }
示例#6
0
        private void bunifuThinButton22_Click_2(object sender, EventArgs e)
        {
            Form7 frms = new Form7();

            frms.Show();
        }
示例#7
0
        private void Attendance_Click(object sender, EventArgs e)
        {
            Form7 fm = new Form7();

            fm.Show();
        }
示例#8
0
文件: 父窗口.cs 项目: 77XX/X
 private void button1_Click(object sender, EventArgs e)
 {
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 0)
     {
         Form2 form2 = new Form2();
         this.Hide();
         form2.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 1)
     {
         Form3 form3 = new Form3();
         this.Hide();
         form3.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 2)
     {
         Form4 form4 = new Form4();
         this.Hide();
         form4.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 3)
     {
         Form5 form5 = new Form5();
         this.Hide();
         form5.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 4)
     {
         Form6 form6 = new Form6();
         this.Hide();
         form6.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 5)
     {
         Form7 form7 = new Form7();
         this.Hide();
         form7.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 6)
     {
         Form8 form8 = new Form8();
         this.Hide();
         form8.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 7)
     {
         Form9 form9 = new Form9();
         this.Hide();
         form9.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 8)
     {
         Form10 form10 = new Form10();
         this.Hide();
         form10.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 9)
     {
         Form11 form11 = new Form11();
         this.Hide();
         form11.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 0)
     {
         Form12 form12 = new Form12();
         this.Hide();
         form12.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 1)
     {
         Form13 form13 = new Form13();
         this.Hide();
         form13.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 2)
     {
         Form14 form14 = new Form14();
         this.Hide();
         form14.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 3)
     {
         Form15 form15 = new Form15();
         this.Hide();
         form15.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 4)
     {
         Form16 form16 = new Form16();
         this.Hide();
         form16.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 5)
     {
         Form17 form17 = new Form17();
         this.Hide();
         form17.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 6)
     {
         Form18 form18 = new Form18();
         this.Hide();
         form18.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 7)
     {
         Form19 form19 = new Form19();
         this.Hide();
         form19.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 8)
     {
         Form20 form20 = new Form20();
         this.Hide();
         form20.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 9)
     {
         Form21 form21 = new Form21();
         this.Hide();
         form21.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 10)
     {
         Form22 form22 = new Form22();
         this.Hide();
         form22.Show();
     }
 }
示例#9
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form7 form7 = new Form7();

            form7.Show();
        }
示例#10
0
        //Выдача денег
        private void button10_Click(object sender, EventArgs e)
        {
            soundButton();

            //Работа с БД (уменьшение средств на счете)
            BD      bD        = new BD();
            DataSet dataTable = new DataSet();

            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());

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

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

            int summa  = int.Parse(textBox1.Text);
            int amount = 0;

            if (dataTable.Tables[0].Rows.Count > 0)
            {
                amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
            }
            if (amount < summa)
            {
                MessageBox.Show("Недостаточно средств", "Ошибка");
            }
            else
            {
                MessageBox.Show($"Баланс {amount}");
                if (summa > 1000 || summa < 1)
                {
                    MessageBox.Show("Вы нарушили лимит (от 0 до 1000 рублей)", "Ошибка");
                    textBox1.Text = "";
                }
                else
                {
                    if (summa % 5 == 0) //Проверка н кратность (так как наличная сумма в любом случаи должна делиться на 5)
                    {
                        MySqlConnection conn   = bD.getConnection();
                        string          result = (amount - summa).ToString();
                        MessageBox.Show($"Result {result}");
                        MySqlCommand command1 = conn.CreateCommand();
                        command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                        command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                        command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;
                        conn.Open();
                        command1.ExecuteNonQuery();
                        conn.Close();

                        SoundPlayer soundPlayer1 = new SoundPlayer("after.wav");
                        SoundPlayer soundPlayer  = new SoundPlayer("cash.wav");
                        soundPlayer1.Load();
                        soundPlayer1.PlaySync();
                        soundPlayer.Load();
                        soundPlayer.PlaySync();
                        textBox1.Text = null;
                        sum           = "";
                        Form7 form7 = new Form7(summa, opertaion);
                        form7.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Мы не можем выдыть сумму с таким номиналом", "Ошибка");
                        textBox1.Text = null;
                        sum           = "";
                    }
                }
            }
        }
示例#11
0
        private void пісочницяToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 form7 = new Form7();

            form7.Show();
        }
示例#12
0
        private void button15_Click(object sender, EventArgs e)
        {
            soundButton();
            MessageBox.Show($"{number}");
            if (Convert.ToInt32(sum) < 1000)
            {
                //Работа с БД (уменьшение средств на счете)
                BD               bD         = new BD();
                DataSet          dataTable  = new DataSet();
                DataSet          dataTable2 = new DataSet();
                MySqlDataAdapter adapter    = new MySqlDataAdapter();
                MySqlDataAdapter adapter1   = new MySqlDataAdapter();
                MySqlCommand     command    = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());
                command.Parameters.Add("@uc", MySqlDbType.VarChar).Value = key;

                MySqlCommand command2 = new MySqlCommand("SELECT money FROM clients WHERE number = @un", bD.getConnection());
                command2.Parameters.Add("@un", MySqlDbType.VarChar).Value = number;


                adapter.SelectCommand = command;
                adapter.Fill(dataTable);
                MessageBox.Show($"{number}");

                adapter1.SelectCommand = command2;
                adapter1.Fill(dataTable2);

                int summa      = int.Parse(textBox2.Text);
                int amount     = 0;
                int new_amount = 0; //Баланс получателя

                if (dataTable.Tables[0].Rows.Count > 0)
                {
                    amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
                }

                if (amount < summa)
                {
                    MessageBox.Show("Недостаточно средств", "Ошибка");
                }
                else
                {
                    if (dataTable2.Tables[0].Rows.Count > 0)
                    {
                        new_amount = int.Parse(dataTable2.Tables[0].Rows[0][0].ToString());
                    }

                    MySqlConnection conn       = bD.getConnection();
                    string          result     = (amount - summa).ToString();
                    string          new_result = (new_amount + summa).ToString();
                    MessageBox.Show($"Result {result}");
                    MessageBox.Show($"Result {new_result}");
                    MySqlCommand command1 = conn.CreateCommand();
                    MySqlCommand command3 = conn.CreateCommand();
                    command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                    command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                    command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;

                    command3.CommandText = "UPDATE clients SET money = @newres WHERE number = @un";
                    command3.Parameters.Add("@newres", MySqlDbType.VarChar).Value = new_result;
                    command3.Parameters.Add("@un", MySqlDbType.VarChar).Value     = number;

                    conn.Open();
                    command1.ExecuteNonQuery();
                    command3.ExecuteNonQuery();
                    conn.Close();

                    MessageBox.Show("Перевод осуществлен", "Уведомление");
                    Form7 form7 = new Form7(summa, opertaion);
                    textBox2.Text = null;
                    this.Close();
                    form7.Show();
                }
            }
            else
            {
                MessageBox.Show("Превышен лимит!", "Ошибка");
            }
        }
示例#13
0
        private void Project13_Click(object sender, EventArgs e)
        {
            Form7 openForm7 = new Form7();

            openForm7.Show();
        }
示例#14
0
        private void видуКонтроляToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 z = new Form7();

            z.Show();
        }
示例#15
0
        private void button5_Click(object sender, EventArgs e)
        {
            Form7 otobus = new Form7();

            otobus.Show();
        }
示例#16
0
        private void button7_Click(object sender, EventArgs e)
        {
            var error7Form = new Form7();

            error7Form.Show();
        }