Example #1
0
        private void AddNewStudent()
        {
            var st = new StudentsVM();

            Students.Add(st);
            SelectedStudent = st;
        }
Example #2
0
        public ActionResult TryUpdatePasswd(StudentsVM model)
        {
            using (var MyService = new ServiceReference.Service1Client())
            {
                string sifre = MyService.TryChangePassword(new ServiceReference.Student {
                    EMail = model.EMail
                });
                if (sifre != "")
                {
                    SmtpClient sc = new SmtpClient
                    {
                        Port        = 587,
                        Host        = "mail.notdefterim.pro",
                        EnableSsl   = false,
                        Credentials = new NetworkCredential("*****@*****.**", "393M6znreh.A")
                    };
                    MailMessage mail = new MailMessage
                    {
                        From = new MailAddress("*****@*****.**", "NotDefterimPro")
                    };
                    mail.To.Add(model.EMail);
                    mail.Subject    = "Şifre İsteği";
                    mail.IsBodyHtml = true;
                    mail.Body       = "<div class='container'> <div style='background:white;'><h3 style='color:red'>Not Defterim Pro</h3>" + "<br/>Şifreniz: " + sifre + "<p>Şifreniz başarılı bir şekilde gönderilmiştir.<br/></br>Uygulamamızı kullandığınız için teşekkür eder,<br/> başarılarınızın devamını dileriz...<p/>" + "<p style='font - family:Helvetica, Arial, sans - serif; font - size:12px; line - height:16px; color:#aaaaaa;'>© 2018 - All Rights Reserved. </p><div/><div/>";
                    sc.Send(mail);

                    ViewBag.Script = "swal('Şifre Maile Gönderildi!', 'Şifrenizi unutmayınız', 'success')";
                }
                else
                {
                    ViewBag.Script = "swal('Hatalı Giriş', 'Sistemde Böyle Bir Mail Kayıtlı Değil.', 'error')";
                }
            }
            return(View());
        }
Example #3
0
        public ActionResult UpdateStudent(StudentsVM post)
        {
            using (var ctx = new CSEntities())
            {
                ctx.UpdateStudent(post.HelpID, post.FName, post.LName, post.Phone, post.Email, post.DofB, post.Spec, post.Login, post.Password);

                return(RedirectToAction("Students", "Home"));
            }
        }
Example #4
0
        public ActionResult Students()
        {
            StudentsVM model = new StudentsVM();

            using (var ctx = new CSEntities())
            {
                model.StudentList = (from t in ctx.Students1 select t).ToList();
            }
            return(View(model));
        }
Example #5
0
 public ActionResult UpdateUsers(StudentsVM model)
 {
     using (var MyService = new ServiceReference.Service1Client())
     {
         MyService.UpdateUser(new ServiceReference.Student {
             Id = model.Id, AdSoyad = model.AdSoyad, EMail = model.EMail, GizliSoru = model.GizliSoru, GizliSoruCevap = model.GizliSoruCevap, KullaniciAdi = model.KullaniciAdi, Oturum = model.Oturum, Sifre = model.Sifre
         });
     }
     return(Json(true));
 }
Example #6
0
        private void GetStudents()
        {
            Students = new ObservableCollection <StudentsVM>(repository.GetAll().Select(x => new StudentsVM(x)));

            if (Students.Count <= 0)
            {
                return;
            }

            _selectedStudent = _students.First();
        }
Example #7
0
 public ActionResult UpdatePasswd(StudentsVM model)
 {
     using (var MyService = new ServiceReference.Service1Client())
     {
         if (MyService.ChangePassword(new ServiceReference.Student {
             KullaniciAdi = model.KullaniciAdi, GizliSoru = model.GizliSoru, GizliSoruCevap = model.GizliSoruCevap, Sifre = model.Sifre, EMail = model.EMail
         }))
         {
             ViewBag.Script = "swal('Şifre Güncellendi!', 'Yeni şifrenizi unutmayınız', 'success')";
         }
         else
         {
             TempData["GuncellemeHata"] = "Bulunamıyor";
             ViewBag.Script             = "swal('Hatalı Giriş', 'Bilgileri yanlış ya da eksik girdiniz.', 'error')";
         }
     }
     return(View());
 }
Example #8
0
 public ActionResult Login(StudentsVM swm)
 {
     try
     {
         var MyService = new ServiceReference.Service1Client();
         var result    = MyService.Login(new ServiceReference.Student {
             KullaniciAdi = swm.KullaniciAdi, Sifre = swm.Sifre, AdSoyad = swm.AdSoyad, Oturum = swm.Oturum
         });
         if (result != null)
         {
             Session["UserName"] = result.AdSoyad;
             Session["UserId"]   = Convert.ToString(result.Id);
             if (result.Oturum)
             {
                 Session["Oturum"] = "admin";
             }
             else
             {
                 Session["Oturum"] = "user";
             }
             if (result.KullaniciAdi == "AdministratorYasinAteş")
             {
                 Session["TamYetki"] = "var";
             }
             return(Redirect("Index"));
         }
         else
         {
             TempData["KullaniciYok"] = "*Girdiğiniz Kullanıcı Adı ya da Parolası Yanlıştır.";
             return(View());
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #9
0
 public NewStudentCommand(StudentsVM vm)
 {
     VM = vm;
 }
        // GET: Student
        public ActionResult Index()
        {
            StudentsVM vm = new StudentsVM(_studentRepo.GetActiveStudents());

            return(View(vm));
        }
Example #11
0
 public ActionResult ControlKayit(StudentsVM model)
 {
     return(View());
 }
Example #12
0
        public ActionResult SingUp(StudentsVM model)
        {
            string code = Request.QueryString["code"];



            if (model.KullaniciAdi == "AdministratorYasinAteş")
            {
                model.Oturum = true;
            }
            else
            {
                model.Oturum = false;
            }
            string eror;

            if (model.AdSoyad == "" || model.AdSoyad == null)
            {
                TempData["Eror"] = "AdSoyad ";
            }
            if (model.KullaniciAdi == "" || model.KullaniciAdi == null)
            {
                eror             = Convert.ToString(TempData["Eror"]);
                TempData["Eror"] = eror + "KullanıcıAdı ";
            }
            if (model.Sifre == "" || model.Sifre == null)
            {
                eror             = Convert.ToString(TempData["Eror"]);
                TempData["Eror"] = eror + "Şifre ";
            }
            if (model.EMail == "" || model.EMail == null)
            {
                eror             = Convert.ToString(TempData["Eror"]);
                TempData["Eror"] = eror + "E-Mail ";
            }
            if (model.GizliSoruCevap == "" || model.GizliSoruCevap == null)
            {
                eror             = Convert.ToString(TempData["Eror"]);
                TempData["Eror"] = eror + "GizliSoruCevabı";
            }
            if (Convert.ToString(TempData["Eror"]) == "")
            {
                if (model.KullaniciAdi.Length >= 5 && model.Sifre.Length >= 5 && model.GizliSoruCevap.Length >= 5 && model.EMail.Length >= 5 && model.AdSoyad.Length >= 5)
                {
                    using (var MyService = new ServiceReference.Service1Client())
                    {
                        var c = MyService.AccessControl(new ServiceReference.Student {
                            KullaniciAdi = model.KullaniciAdi, EMail = model.EMail
                        });
                        if (c == null)
                        {
                            if (model.EMail.IndexOf("gmail.com") != -1 | model.EMail.IndexOf("outlook.com") != -1 | model.EMail.IndexOf("yandex.com") != -1 | model.EMail.IndexOf("yahoo.com") != -1 | model.EMail.IndexOf("hotmail.com") != -1 | model.EMail.IndexOf("windowslive.com") != -1)
                            {
                                //Şifre oluşturma
                                char[] cr     = "0123456789abcdefghijklmnoprstuvyzxw1234567890ABCDEFGHIJKLMNOPQRSTUCWXYZ".ToCharArray();
                                string result = string.Empty;
                                Random r      = new Random();
                                for (int i = 0; i < 16; i++)
                                {
                                    result += cr[r.Next(0, cr.Length - 1)].ToString();
                                }
                                //Mail gönderimi
                                SmtpClient sc = new SmtpClient
                                {
                                    Port        = 587,
                                    Host        = "mail.notdefterim.pro",
                                    EnableSsl   = false,
                                    Credentials = new NetworkCredential("*****@*****.**", "393M6znreh.A")
                                };
                                MailMessage mail = new MailMessage
                                {
                                    From = new MailAddress("*****@*****.**", "NotDefterimPro")
                                };
                                mail.To.Add(model.EMail);
                                mail.Subject    = "Onay Kodu";
                                mail.IsBodyHtml = true;
                                mail.Body       = "<div class='container'> <div style='background:white;'><h3 style='color:red'>Not Defterim Pro</h3>" + "<br/>Onay Kodunuz:" + result + "<p>Onay Kodunuz başarılı bir şekilde gönderilmiştir.<br/></br>Uygulamamızı kullandığınız için teşekkür eder,<br/> başarılarınızın devamını dileriz...<p/>" + "<p style='font - family:Helvetica, Arial, sans - serif; font - size:12px; line - height:16px; color:#aaaaaa;'>© 2018 - All Rights Reserved. </p><div/><div/>";
                                sc.Send(mail);
                                TempData["tutucu"] = 1;
                                TempData["result"] = result;



                                if (code == result)
                                {
                                    MyService.SignUp(new ServiceReference.Student {
                                        Id = model.Id, AdSoyad = model.AdSoyad, KullaniciAdi = model.KullaniciAdi, GizliSoru = model.GizliSoru, GizliSoruCevap = model.GizliSoruCevap, Sifre = model.Sifre, EMail = model.EMail, Oturum = model.Oturum
                                    });
                                }
                            }
                            else
                            {
                                TempData["Mail"] = "Gireceğiniz E-Posta Servisi 'gmail.com   outlook.com   yandex.com   yahoo.com   hotmail.com   windowslive.com' ve türevleri olmalıdır.";
                            }
                        }
                        else
                        {
                            TempData["AyniUye"] = "*Kullanıcı Adı ya da E-Mail Daha Önce Alınmıştır.Lütfen Başka Bir Ad veya Mail Giriniz.";
                        }
                    }
                }
                else
                {
                    TempData["Uzunluk"] = "*Gireceğiniz her değer 5 karakterden uzun olmalıdır.";
                }
            }
            else
            {
                TempData["tutucu"] = 2;
            }
            TempData["temp"] = 1;
            return(View());
        }