private void button4_Click(object sender, EventArgs e) { frmGirisFisi grsfis = new frmGirisFisi(); grsfis.Show(); this.Hide(); }
private void pictureBox6_Click(object sender, EventArgs e) { frmGirisFisi grsfis = new frmGirisFisi(); grsfis.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { if (dataGridView1.Rows[0].Cells[1].Value == null) { MessageBox.Show("Giriş Fişi Ekleyebilmeniz İçin Ürün Eklemeniz Gerekmektedir."); return; } for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["UrunAdi"].Value != null) { if (dataGridView1.Rows[i].Cells["UrunAdet"].Value == null) { MessageBox.Show("Adet Girmeniz Gerekmektedir."); return; } } } string sql = "Insert Into FisBaslik(FisNo,Tarih,MusteriId,KullaniciRef,Aciklama,FisTipi) Values('" + FisNoTxt.Text + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + MusteriIdLbl.Text + "','" + Anasayfa.kullaniciid + "','" + AciklamaTxt.Text + "','1') SELECT SCOPE_IDENTITY();"; string id = DataBase.execScalar(sql); //Fiş Haraket for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["UrunAdi"].Value != null) { string komut = "Insert Into FisHaraket(FisId,UrunRef,Birim,Miktar,FisTipi) Values('" + id + "','" + dataGridView1.Rows[i].Cells["UrunId"].Value + "','" + dataGridView1.Rows[i].Cells["UrunBirimi"].Value + "','" + dataGridView1.Rows[i].Cells["UrunAdet"].Value + "','1')SELECT SCOPE_IDENTITY();"; haraketid = DataBase.execScalar(komut); string stokekle = "INSERT INTO Stok(UrunRef,Birim,Miktar,Tarih,FisHaraketId) values('" + dataGridView1.Rows[i].Cells["UrunId"].Value + "','" + dataGridView1.Rows[i].Cells["UrunBirimi"].Value + "','" + dataGridView1.Rows[i].Cells["UrunAdet"].Value + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + haraketid + "')"; DataBase.ExecSql(stokekle); } } MessageBox.Show("Eklendi!"); frmGirisFisi girisfrm = new frmGirisFisi(); girisfrm.Show(); this.Hide(); }
private void btn_guncelle_Click(object sender, EventArgs e) { if (dataGridView1.Rows[0].Cells[1].Value == null) { MessageBox.Show("Giriş Fişi Güncelleyebilmeniz İçin Ürün Eklemeniz Gerekmektedir."); return; } for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["UrunAdi"].Value != null) { if (dataGridView1.Rows[i].Cells["UrunAdet"].Value == null) { MessageBox.Show("Adet Girmeniz Gerekmektedir."); return; } } } // string sql = "Insert Into FisBaslik(FisNo,Tarih,MusteriId,KullaniciRef,Aciklama,FisTipi) Values('" + FisNoTxt.Text + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + MusteriIdLbl.Text + "','" + Form1.kullaniciid + "','" + AciklamaTxt.Text + "','1') SELECT SCOPE_IDENTITY();"; string sql = "Update FisBaslik set FisNo='" + FisNoTxt.Text + "',GuncellemeTarihi='" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "',MusteriId='" + MusteriIdLbl.Text + "',Aciklama='" + AciklamaTxt.Text + "' where FisId=" + fisid; DataBase.ExecSql(sql); //Fiş Haraket for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["UrunAdi"].Value != null) { //string komut = "Insert Into FisHaraket(FisId,UrunRef,Birim,Miktar,FisTipi) Values('" + id + "','" + dataGridView1.Rows[i].Cells["UrunId"].Value + "','" + dataGridView1.Rows[i].Cells["UrunBirimi"].Value + "','" + dataGridView1.Rows[i].Cells["UrunAdet"].Value + "','1')"; string komut = "Update FisHaraket set UrunRef='" + dataGridView1.Rows[i].Cells["UrunId"].Value + "',Birim='" + dataGridView1.Rows[i].Cells["UrunBirimi"].Value + "',Miktar='" + dataGridView1.Rows[i].Cells["UrunAdet"].Value + "' where FisHaraketId=" + dataGridView1.Rows[i].Cells["FisHaraketId"].Value; DataBase.ExecSql(komut); } } for (int k = 0; k < dataGridView1.Rows.Count; k++) { if (dataGridView1.Rows[k].Cells["UrunAdi"].Value != null) { int topla = Convert.ToInt32(dataGridView1.Rows[k].Cells["UrunAdet"].Value.ToString()); //string stokekle = "INSERT INTO Stok(UrunRef,Birim,Miktar,Tarih) values('" + dataGridView1.Rows[k].Cells["UrunId"].Value + "','" + dataGridView1.Rows[k].Cells["UrunBirimi"].Value + "','" + topla + "','" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "')"; string stokekle = "Update Stok set UrunRef='" + dataGridView1.Rows[k].Cells["UrunId"].Value + "',Birim='" + dataGridView1.Rows[k].Cells["UrunBirimi"].Value + "',Miktar='" + topla + "' where FisHaraketId=" + dataGridView1.Rows[k].Cells["FisHaraketId"].Value; DataBase.ExecSql(stokekle); } } MessageBox.Show("Güncellendi!"); frmGirisFisi girisfrm = new frmGirisFisi(); girisfrm.Show(); this.Hide(); }