public bool Ekle(DAL.Kullanici kullanici)
 {
     try
     {
         vT.Kullanicis.InsertOnSubmit(kullanici);
         vT.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public bool Sil(string tc_no)
 {
     try
     {
         DAL.Kullanici silinecek = Getir(tc_no);
         vT.Kullanicis.DeleteOnSubmit(silinecek);
         vT.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#3
0
        protected void btnKaydol_Click(object sender, EventArgs e)
        {
            //Ön Kontrolleri Yap..

            //Yeni Kullanici Olustur.
            DAL.Kullanici yeniK       = new DAL.Kullanici();
            BLL.Kullanici blKullanici = new BLL.Kullanici();
            string        tempKullanici;

            yeniK.ogrenci_no = txtOgrencino.Text;
            yeniK.tc_no      = txtTckimlikno.Text;
            yeniK.ad         = txtAd.Text;
            yeniK.soyad      = txtSoyad.Text;
            yeniK.sifre      = Kontrol.getSHA1Hash(txtSifre.Text);
            tempKullanici    = txtEposta.Text;
            yeniK.eposta     = tempKullanici;
            try
            {
                mailkontrol = blKullanici.Getir1(tempKullanici).eposta;
            }
            catch
            {
                mailkontrol = null;
            }

            if (mailkontrol == tempKullanici)
            {
                Response.Write("<script>alert('Kayıt Olma işlemi Başarısız!Eposta Mevcut');</script>");
            }

            else
            {
                yeniK.grup_id      = 1;
                yeniK.bolum_id     = DDBolum.SelectedIndex + 1;
                yeniK.kayit_durumu = false;
                yeniK.kayit_tarihi = DateTime.Now;

                if (blKullanici.Ekle(yeniK))
                {
                    Response.Write("<script>alert('Kayıt Olma işlemi Başarılı!');</script>");
                    System.Threading.Thread.Sleep(1000);
                    Server.Transfer("Login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Kayıt Olma işlemi başarısız!');</script>");
                }
            }
        }
        public bool Duzenle(DAL.Kullanici eskiKullanici, DAL.Kullanici yeniKullanici)
        {
            try
            {
                DAL.Kullanici geciciKullanici = vT.Kullanicis.Where(x => x.tc_no == eskiKullanici.tc_no).First();
                geciciKullanici.sifre = yeniKullanici.sifre;
                vT.SubmitChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        protected void btnSifremiUnuttum_Click(object sender, EventArgs e)
        {
            string sifre;
            string temp;

            DAL.Kullanici VeriCek = new DAL.Kullanici();
            BLL.Kullanici VrCk    = new BLL.Kullanici();
            string        tcNo    = txtTCNo.Text;

            VeriCek = VrCk.Getir(tcNo);
            if (VeriCek != null)
            {
                try
                {
                    temp  = CreatePassword();
                    sifre = Kontrol.getSHA1Hash(temp);

                    VeriCek.sifre = sifre;


                    MailMessage mail = new MailMessage();

                    mail.From = new MailAddress("*****@*****.**", "Karabük Üniversitesi");

                    mail.To.Add(VeriCek.eposta);

                    mail.Subject    = "Yeni Şifre";
                    mail.IsBodyHtml = true;
                    mail.Body       = "Şifre:" + VeriCek.sifre;


                    sc.Send(mail);
                    Response.Write("<script>alert('Kayıt Olma işlemi Başarılı!');</script>");
                    System.Threading.Thread.Sleep(1000);
                    Server.Transfer("Login.aspx");
                }
                catch (Exception ex)
                {
                    System.Threading.Thread.Sleep(1000);
                    Server.Transfer("hata.aspx");
                }
            }
            else
            {
                lblUyari.Text = "TC Kimlik Numarası Hatalı.";
            }
        }
        protected void btnDegistir_Click(object sender, EventArgs e)
        {
            DAL.Kullanici yeniK       = new DAL.Kullanici();
            DAL.Kullanici eskiK       = new DAL.Kullanici();
            Kullanici     blKullanici = new Kullanici();
            string        yenisifre;
            string        confirm;
            string        sifre = eskiSifre.Text;

            sifre = Kontrol.getSHA1Hash(sifre);
            string eposta = kullanici.ToString();

            if (blKullanici.GirisKontrol(eposta, sifre))
            {
                yenisifre = yeniSifre.Text;
                confirm   = sifreDogrula.Text;
                if (yenisifre == confirm)
                {
                    eskiK       = blKullanici.Getir1(eposta);
                    yeniK.sifre = Kontrol.getSHA1Hash(yenisifre);
                    if (blKullanici.Duzenle(eskiK, yeniK))
                    {
                        Response.Write("<script>alert('Şifre değiştirme işlemi Başarılı!');</script>");
                        System.Threading.Thread.Sleep(1000);
                    }
                    else
                    {
                        Response.Write("<script>alert('Şifre değiştirme işlemi başarısız!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Şifre Doğrulanmadı!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Eski Şifreniz Yanlış!Giriş sayfasındaki Şifre Unuttum linkinden yeni şifre alabilirsiniz')</script>");
            }
        }