private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Kimlik No Giriniz"); } else if (textBox2.Text == "") { MessageBox.Show("Şifre Giriniz"); } else { if (con.State == ConnectionState.Closed) { con.Open(); } cmd = new SqlCommand("Select *From Kullanicilar where KullaniciAdi = @id and Sifre = @Sifre", con); cmd.Parameters.AddWithValue("@id", textBox1.Text); cmd.Parameters.AddWithValue("@Sifre", textBox2.Text); dt = cmd.ExecuteReader(); if (dt.HasRows) { while (dt.Read()) { if (dt["turu"].ToString() == "m") { frm = new MusteriProfil(int.Parse(textBox1.Text)); Id = int.Parse(textBox1.Text); frm.Show(); } else if (dt["turu"].ToString() == "c") { cs = new CalisanProfili(int.Parse(textBox1.Text)); Id = int.Parse(textBox1.Text); cs.Show(); } else { cs = new CalisanProfili(int.Parse(textBox1.Text)); cs.yetkili(); Id = int.Parse(textBox1.Text); cs.Show(); } this.Hide(); } } else if (!dt.HasRows) { MessageBox.Show("Hatalı Giriş Yaptınız"); } dt.Close(); } }
private void SatınAlınanUrunler_FormClosed(object sender, FormClosedEventArgs e) { MusteriProfil mf = (MusteriProfil)Application.OpenForms["MusteriProfil"]; mf.Show(); }