private void kaydet_Click(object sender, EventArgs e) { var goster = from a in database.Musteri where a.KullanıcıAdı == Kullanici_User.Text select a; if (goster.Any()) { Kullanici_User.Text = ""; MessageBox.Show("Farklı Bir Kullanıcı Adı Giriniz!"); } else { if ((Kullanici_Sifre.TextLength >= 8 && Kullanici_Sifre.TextLength <= 12) && (Sifre_Tekrar.TextLength >= 8 && Sifre_Tekrar.TextLength <= 12)) { if (Kullanici_Sifre.Text == Sifre_Tekrar.Text) { string a = GirisSayfasi.ConvertStringtoMD5(Kullanici_Sifre.Text); yeni_musteri.Ad = Kullanici_Adi.Text; yeni_musteri.Soyad = Kullanici_Soyadi.Text; yeni_musteri.Yas = Int32.Parse(Kullanici_Yasi.Text); yeni_musteri.Mail = Kullanici_Maili.Text; yeni_musteri.KullanıcıAdı = Kullanici_User.Text; yeni_musteri.Password = a; database.Musteri.Add(yeni_musteri); database.SaveChanges(); MessageBox.Show("Başarıyla Sisteme Eklendi!"); this.Close(); } else { MessageBox.Show("Şifreler Eşleşmiyor!"); Kullanici_Sifre.Text = ""; Sifre_Tekrar.Text = ""; } } else { MessageBox.Show("Lütfen Şifreyi 8-12 karakter arasında giriniz!!"); Kullanici_Sifre.Text = ""; Sifre_Tekrar.Text = ""; } } }
private void kaydet_Click(object sender, EventArgs e) { guncel_musteri = database.Musteri.Include(z => z.Siparis).Where(t => t.Ad == isim).FirstOrDefault(); if (guncel_musteri != null) { if (Ad_Check.Checked == true) { guncel_musteri.Ad = guncel_musteri.Ad; } else { guncel_musteri.Ad = Kullanici_Adi.Text; } if (Soyad_Check.Checked == true) { guncel_musteri.Soyad = guncel_musteri.Soyad; } else { guncel_musteri.Soyad = Kullanici_Soyadi.Text; } if (Yas_Check.Checked == true) { guncel_musteri.Yas = guncel_musteri.Yas; } else { guncel_musteri.Yas = Int32.Parse(Kullanici_Yasi.Text); } if (Mail__Check.Checked == true) { guncel_musteri.Mail = guncel_musteri.Mail; } else { guncel_musteri.Mail = Kullanici_Maili.Text; } if (Sifre__Check.Checked == true) { guncel_musteri.Password = guncel_musteri.Password; } else { if ((Kullanici_Sifre.TextLength >= 8 && Kullanici_Sifre.TextLength <= 12) && (Kullanici_Eski_Sifre.TextLength >= 8 && Kullanici_Eski_Sifre.TextLength <= 12) && (Kullanici_Sifre_Tekrar.TextLength >= 8 && Kullanici_Sifre_Tekrar.TextLength <= 12)) { if (guncel_musteri.Password == GirisSayfasi.ConvertStringtoMD5(Kullanici_Eski_Sifre.Text)) { if (Kullanici_Sifre.Text == Kullanici_Sifre_Tekrar.Text) { guncel_musteri.Password = GirisSayfasi.ConvertStringtoMD5(Kullanici_Sifre_Tekrar.Text); } else { MessageBox.Show("Şifreler Eşleşmiyor!!"); this.Close(); } } else { MessageBox.Show("Girdiğiniz Şifre Hatalı!"); Kullanici_Eski_Sifre.Text = ""; this.Close(); } } else { MessageBox.Show("Girdiğiniz şifre 8-12 karakter arasında değildir!"); } } if (Bakiye_Check.Checked == true) { guncel_musteri.Bakiye = guncel_musteri.Bakiye; } else { guncel_musteri.Bakiye = Int32.Parse(Kullanici_Bakiye.Text); } guncel_musteri.KullanıcıAdı = guncel_musteri.KullanıcıAdı; database.SaveChanges(); MessageBox.Show("Müşteri Başarıyla Güncellendi!"); } else { Kullanici_Adi.Text = ""; MessageBox.Show("Müşteri Güncellemede Hata Oluştu!"); } }