Exemplo n.º 1
0
        private void InsertCharity(byte[] photo)
        {
            try
            {
                Random rnd = new Random();
                int    kek = rnd.Next(100, 6000);
                con.Open();
                var com = new SqlCommand("INSERT INTO Charity (CharityId, CharityName, CharityDescription, CharityLogo) VALUES (@CharityId, @CharityName, @CharityDescription, @CharityLogo)", con);

                com.Parameters.Add("@CharityId", SqlDbType.Int).Value                     = kek;
                com.Parameters.Add("@CharityName", SqlDbType.NVarChar, 100).Value         = metroTextBox1.Text;
                com.Parameters.Add("@CharityDescription", SqlDbType.NVarChar, 2000).Value = metroTextBox2.Text;
                com.Parameters.Add("@CharityLogo", SqlDbType.Image, photo.Length).Value   = photo;

                com.ExecuteNonQuery();
                MessageBox.Show("Благотворительная организация успешно добавлена в систему WSR", "WSR: Информация",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                con.Close();

                var CharityForm = new aCharity
                {
                    Location = Location
                };
                CharityForm.Show();
                Hide();
            }
        }
Exemplo n.º 2
0
        private void MetroButton2_Click(object sender, EventArgs e)
        {
            var CharityForm = new aCharity
            {
                Location = Location
            };

            CharityForm.Show();
            Hide();
        }
Exemplo n.º 3
0
        private void PictureBox1_Click(object sender, EventArgs e)
        {
            var CharityForm = new aCharity
            {
                Location = Location
            };

            CharityForm.Show();
            Hide();
        }