private void btnGiris_Click(object sender, EventArgs e) { anapanel = new Anapanel(); if (Convert.ToInt32(lblDeneme.Text) > 0) { try { con.Open(); SqlParameter prm1 = new SqlParameter("@kadi", txtKadi.Text); SqlParameter prm2 = new SqlParameter("@sifre", txtSifre.Text); string sql = "select * from KULLANICILAR where Kad=@kadi and Ksifre=@sifre"; SqlCommand cmd = new SqlCommand(sql, con); cmd.Parameters.Add(prm1); cmd.Parameters.Add(prm2); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); if (dt.Rows.Count > 0 && txtGuvenlik.Text == lblGuvenlik.Text) { if (txtKadi.Text == "admin") { flag = 1; } MessageBox.Show("Giriş Yapıldı!"); this.Hide(); anapanel.Show(); } else { MessageBox.Show("Malesef, birşeyler yolunda gitmedi!"); lblDeneme.Text = (Convert.ToInt32(lblDeneme.Text) - 1).ToString(); SifreOlustur(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (Convert.ToInt32(lblDeneme.Text) == 0) { MessageBox.Show("Giriş yapma hakkınız kalmamıştır, Program kapanıyor!"); Application.Exit(); } }
private void btnIptal_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Server=desktop-2knss9k\\sql_2014;Database=oto_teknik_servis_PROJE;Integrated Security=true"); try { con.Open(); String str = "delete from FATURA where Fid=(select MAX(Fid) from FATURA)"; SqlCommand cmd = new SqlCommand(str, con); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Satış İptal Edildi..!"); anapanel = new Anapanel(); anapanel.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnOnay_Click(object sender, EventArgs e) { anapanel = new Anapanel(); if (txtMiktar.Text != "" && cbUrunTip.Text != "" && cbMarka.Text != "" && cbModel.Text != "" && dataGridView1.RowCount == 2) { if ((int.Parse(dataGridView1.Rows[0].Cells[4].Value.ToString())) >= (int.Parse(txtMiktar.Text))) { SqlConnection con = new SqlConnection("Server=desktop-2knss9k\\sql_2014;Database=oto_teknik_servis_PROJE;Integrated Security=true"); try { con.Open(); String str = "insert into FATURA_SATIS (Fid,Uid,FSmiktar,FSfiyat,Tarih) " + "values((select MAX(Fid) from FATURA),@uid,@fsdmiktar,@fsdfiyat,@tarih)"; SqlCommand cmd = new SqlCommand(str, con); cmd.Parameters.Add(new SqlParameter("@fsdfiyat", lblTutar.Text)); cmd.Parameters.Add(new SqlParameter("@fsdmiktar", txtMiktar.Text)); cmd.Parameters.Add(new SqlParameter("@tarih", DateTime.Now.ToShortDateString())); cmd.Parameters.Add(new SqlParameter("@uid", dataGridView1.Rows[0].Cells[0].Value.ToString())); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Satış başarılı.."); anapanel.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Stok miktarı yeterli değil..!"); } } else { MessageBox.Show("Ürün seçimini eksik ya da hatalı yaptınız..!"); } }
private void btnOnay_Click(object sender, EventArgs e) { anapanel = new Anapanel(); if (txtIslem.Text != "") //&& txtUcret.Text != "" { if (((dataGridView1.SelectedRows[0].Cells[0].Value.ToString())) != "") { SqlConnection con = new SqlConnection("Server=desktop-2knss9k\\sql_2014;Database=oto_teknik_servis_PROJE;Integrated Security=true"); try { con.Open(); String str = "update FATURA_TAMIR set Fid=@fid,Islem=@islem,Ucret=@ucret,TeslimTarih=@tarih where FTid='" + dataGridView1.SelectedRows[0].Cells[6].Value.ToString() + "'"; SqlCommand cmd = new SqlCommand(str, con); cmd.Parameters.Add(new SqlParameter("@fid", dataGridView1.SelectedRows[0].Cells[7].Value.ToString())); cmd.Parameters.Add(new SqlParameter("@islem", txtIslem.Text)); cmd.Parameters.Add(new SqlParameter("@tarih", DateTime.Now.ToShortDateString())); cmd.Parameters.Add(new SqlParameter("@ucret", txtUcret.Text)); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Güncelleme başarılı.."); anapanel.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Tablodan seçim yapınız..!"); } } else { MessageBox.Show("Yapılan İşlem Boş Geçilemez..!"); } }
private void btnIptal_Click(object sender, EventArgs e) { anapanel = new Anapanel(); anapanel.Show(); this.Hide(); }