Beispiel #1
0
        private void RaporGir()
        {
            DataTable dt3 = new DataTable();

            dt3     = db.maliyeSonID();
            sonIDst = db.sonIDst;

            sonID  = Convert.ToInt32(sonIDst);
            sonID += 1;


            if (comboTur.Text == "ÇIKTI")
            {
                stutar = "-" + txtTutarYeni.Text.Trim();
                tutar  = Convert.ToInt32(stutar);
            }
            else
            {
                tutar = Convert.ToInt32(txtTutarYeni.Text.Trim());
            }

            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
            byte[] img = ms.ToArray();

            string insertQuery = "INSERT INTO karsavor_sistemdb.maliyeList(ID, SorumluKisi, SorumluID, Tur, Aciklama, Tutar, Makbuz, Olusturan, OlusturanID) VALUES (@id, @sorumlu, @sorumluid, @tur, @aciklama, @tutar, @makbuz, @olusturan, @olusturanid)";

            mySqlCon.Open();

            command = new MySqlCommand(insertQuery, mySqlCon);

            command.Parameters.Add("@id", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@sorumlu", MySqlDbType.VarChar, 200);
            command.Parameters.Add("@sorumluid", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@tur", MySqlDbType.VarChar, 50);
            command.Parameters.Add("@aciklama", MySqlDbType.VarChar, 300);
            command.Parameters.Add("@tutar", MySqlDbType.VarChar, 100);
            command.Parameters.Add("@makbuz", MySqlDbType.LongBlob);
            command.Parameters.Add("@olusturan", MySqlDbType.VarChar, 255);
            command.Parameters.Add("@olusturanid", MySqlDbType.UInt16, 255);

            command.Parameters["@id"].Value          = sonID;
            command.Parameters["@sorumlu"].Value     = sGrvAd;
            command.Parameters["@sorumluid"].Value   = sGrvID;
            command.Parameters["@tur"].Value         = comboTur.Text.Trim();
            command.Parameters["@aciklama"].Value    = txtAciklamaYeni.Text.Trim();
            command.Parameters["@tutar"].Value       = tutar;
            command.Parameters["@makbuz"].Value      = img;
            command.Parameters["@olusturan"].Value   = olusturan;
            command.Parameters["@olusturanid"].Value = AnaForm.grvID;

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Yeni Maliye Kaydı Eklendi.");
            }

            mySqlCon.Close();
            MaliyeListe();
        }