public bool AddMember(string ad, string soyad, string email, string kullaniciadi, string sifre) { Üye member = new Üye(); member.Ad = ad; member.Soyad = soyad; member.Email = email; member.KullaniciAdi = kullaniciadi; member.Sifre = sifre; bool result = false; try { if (ad != "" && soyad != "" && email != "" && kullaniciadi != "" && sifre != "") { HaberDBEntities1 db = new HaberDBEntities1(); db.Üye.Add(member); db.SaveChanges(); result = true; } } catch (Exception) { return(result); } return(result); }
public bool MemberDogrula(string kullaniciadi, string sifre) { Üye member = new Üye(); member.KullaniciAdi = kullaniciadi; member.Sifre = sifre; bool result = false; try { HaberDBEntities1 db = new HaberDBEntities1(); string query = String.Format("SELECT COUNT(*) FROM Üye WHERE KullaniciAdi Like '%" + kullaniciadi + "%' AND Sifre Like '%" + sifre + "%' "); SqlConnection con = new SqlConnection("workstation id=HaberDB.mssql.somee.com;packet size=4096;user id=senanurkiraz_SQLLogin_1;pwd=njas7u5ikz;data source=HaberDB.mssql.somee.com;persist security info=False;initial catalog=HaberDB"); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = query; con.Open(); Int32 dr = Convert.ToInt32(cmd.ExecuteScalar()); if (dr == 0) { result = false; } else { result = true; } } catch (Exception) { return(result); } return(result); }