private void btnGiris_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Server = DESKTOP-L0GT8MC\\FURKAN; Database=Rehber;Trusted_Connection=True;"); if (con.State == ConnectionState.Closed) { con.Open(); } /* * SqlCommand com1 = new SqlCommand("Select * from tblKullanici where kullaniciadi = '" + tbK_adi.Text + "' and sifre = '" + tbParola.Text + "", con); * SqlCommand com2 = new SqlCommand("Select * from tblKullanici where kullaniciadi = '" + tbK_adi.Text + "' and sifre = '" + tbParola.Text + "", con); * * SqlDataReader sd = com1.ExecuteReader();sd.Read(); */ YetkiCekme yetkiNesne = new YetkiCekme(); if (yetkiNesne.yetkiCek(tbK_adi.Text, tbParola.Text).Equals("ADMIN")) { pnl.Show(); this.Hide(); } else if (yetkiNesne.yetkiCek(tbK_adi.Text, tbParola.Text).Equals("OKUYUCU")) { pnl.button5.Enabled = false; pnl.button3.Enabled = false; pnl.button4.Enabled = false; pnl.Show(); this.Hide(); } else if (yetkiNesne.yetkiCek(tbK_adi.Text, tbParola.Text).Equals("YAZICI")) { pnl.button5.Enabled = false; pnl.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı adı veya Şifre hatalı!", "Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); } /* SqlCommand com = new SqlCommand("Select * from tblKullanici where kullaniciadi = '"+tbK_adi.Text+"' and sifre = '"+tbParola.Text+"", con); * com.ExecuteNonQuery(); * SqlDataReader dr = com.ExecuteReader(); * if(dr.Read()) * { * Panel frm2 = new Panel(); * frm2.Show(); * this.Hide(); * * } */ }
private void button1_Click(object sender, EventArgs e) { baglanti.Open(); SqlCommand command = new SqlCommand("sp_musteriKayit", baglanti); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@ad", isim.Text); command.Parameters.AddWithValue("@soyad", soyisim.Text); command.Parameters.AddWithValue("@mus_tc", tc.Text); command.Parameters.AddWithValue("@adres", adres.Text); command.Parameters.AddWithValue("@mus_tel", telefon.Text); command.Parameters.AddWithValue("@mus_email", mail.Text); char cinsiyet = 'E'; if (bay.Checked) { cinsiyet = 'E'; } else { cinsiyet = 'K'; } command.Parameters.AddWithValue("@cinsiyet", cinsiyet); command.Parameters.AddWithValue("@dogumtar", dogumtarihi.Text); command.Parameters.AddWithValue("@dogumyer", dogumyeri.Text); command.ExecuteNonQuery(); string musId = "select mus_no from tblMusteri where mus_tc=" + tc.Text; SqlCommand command2 = new SqlCommand(musId, baglanti); SqlDataReader reader = command2.ExecuteReader(); reader.Read(); int musNo = Convert.ToInt32(reader["mus_no"]); reader.Close(); string deneme = "insert into tblEhliyet values(" + musNo + ",'" + ehliyetno.Text + "','" + ehliyetsinif.Text + "','" + kan.Text + "','" + ehliyetalim.Text + "','" + ehliyetbitis.Text + "')"; SqlCommand cm = new SqlCommand(deneme, baglanti); YetkiCekme yc = new YetkiCekme(); string calisanNo = "select calisan_no from tblCalisan where calisan_no=" + yc.idAnahtar; SqlCommand command3 = new SqlCommand(calisanNo, baglanti); SqlDataReader reader2 = command3.ExecuteReader(); reader2.Read(); int cali = Convert.ToInt32(reader2["calisan_no"]); reader2.Close(); cm.ExecuteNonQuery(); string arackayit = "insert into tblArac_Kiralama values(" + musNo + "," + label17.Text + "," + cali + ",null,null,'" + dateTimePicker1.Value.ToString("MM.dd.yyyy") + "','" + dateTimePicker2.Value.ToString("MM.dd.yyyy") + "')"; SqlCommand arac = new SqlCommand(arackayit, baglanti); arac.ExecuteNonQuery(); string aracGuncele = "update tblArac set kiraDurumu='true' where arac_no=" + label17.Text; SqlCommand guncelle = new SqlCommand(aracGuncele, baglanti); guncelle.ExecuteNonQuery(); baglanti.Close(); MessageBox.Show("Araç Kiralama Başarılı", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); }