示例#1
0
        public ActionResult CreateUser(Hocalar form)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    SınavProjesiEntities1 db = new SınavProjesiEntities1();
                    Hocalar user             = new Hocalar();

                    if (db.Hocalar.Where(x => x.Email == form.Email).Count() == 0)
                    {
                        user.HocaAdı    = form.HocaAdı.Trim();
                        user.HocaSoyadı = form.HocaSoyadı.Trim();
                        user.Şifresi    = form.Şifresi.Trim();
                        user.Ünvanı     = form.Ünvanı.Trim();
                        user.Email      = form.Email.Trim();

                        db.Hocalar.Add(user);
                        db.SaveChanges();
                        return(RedirectToRoute("Home"));
                    }
                    else
                    {
                        message         = "Geçerli Bir Email Adresi Giriniz!!";
                        ViewBag.message = message;
                        return(View());
                    }
                }
                catch (Exception ex)
                {
                }
            }

            return(View());
        }
示例#2
0
        public ActionResult Index(Hocalar c, string ReturnUrl)
        {
            if (ModelState.IsValid)
            {
                using (SınavProjesiEntities1 con = new SınavProjesiEntities1())
                {
                    hoca = con.Hocalar.Where(s => s.HocaAdı.Equals(c.HocaAdı) && s.Şifresi.Equals(c.Şifresi)).FirstOrDefault();
                    if (hoca != null)
                    {
                        FormsAuthentication.SetAuthCookie(c.HocaAdı, true);
                        if (Url.IsLocalUrl(ReturnUrl))
                        {
                            return(Redirect(ReturnUrl));
                        }
                        else
                        {
                            Session["HocaAdı"] = hoca.HocaAdı.ToString();
                            Session["Şifresi"] = hoca.Şifresi.ToString();
                            Session["hid"]     = hoca.HocaId.ToString();

                            return(RedirectToRoute("soru3"));
                        }
                    }
                    else
                    {
                        message         = "Geçerli Bir Kullanıcı Adı veya Şifre Giriniz!!";
                        ViewBag.message = message;
                        return(View());
                    }
                }
            }

            ModelState.Remove("Şifresi");
            return(View());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Hocalar hocalar = db.Hocalar.Find(id);

            db.Hocalar.Remove(hocalar);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
        private void button3_Click(object sender, EventArgs e)
        {
            int     id  = (int)comboBox1.Tag;
            Hocalar sil = baglanti.Hocalars.SingleOrDefault(kaybol => kaybol.hoca_id == id);

            baglanti.Hocalars.DeleteOnSubmit(sil);
            baglanti.SubmitChanges();
            Listele();
            Temizle();
        }
 public ActionResult Edit([Bind(Include = "hoca_kodu,adi,soyadi,bolum_kodu")] Hocalar hocalar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hocalar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.bolum_kodu = new SelectList(db.Bolumler, "bolum_kodu", "bolum_adi", hocalar.bolum_kodu);
     return(View(hocalar));
 }
        public ActionResult Create([Bind(Include = "hoca_kodu,adi,soyadi,bolum_kodu")] Hocalar hocalar)
        {
            if (ModelState.IsValid)
            {
                db.Hocalar.Add(hocalar);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.bolum_kodu = new SelectList(db.Bolumler, "bolum_kodu", "bolum_adi", hocalar.bolum_kodu);
            return(View(hocalar));
        }
        // GET: Lecturer/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hocalar hocalar = db.Hocalar.Find(id);

            if (hocalar == null)
            {
                return(HttpNotFound());
            }
            return(View(hocalar));
        }
示例#8
0
        public ActionResult Düzenle(Hocalar form)
        {
            Hocalar         hoca = new Hocalar();
            PostsController sa   = new PostsController();

            hoca = sa.get();


            if (form.HocaAdı != null)
            {
                if (hoca != form)
                {
                    SınavProjesiEntities1 con = new SınavProjesiEntities1();
                    hocal = con.Hocalar.Where(s => s.HocaId == hoca.HocaId).FirstOrDefault();
                    try
                    {
                        if (con.Hocalar.Where(x => x.Email == form.Email).Count() == 0 || form.Email == hoca.Email)
                        {
                            hocal.Email      = form.Email;
                            hocal.HocaAdı    = form.HocaAdı;
                            hocal.HocaSoyadı = form.HocaSoyadı;
                            hocal.Şifresi    = form.Şifresi;
                            hocal.Ünvanı     = form.Ünvanı;
                            //con.Hocalar.Remove();

                            con.SaveChanges();
                            return(RedirectToRoute("soru3"));
                        }
                        else
                        {
                            message         = "Geçerli Bir Email Adresi Giriniz!!";
                            ViewBag.message = message;
                            return(View(form));
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
                else
                {
                    return(View(form));
                }
            }



            return(View(hoca));
        }
        // GET: Lecturer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hocalar hocalar = db.Hocalar.Find(id);

            if (hocalar == null)
            {
                return(HttpNotFound());
            }
            ViewBag.bolum_kodu = new SelectList(db.Bolumler, "bolum_kodu", "bolum_adi", hocalar.bolum_kodu);
            return(View(hocalar));
        }
示例#10
0
        private void button2_Click(object sender, EventArgs e)
        {
            Hocalar ekle = new Hocalar();

            ekle.cocuk_id = Convert.ToInt32(comboBox2.SelectedValue);
            ekle.birim_id = Convert.ToInt32(comboBox3.SelectedValue);
            ekle.görev_id = Convert.ToInt32(comboBox4.SelectedValue);
            ekle.sube_id  = Convert.ToInt32(comboBox5.SelectedValue);
            ekle.proje_id = Convert.ToInt32(comboBox6.SelectedValue);
            ekle.AdSoyad  = textBox1.Text;

            baglanti.Hocalars.InsertOnSubmit(ekle);
            baglanti.SubmitChanges();
            Listele();
            Temizle();
        }
示例#11
0
        private void button4_Click(object sender, EventArgs e)
        {
            int     id     = (int)comboBox1.Tag;
            Hocalar yenile = baglanti.Hocalars.SingleOrDefault(y => y.hoca_id == id);

            yenile.cocuk_id = Convert.ToInt32(comboBox2.SelectedValue);
            yenile.birim_id = Convert.ToInt32(comboBox3.SelectedValue);
            yenile.görev_id = Convert.ToInt32(comboBox4.SelectedValue);
            yenile.sube_id  = Convert.ToInt32(comboBox5.SelectedValue);
            yenile.proje_id = Convert.ToInt32(comboBox6.SelectedValue);
            yenile.AdSoyad  = textBox1.Text;

            baglanti.SubmitChanges();
            Listele();
            Temizle();
        }
示例#12
0
        public ActionResult Profilim(FormCollection p)
        {
            Hocalar hoca = new Hocalar();

            if (hocal.Email == null)
            {
                PostsController sa = new PostsController();
                hoca = sa.get();
                return(View(hoca));
            }
            else
            {
                message         = "Bilgileriniz Başarıyla Güncellendi.";
                ViewBag.message = message;
                return(View(hocal));
            }
        }
        public ActionResult İletişim(EmailForm form, Hocalar a)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    SınavProjesiEntities1 db = new SınavProjesiEntities1();
                    Hocalar user             = new Hocalar();

                    if (db.Hocalar.Where(x => x.Email == a.Email).Count() == 0)
                    {
                        message         = "Geçerli Bir Email Adresi Giriniz!!";
                        ViewBag.message = message;
                        return(View());
                    }
                    else
                    {
                        SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
                        var        mail       = new MailMessage();
                        mail.From = new MailAddress("*****@*****.**");
                        mail.To.Add(form.Email);
                        mail.Subject    = form.Konu;
                        mail.IsBodyHtml = true;
                        string htmlBody;
                        htmlBody  = " İsim:   " + form.İsim + "<br>" + "  Telefon: " + form.Tel + "<br>" + "Mesaj:    " + form.Messaj;
                        mail.Body = htmlBody;

                        SmtpServer.Port = 587;
                        SmtpServer.UseDefaultCredentials = false;
                        SmtpServer.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "CTRL123alt");
                        SmtpServer.EnableSsl             = true;
                        SmtpServer.Send(mail);
                        message         = "Mesajınız iletildi!!";
                        ViewBag.message = message;

                        return(RedirectToAction("İletişim", "Yardımcı"));
                    }
                }
                catch (Exception ex)
                {
                }
            }
            return(View());
        }
示例#14
0
        public ActionResult SifremiUnuttum(Hocalar c)
        {
            if (ModelState.IsValid)
            {
                using (SınavProjesiEntities1 con = new SınavProjesiEntities1())
                {
                    var count = con.Hocalar.Where(s => s.Email.Equals(c.Email)).FirstOrDefault();
                    if (count != null)
                    {
                        SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
                        var        mail       = new MailMessage();
                        mail.IsBodyHtml = true;
                        mail.From       = new MailAddress("*****@*****.**");
                        mail.To.Add(c.Email);
                        mail.Subject = "Kullanıcı Bilgileri Hatırlatma";

                        string htmlBody;

                        htmlBody  = "Şifreniz:" + count.Şifresi.ToString() + "<br>Giriş İçin <a href='#'>Tıklayınız</a>";
                        mail.Body = htmlBody;

                        SmtpServer.Port = 587;
                        SmtpServer.UseDefaultCredentials = false;
                        SmtpServer.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "CTRL123alt");
                        SmtpServer.EnableSsl             = true;
                        SmtpServer.Send(mail);
                        message         = "Şifreniz Email Adresinize gönderilmiştir.";
                        ViewBag.message = message;
                        return(View());
                    }
                    else
                    {
                        message         = "Sitemizde Bu Email Adresi Kayıtlı Değil, Lütfen geçerli bir Email adresi giriniz";
                        ViewBag.message = message;
                        return(View());
                    }
                }
            }
            return(View());
        }