Пример #1
0
        private void Backbutton_Click(object sender, EventArgs e)
        {
            ExceptionCase exceptionCase = new ExceptionCase();

            exceptionCase.Show();
            this.Hide();
        }
Пример #2
0
        private void Injuredbutton_Click(object sender, EventArgs e)
        {
            if (NametextBox.Text == "")
            {
                MessageBox.Show("Player Name Can't Be Empty", "ERROR");
            }
            else if (PositioncomboBox.Text == "")
            {
                MessageBox.Show("Player Position Can't Be Empty", "ERROR");
            }
            else if (EventcomboBox.Text == "")
            {
                MessageBox.Show("Event Must Be Selected", "ERROR");
            }

            else
            {
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString);
                connection.Open();

                string     sql     = "Insert into Injuries(name,dateofBirth,photo,height,foot,wage,wageCurrency,price,priceCurrency,position,playerId,event) values('" + NametextBox.Text + "','" + DateOfBirthdateTimePicker.Text + "',@photo,'" + HeighttextBox.Text + "','" + PreferredFootcomboBox.Text + "','" + WagetextBox.Text + "','" + CurrencycomboBox1.Text + "','" + PricetextBox.Text + "','" + CurrencycomboBox2.Text + "','" + PositioncomboBox.Text + "','" + PlayerIdtextBox.Text + "','" + EventcomboBox.Text + "') ";
                SqlCommand command = new SqlCommand(sql, connection);
                command.Parameters.AddWithValue("photo", ConvertImageToByte(InjuryPlayerpictureBox.Image));

                int flag1 = command.ExecuteNonQuery();

                connection.Close();

                SqlConnection connection2 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString);
                connection2.Open();

                string     sql2     = "delete from active where playerId = '" + PlayerIdtextBox.Text + "'";
                SqlCommand command2 = new SqlCommand(sql2, connection2);
                int        flag     = command2.ExecuteNonQuery();

                if (flag == 0 && flag1 == 0)
                {
                    MessageBox.Show("Player Not Added To The Exception Case List!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Player Added To The Exception Case List", "SUCCESSFUL");
                    ExceptionCase exceptionCase = new ExceptionCase();
                    exceptionCase.Show();
                    this.Hide();
                }

                connection2.Close();
            }
        }
Пример #3
0
        private void Casesbutton_Click(object sender, EventArgs e)
        {
            ExceptionCase exceptionCase = new ExceptionCase();

            exceptionCase.Show();
        }