예제 #1
0
        private void logYaz()
        {
            if (comboTur.Text == "ÇIKTI")
            {
                stutar = "-" + txtTutarYeni.Text.Trim();
                tutar  = Convert.ToInt32(stutar);
            }
            else
            {
                tutar = Convert.ToInt32(txtTutarYeni.Text.Trim());
            }

            DataTable dt4 = new DataTable();

            dt4     = db.maliyeLogSonID();
            sonIDst = db.sonIDst;

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

            seciliResimCek();

            MemoryStream ms = new MemoryStream();

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

            string insertQuery = "INSERT INTO karsavor_sistemdb.maliyeLogList(ID, raporID, SorumluKisi, eSorumluKisi, SorumluID, eSorumluID, Tur, eTur, Aciklama, eAciklama, Tutar, eTutar, Makbuz, eMakbuz, Olusturan, eOlusturan, OlusturanID, eOlusturanID) VALUES (@id, @raporid, @sorumlu, @esorumlu, @sorumluid, @esorumluid, @tur, @etur, @aciklama, @eaciklama, @tutar, @etutar, @makbuz, @emakbuz, @olusturan, @eolusturan, @olusturanid, @eolusturanid)";

            mySqlCon.Open();

            command = new MySqlCommand(insertQuery, mySqlCon);

            command.Parameters.Add("@id", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@raporid", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@sorumlu", MySqlDbType.VarChar, 200);
            command.Parameters.Add("@esorumlu", MySqlDbType.VarChar, 200);
            command.Parameters.Add("@sorumluid", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@esorumluid", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@tur", MySqlDbType.VarChar, 50);
            command.Parameters.Add("@etur", MySqlDbType.VarChar, 50);
            command.Parameters.Add("@aciklama", MySqlDbType.VarChar, 300);
            command.Parameters.Add("@eaciklama", MySqlDbType.VarChar, 300);
            command.Parameters.Add("@tutar", MySqlDbType.VarChar, 100);
            command.Parameters.Add("@etutar", MySqlDbType.VarChar, 100);
            command.Parameters.Add("@makbuz", MySqlDbType.LongBlob);
            command.Parameters.Add("@emakbuz", MySqlDbType.LongBlob);
            command.Parameters.Add("@olusturan", MySqlDbType.VarChar, 255);
            command.Parameters.Add("@eolusturan", MySqlDbType.VarChar, 255);
            command.Parameters.Add("@olusturanid", MySqlDbType.UInt16, 255);
            command.Parameters.Add("@eolusturanid", MySqlDbType.UInt16, 255);

            command.Parameters["@id"].Value           = sonID;
            command.Parameters["@raporid"].Value      = sID;
            command.Parameters["@sorumlu"].Value      = sGrvAd;
            command.Parameters["@esorumlu"].Value     = sMsorAd;
            command.Parameters["@sorumluid"].Value    = sGrvID;
            command.Parameters["@esorumluid"].Value   = sMsorID;
            command.Parameters["@tur"].Value          = comboTur.Text.Trim();
            command.Parameters["@etur"].Value         = sMTur;
            command.Parameters["@aciklama"].Value     = txtAciklamaYeni.Text.Trim();
            command.Parameters["@eaciklama"].Value    = sMaciklama;
            command.Parameters["@tutar"].Value        = tutar;
            command.Parameters["@etutar"].Value       = sMTutar;
            command.Parameters["@makbuz"].Value       = img;
            command.Parameters["@emakbuz"].Value      = img2;
            command.Parameters["@olusturan"].Value    = olusturan;
            command.Parameters["@eolusturan"].Value   = sMOlus;
            command.Parameters["@olusturanid"].Value  = AnaForm.grvID;
            command.Parameters["@eolusturanid"].Value = sMOlusID;

            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Log Yazıldı");
            }

            mySqlCon.Close();
        }