Ejemplo n.º 1
0
        public JsonResult TalepislemYap(int TalepID, int sure)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                Talepler talep = taleprepo.Get(TalepID);
                Okullar  okul  = okulrepo.Get((int)talep.OkulID);
                okul.BaslangicTarihi = DateTime.Now;
                okul.BitisTarihi     = DateTime.Now.Date.AddMonths(sure);

                okul.AktifMi  = true;
                talep.AktifMi = false;

                okulrepo.Update(okul);
                taleprepo.Update(talep);

                jmodel.IsSuccess   = true;
                jmodel.UserMessage = "İşlem başarılı bir şekilde gerçekleştirildi.";
            }
            catch (Exception)
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Güncelleme işlemi sırasında bir hata oluştu.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult _OkulDetay(int id)
        {
            Talepler talep = taleprepo.Get(id);
            Okullar  okul  = okulrepo.Get((int)talep.OkulID);

            return(PartialView("_OkulDetay", okul));
        }
Ejemplo n.º 3
0
        public bool OkulKullaniciAdiVarMi(string kadi)
        {
            OkulRepository orepo = new OkulRepository();
            Okullar        o     = orepo.GetByFilter(a => a.KullaniciAdi == kadi);

            if (o == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public JsonResult TalepOlustur(TalepOlusturModel model)
        {
            JsonResultModel jmodel = new JsonResultModel();

            //try
            //{
            if (f.OkulKullaniciAdiVarMi(f.Encrypt(model.KullaniciAdi)) == false)
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Aynı kullanıcı adına sahip başka bir okul var. Lütfen kullanıcı adınızı değiştiriniz.";
            }
            else
            {
                Okullar  o = new Okullar();
                Talepler t = new Talepler();
                o.Adi                   = model.Adi;
                o.Adres                 = model.Adres;
                o.AktifMi               = false;
                o.ilID                  = model.ilID;
                o.ilceID                = model.ilceID;
                o.KayitTarihi           = DateTime.Now;
                o.YetkiliAdSoyad        = model.YetkiliAdSoyad;
                o.YetkiliEmail          = model.YetkiliEmail;
                o.YetkiliTel            = model.YetkiliTel;
                o.KullaniciAdi          = f.Encrypt(model.KullaniciAdi);
                o.Sifre                 = f.Encrypt(model.Sifre);
                o.OgrenciListeYuklediMi = false;
                okulrepo.Add(o);

                t.Aciklama = model.Aciklama;
                t.AktifMi  = true;
                t.OkulID   = o.OkulID;
                t.Tarih    = DateTime.Now;
                taleprepo.Add(t);

                jmodel.IsSuccess   = true;
                jmodel.UserMessage = "Talebiniz başarılı bir şekilde bize ulaştı. En kısa zamanda belirttiğiniz iletişim bilgileri üzerinden sizinle irtibata geçilecektir.";
            }
            //}
            //catch
            //{
            //    jmodel.IsSuccess = false;
            //    jmodel.UserMessage = "Talep oluşturulurken bir hata ile karşılaştık. Lütfen daha sonra tekrar deneyiniz.";
            //}
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public ActionResult Ogrenciler()
        {
            int     okulid = Convert.ToInt32(Session["OkulID"]);
            Okullar okul   = okulrepo.Get(okulid);

            ViewBag.Okul = okul;
            List <Ogrenciler> ogrenciliste = ogrencirepo.GetByFilterList(a => a.OkulID == okulid && a.AktifMi == true);
            Donemler          donem        = donemrepo.GetByFilter(a => a.AktifMi == true);

            ViewBag.Donem = donem;
            //var sinifgrup = (from i in ogrencirepo.GetByFilterList(a => a.OkulID == okulid && a.AktifMi==true).ToList()
            //                group i by i.Sinif into g
            //                select new SelectListItem
            //                {
            //                    Text = g.Key.ToString(),
            //                    Value=g.Key.ToString()
            //                }).ToList();
            //ViewBag.Siniflar = sinifgrup;
            return(View(ogrenciliste));
        }
Ejemplo n.º 6
0
        public JsonResult OkulGiris()
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                string kadi     = f.Encrypt(Request.Form["KullaniciAdi"].ToString());
                string sifre    = f.Encrypt(Request.Form["Sifre"].ToString());
                string guvenlik = Request.Form["GuvenlikKodu"].ToString();

                if (Session["GuvenlikKodu"].ToString() == guvenlik)
                {
                    Okullar okul = okulrepo.GetByFilter(a => a.KullaniciAdi == kadi && a.Sifre == sifre);
                    if (okul == null)
                    {
                        jmodel.IsSuccess   = false;
                        jmodel.UserMessage = "Kullanıcı Adınız veya Şifreniz hatalı! Lütfen kontrol ediniz.";
                    }
                    else
                    {
                        Session["OkulID"] = okul.OkulID;
                        jmodel.IsSuccess  = true;
                    }
                }
                else
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = "Güvenlik Kodu yanlış! Lütfen kontrol ediniz.";
                }
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Giriş işlemi sırasında bir hata oluştu. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public JsonResult OgrenciListeYukle(HttpPostedFileBase excelFile)
        {
            JsonResultModel jmodel = new JsonResultModel();

            //try
            //{
            if (excelFile == null || excelFile.ContentLength == 0)
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Lütfen dosya seçimi yapınız.";
            }
            else
            {
                //Dosyanın uzantısı xls ya da xlsx ise;
                if (excelFile.FileName.EndsWith("xls") || excelFile.FileName.EndsWith("xlsx"))
                {
                    string dosyaadi = DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + "-" + Session["OkulID"].ToString() + "-" + excelFile.FileName;
                    //Seçilen dosyanın nereye yükleneceği seçiliyor.
                    string path = string.Concat(Server.MapPath("~/UploadExcel/" + dosyaadi));

                    //Dosya kontrol edilir, varsa silinir.
                    //if (System.IO.File.Exists(path))
                    //{
                    //    System.IO.File.Delete(path);
                    //}

                    //Excel path altına kaydedilir.
                    excelFile.SaveAs(path);

                    FileStream       stream = System.IO.File.Open(path, FileMode.Open, FileAccess.Read);
                    IExcelDataReader excelReader;

                    //Gönderdiğim dosya xls'mi xlsx formatında mı? kontrol ediliyor.
                    if (Path.GetExtension(path).ToUpper() == ".XLS")
                    {
                        //Binary üzerinden excel okuması yapılıyor (Excel 97-2003 *.xls)
                        excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
                    }
                    else
                    {
                        //Openxml üzerinden excel okuması yapılıyor (Excel 2007 *.xlsx)
                        excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                    }

                    Donemler donem = donemrepo.GetByFilter(a => a.AktifMi == true);

                    List <Ogrenciler> localList = new List <Ogrenciler>();
                    int counter = 0;
                    while (excelReader.Read())
                    {
                        counter++;
                        if (counter > 1)
                        {
                            Ogrenciler lm = new Ogrenciler();

                            lm.OgrenciNo   = Convert.ToString(excelReader.GetDouble(0));
                            lm.Adi         = excelReader.GetString(1).ToString();
                            lm.Soyadi      = excelReader.GetString(2).ToString();
                            lm.Sinif       = Convert.ToInt32(excelReader.GetDouble(3).ToString());
                            lm.Sube        = excelReader.GetString(4).ToString();
                            lm.Sube        = lm.Sube.ToUpper();
                            lm.OkulID      = Convert.ToInt32(Session["OkulID"]);
                            lm.KayitTarihi = DateTime.Now;
                            lm.DonemID     = donem.DonemID;
                            lm.AktifMi     = true;
                            localList.Add(lm);
                        }
                    }
                    //Okuma bitiriliyor.
                    excelReader.Close();

                    foreach (var item in localList)
                    {
                        ogrencirepo.Add(item);
                    }

                    Okullar okul = okulrepo.Get(Convert.ToInt32(Session["OkulID"]));
                    okul.OgrenciListeYuklediMi = true;
                    okulrepo.Update(okul);

                    jmodel.IsSuccess   = true;
                    jmodel.UserMessage = "Öğrenci listesi veritabınına başarılı bir şekilde aktarıldı.";
                }
                else
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = "Dosya tipiniz yanlış, lütfen '.xls' yada '.xlsx' uzantılı dosya yükleyiniz.";
                }
            }
            //}
            //catch (Exception e)
            //{
            //    jmodel.IsSuccess = false;
            //    //jmodel.UserMessage = "Yükleme işlemi sırasında bir hata oluştu. Lütfen daha sonra tekrar deneyiniz.";
            //    jmodel.UserMessage = e.ToString();
            //}
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }