Esempio n. 1
0
        private void btngiris_Click(object sender, EventArgs e)
        {
            dbEnginee nesne = new dbEnginee();
            DataTable dt    = nesne.Girisyap(txtKullaniciAd.Text, txtSifre.Text);

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("Hatalı Giriş Yaptınız!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                this.Hide();

                Anasayfa.AdSoyad               = dt.Rows[0]["AdSoyad"].ToString();
                Anasayfa.YetkiDurum            = dt.Rows[0]["YetkiDurum"].ToString();
                Anasayfa.pkKullaniciID         = Convert.ToInt32(dt.Rows[0]["pkKullaniciID"]);
                kitaplar.YetkiDurum            = dt.Rows[0]["YetkiDurum"].ToString();
                kullanicibilgileri.KullaniciAd = dt.Rows[0]["KullaniciAd"].ToString();
                kullanicibilgileri.AdSoyad     = dt.Rows[0]["AdSoyad"].ToString();
                sifre.Sifre = dt.Rows[0]["Sifre"].ToString();
                Anasayfa ac = new Anasayfa();
                ac.ShowDialog();
            }
        }
Esempio n. 2
0
        private void btngonder_Click(object sender, EventArgs e)
        {
            if (txtkullanici.Text == "" || txtmail.Text == "")
            {
                MessageBox.Show("Gerekli alanları doldurunuz!", "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                dbEnginee nesne = new dbEnginee();
                if (nesne.emailkontrol(txtmail.Text) == true)
                {
                    DataTable dtemail = nesne.SifreBul(txtkullanici.Text, txtmail.Text);
                    if (dtemail.Rows.Count == 0)
                    {
                        MessageBox.Show("Sistemdeki kullanıcı adınız ve epostanız eşleşmiyor!", "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        sifreunuttum.Sifre = dtemail.Rows[0]["Sifre"].ToString();
                        ////şifre gönderme
                        try
                        {
                            int    _port               = 587;
                            string _host               = "smtp.live.com";
                            string _clientUserName     = "******";
                            string _fromMail           = "*****@*****.**";
                            string _clientUserPassword = "******";
                            bool   _enableSsl          = true;

                            MailMessage mailMessage = new MailMessage();

                            mailMessage.To.Add(txtmail.Text);
                            mailMessage.IsBodyHtml = true;
                            mailMessage.Body       = @"Şifreniz:" + Sifre;
                            mailMessage.Subject    = @"Şifre Hatırlatma";
                            mailMessage.From       = new MailAddress(_fromMail);

                            SmtpClient smtp = new SmtpClient(_host, _port);
                            smtp.Credentials    = new System.Net.NetworkCredential(_clientUserName, _clientUserPassword);
                            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                            smtp.EnableSsl      = _enableSsl;
                            smtp.Send(mailMessage);
                            MessageBox.Show("Mail başarıyla gönderildi.", "MAIL", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        catch (Exception hata)
                        {
                            MessageBox.Show(hata.Message);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Lütfen geçerli bir mail adresi giriniz", "Geçersiz Mail", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }