Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtKullaniciAdi.Text == "" || txtYeniTelNo.Text == "")
     {
         MessageBox.Show("Boş Alan Bırakılamaz!!");
     }
     else
     {
         string kullaniciAdi;
         string telNo;
         kullaniciAdi = txtKullaniciAdi.Text;
         telNo        = txtYeniTelNo.Text;
         SqlBaglantisi baglan = new SqlBaglantisi();
         SqlCommand    komut  = new SqlCommand("select * from AboneBilgileri Where kullaniciAdi='" + kullaniciAdi + "'", baglan.baglan());
         SqlDataReader oku    = komut.ExecuteReader();
         if (oku.Read())
         {
             oku.Close();
             SqlCommand guncelle = new SqlCommand("update AboneBilgileri set telefonNo='" + telNo + "'where kullaniciAdi='" + kullaniciAdi + "'", baglan.baglan());
             guncelle.ExecuteNonQuery();
             MessageBox.Show("Telefon Numaranız Değiştirilmiştir.");
         }
         else
         {
             MessageBox.Show("Kullanıcı Adı Hatalı.");
         }
     }
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //bu mailin gelmesi için google mail hesabınızdan güvenliği düşük uygulamalardan gelen maillere izin vermelisiniz.

            SqlBaglantisi baglan = new SqlBaglantisi();
            SqlCommand    komut  = new SqlCommand("Select * From AboneBilgileri Where kullaniciAdi='" + txtKullaniciAdi.Text.ToString() + "'and email= '" + txtMail.Text.ToString() + "'", baglan.baglan());

            SqlDataReader oku = komut.ExecuteReader();

            while (oku.Read())
            {
                try
                {
                    if (baglan.baglan().State == ConnectionState.Closed)
                    {
                        baglan.baglan().Open();
                        //eliff
                    }
                    SmtpClient  smtpserver = new SmtpClient();
                    MailMessage mail       = new MailMessage();
                    String      tarih      = DateTime.Now.ToLongDateString();
                    String      mailAdresi = ("*****@*****.**");
                    String      sifre      = ("343541SER");
                    String      smtpsrvr   = "smtp.gmail.com";
                    String      kime       = (oku["email"].ToString().TrimEnd());
                    String      konu       = ("ŞİFRE HATIRLATMA MAİLİ..");
                    String      yaz        = ("Sayin," + oku["ad"].ToString().TrimEnd() + "\n" + "Bizden" + tarih +
                                              "Tarihinde Şifre Hatırlatma Talebinde Bulundunuz." + "\n" + "Parolanız:" + oku["sifre"].ToString().TrimEnd() +
                                              "\nİyi Günler");
                    smtpserver.Credentials = new NetworkCredential(mailAdresi, sifre);
                    smtpserver.Port        = 587;
                    smtpserver.Host        = smtpsrvr;
                    smtpserver.EnableSsl   = true;
                    mail.From = new MailAddress(mailAdresi);
                    mail.To.Add(kime);
                    mail.Subject = konu;
                    mail.Body    = yaz;
                    smtpserver.Send(mail);
                    DialogResult bilgi = new DialogResult();
                    bilgi = MessageBox.Show("Şifreniz Mail Adresinize Gönderilmiştir..");
                    this.Hide();
                }
                catch (Exception Hata)
                {
                    MessageBox.Show("Bilgileri Kontrol Ediniz. Mail Gönderilemedi.", Hata.Message);
                }
            }
        }