public ActionResult P_Kayit(P__kayit model) { string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["Merve"].ConnectionString; using (MySqlConnection cn = new MySqlConnection(connStr)) { cn.Open(); MySqlCommand cmd = new MySqlCommand(); if (model.TC <= 0 && model.Kullanici_Adi == null && model.sifre <= 0) { cn.Close(); Response.Write("Hiçbir Alan Boş Geçilemez!!!!"); return(View()); } else { cmd.CommandText = @"INSERT INTO personel_kayit (TC_Kimlik,Kullanici_Adi,Sifre,Personel,Brans,Unvan) Values('" + model.TC + "','" + model.Kullanici_Adi + "','" + model.sifre + "','" + model.Personel + "','" + model.Brans + "','" + model.unvan + "') "; cmd.Connection = cn; cmd.ExecuteNonQuery(); cn.Close(); Response.Write("Kayıt İşlemi Onaylandı!!!"); return(View()); } } }
public ActionResult giris(P__kayit log) { string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["Merve"].ConnectionString; using (MySqlConnection cn = new MySqlConnection(connStr)) { cn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd = new MySqlCommand("select Kullanici_Adi,Sifre,Unvan from personel_kayit where Kullanici_Adi=@Kullaniciadi and Sifre=@sifre", cn); cmd.Parameters.Add("@Kullaniciadi", MySqlDbType.VarChar).Value = log.Kullanici_Adi; cmd.Parameters.Add("@sifre", MySqlDbType.VarChar).Value = log.sifre; hf = cmd.ExecuteReader(); if (hf.Read()) { var unvan = (hf["Unvan"]).ToString(); if (unvan == "4") { Response.Redirect("/Personel_Kayit/P_Kayit"); } else if (unvan == "3") { Response.Redirect("/Randevu_İslemleri/Randevu"); } else if (unvan == "6") { Response.Redirect("/Doktor_Vezne/DoktorVezne"); } else { Response.Write("Böyle bir kayıt bulunmamaktadır !"); } } else { Response.Redirect("/login/giris"); Response.Write("Kullanıcı adı ve şifre hatalı !"); } cmd.Connection = cn; cn.Close(); return(View()); } }