public JsonResult YetkiGrupSil(string Key) { SonucModel <YetkiGrupModel> oSonucModel = new SonucModel <YetkiGrupModel>() { Durum = "H", Aciklama = "" }; if (string.IsNullOrEmpty(Key)) { oSonucModel.Aciklama = "Silinecek kayda ulaşılamadı"; } else { string sSQL = "delete from public.\"YETKI_GRUP\""; sSQL += " where \"YetkiGrupKey\" = " + Key; string Sonuc = DBUtilPostger.SorguCalistir(sSQL); if (Sonuc == "0") { oSonucModel.Durum = ""; } else { oSonucModel.Aciklama = Sonuc; } } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public async Task <SonucModel <KategoriSilViewModel> > KategoriSil(KategoriSilViewModel model) { var sonuc = new SonucModel <KategoriSilViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kategori Kaydetme İşlemi Gerçekleştirilmedi." }; Kategori silenecekKategori = new Kategori() { KategoriKey = model.KategoriKey, Ad = model.Ad }; var silmeSonuc = await _kategoriRepository.DeleteAsync(silenecekKategori); if (silmeSonuc > 0) { sonuc.Tip = SonucTip.Basarili; sonuc.HataMesaji = "Silme İşlemi Başarı İle Gerçekleşti"; sonuc.Data = model; return(sonuc); } return(sonuc); }
public async Task <SonucModel <YayineviSilViewModel> > YayineviSil(YayineviSilViewModel model) { var sonuc = new SonucModel <YayineviSilViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Yayınevi Silme İşlemi Gerçekleştirilemedi." }; Yayinevi silenecekYayinevi = new Yayinevi() { YayineviKey = model.YayineviKey, Ad = model.Ad }; var silmeSonuc = await _yayineviRepository.DeleteAsync(silenecekYayinevi); if (silmeSonuc > 0) { sonuc.Tip = SonucTip.Basarili; sonuc.HataMesaji = "Silme İşlemi Başarı İle Gerçekleşti"; sonuc.Data = model; return(sonuc); } return(sonuc); }
public ActionResult Transaction_UrldeSay(FormCollection form_collection) { string anahtar_kelime = form_collection["anahtar_kelime"]; string url = form_collection["url"]; Web_Url_Islemleri web_url_islemleri = new Web_Url_Islemleri(); string html_url_icerigi = web_url_islemleri.HttpIstegiYap(url); string temiz_url_icerigi = web_url_islemleri.HtmlIfadeleriniTemizle(html_url_icerigi); int gecme_sayisi = web_url_islemleri.IcerikteKelimeSay(temiz_url_icerigi, anahtar_kelime); string baslik = web_url_islemleri.BasligiAl(html_url_icerigi); // sahte işlemler:: SonucModel sm1 = new SonucModel() { puan = gecme_sayisi, baslik = baslik, url = url }; TempData["sonuc"] = sm1; return(RedirectToAction("Sonuc")); }
public async Task <SonucModel <KitapKayitSilViewModel> > KitapSil(KitapKayitSilViewModel model) { var sonuc = new SonucModel <KitapKayitSilViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kitap Silme İşlemi Gerçekleştirilemedi." }; Kitap silenecekYayinevi = new Kitap() { KitapKey = model.KitapKey, Ad = model.Ad }; var silmeSonuc = await _kitapRepository.DeleteAsync(silenecekYayinevi); if (silmeSonuc > 0) { sonuc.Tip = SonucTip.Basarili; sonuc.HataMesaji = "Silme İşlemi Başarı İle Gerçekleşti"; sonuc.Data = model; return(sonuc); } return(sonuc); }
public JsonResult KullaniciSil(string Key) { SonucModel <KullaniciModel> oSonucModel = new SonucModel <KullaniciModel>() { Durum = "H", Aciklama = "" }; if (string.IsNullOrEmpty(Key)) { oSonucModel.Aciklama = "Silinecek kayda ulaşılamadı"; } else if (Key == "1") { oSonucModel.Aciklama = "Sistem yöneticisi silinemez"; } { string sSQL = "delete from public.\"KULLANICI\""; sSQL += " where \"KullaniciKey\" = " + Key; string Sonuc = DBUtilPostger.SorguCalistir(sSQL); if (Sonuc == "0") { oSonucModel.Durum = ""; } else { oSonucModel.Aciklama = Sonuc; } } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public JsonResult YetkiGrupKayit(YetkiGrupModel oYetkiGrupModel) { SonucModel <YetkiGrupModel> oSonucModel = new SonucModel <YetkiGrupModel>() { Durum = "H", Aciklama = "" }; int YetkiGrupKey = oYetkiGrupModel.YetkiGrupKey; string YetkiGrupAd = oYetkiGrupModel.YetkiGrupAd; if (string.IsNullOrEmpty(YetkiGrupAd)) { oSonucModel.Aciklama = "Yetki grup adı boş olamaz"; } else { if (YetkiGrupKey == 0) { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "insert into public.\"YETKI_GRUP\" " + " (\"YetkiGrupAd\", \"UKullaniciKey\", \"UTar\") " + "values ('" + YetkiGrupAd + "'," + ArgemSession.OpKullaniciKey + ", current_timestamp) " + "returning \"YetkiGrupKey\" "; using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { string SonucYetkiGrupKey = Convert.ToString(oData.SorguCalistir(oSQL)); if (SonucYetkiGrupKey != "0") { oSonucModel.Durum = ""; } else { oSonucModel.Aciklama = "Veri kaydedilemedi"; } } } else { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "update public.\"YETKI_GRUP\" " + "set \"YetkiGrupAd\" = '" + YetkiGrupAd + "', " + " \"UKullaniciKey\" = " + ArgemSession.OpKullaniciKey + ", " + " \"UTar\" = current_timestamp "; oSQL.Esit("YetkiGrupKey", YetkiGrupKey, KolonTipi.Int, true); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { oData.SorguCalistir(oSQL); oSonucModel.Durum = ""; } } } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public JsonResult KullaniciGetirDDLText(string AramaKriter) { // System.Threading.Thread.Sleep(2000); SonucModel <DDlTextModel> oSonucModel = new SonucModel <DDlTextModel>() { Durum = "H", Aciklama = "" }; ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "SELECT * FROM public.\"KULLANICI\""; if (!string.IsNullOrEmpty(AramaKriter)) { oSQL.Gecen("Ad", AramaKriter); oSQL.OR(); oSQL.Gecen("Soyad", AramaKriter); oSQL.OrderByAsc("Ad,Soyad"); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { List <DDlTextModel> aryDDlTextModel = new List <DDlTextModel>(); foreach (DataRow dr in dt.Rows) { DDlTextModel oDDlTextModel = new DDlTextModel() { Key = Convert.ToInt32(dr["KullaniciKey"]), Text = dr["Ad"].ToString() + " " + dr["Soyad"].ToString() }; aryDDlTextModel.Add(oDDlTextModel); } oSonucModel.Durum = ""; oSonucModel.Data = aryDDlTextModel; } else { oSonucModel.Aciklama = "Aradığınız kritere uygun kullanıcı kaydı bulunamadı"; } } } else { oSonucModel.Aciklama = "Kritere uygun kayıt bulunamadı"; } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public JsonResult KullaniciYetkiGrupAraSonuc(KullaniciYetkiGrupModel oKullaniciYetkiGrupModel) { SonucModel <KullaniciYetkiGrupAraModel> oSonucModel = new SonucModel <KullaniciYetkiGrupAraModel>() { Durum = "H", Aciklama = "" }; ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "SELECT * FROM public.\"KULLANICI_YETKI_GRUP\""; if (oKullaniciYetkiGrupModel.KullaniciKey > 0) { oSQL.Esit("KullaniciKey", oKullaniciYetkiGrupModel.KullaniciKey, KolonTipi.Int, true); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { List <KullaniciYetkiGrupAraModel> arySonuc = new List <KullaniciYetkiGrupAraModel>(); foreach (DataRow dr in dt.Rows) { KullaniciYetkiGrupAraModel oKullaniciYetkiGrupAraModel = new KullaniciYetkiGrupAraModel() { KullaniciYetkiGrupKey = Convert.ToInt32(dr["YetkiGrupKey"]), // KullaniciKey = Convert.ToInt32(dr["YetkiGrupKey"]), // gerek yok sayfada zaten kullanıcı bazında getiriliyor YetkiGrupKey = Convert.ToInt32(dr["YetkiGrupKey"]), YetkiGrupAd = "Sonra koy", TeskilatKey = Convert.ToInt32(dr["YetkiGrupKey"]), TeskilatUzunAd = "ARGEM sonra konulacak" }; arySonuc.Add(oKullaniciYetkiGrupAraModel); } oSonucModel.Durum = ""; oSonucModel.Data = arySonuc; } else { oSonucModel.Aciklama = "Aradığınız kritere uygun kayıt bulunamadı"; } } } else { oSonucModel.Aciklama = "Kullanıcı bilgisi bulunamadı"; } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public async Task <SonucModel <YazarKayitViewModel> > YazarKaydetGuncelle(YazarKayitViewModel model) { var sonuc = new SonucModel <YazarKayitViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kategori Kaydetme İşlemi Gerçekleştirilmedi." }; if (model.YazarKey > 0) { var guncellenecekYazar = await _yazarRepository.GetByIdAsync(model.YazarKey); guncellenecekYazar.Ad = model.Ad; guncellenecekYazar.YazarHakkinda = model.Hakkinda; var guncellemeSonuc = await _yazarRepository.UpdateAsync(guncellenecekYazar); if (guncellemeSonuc > 0) { sonuc.HataMesaji = $"Yazar Bilgileri Güncellenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = model; return(sonuc); } } else { Yazar yazar = new Yazar() { Ad = model.Ad, YazarHakkinda = model.Hakkinda }; var eklemeSonuc = await _yazarRepository.InsertAsync(yazar); var eklenenYazar = await _yazarRepository.FindAsync(x => x.Ad == model.Ad); if (eklemeSonuc > 0) { sonuc.HataMesaji = $"{model.Ad} Yazar Olarak Eklenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new YazarKayitViewModel() { YazarKey = eklenenYazar.YazarKey, Ad = eklenenYazar.Ad, Hakkinda = eklenenYazar.YazarHakkinda }; return(sonuc); } } return(sonuc); }
public JsonResult YetkiGrupAraSonuc(YetkiGrupModel oYetkiGrupModel) { SonucModel <YetkiGrupModel> oSonucModel = new SonucModel <YetkiGrupModel>() { Durum = "H", Aciklama = "" }; ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "SELECT * FROM public.\"YETKI_GRUP\""; if (oYetkiGrupModel.YetkiGrupKey != 0) { oSQL.Esit("YetkiGrupKey", oYetkiGrupModel.YetkiGrupKey, KolonTipi.Int, true); } else if (!string.IsNullOrEmpty(oYetkiGrupModel.YetkiGrupAd)) { oSQL.Gecen("YetkiGrupAd", oYetkiGrupModel.YetkiGrupAd); } oSQL.OrderByAsc("YetkiGrupAd"); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { List <YetkiGrupModel> aryYetkiGrupModel = new List <YetkiGrupModel>(); foreach (DataRow dr in dt.Rows) { oYetkiGrupModel = new YetkiGrupModel() { YetkiGrupKey = Convert.ToInt32(dr["YetkiGrupKey"]), YetkiGrupAd = dr["YetkiGrupAd"].ToString(), S = 0 }; aryYetkiGrupModel.Add(oYetkiGrupModel); } oSonucModel.Durum = ""; oSonucModel.Data = aryYetkiGrupModel; } else { oSonucModel.Aciklama = "Aradığınız kritere uygun kayıt bulunamadı"; } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); } }
public async Task <SonucModel <YayineviKayitViewModel> > YayineviKaydetGuncelle(YayineviKayitViewModel model) { var sonuc = new SonucModel <YayineviKayitViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Yayinevi Kaydetme İşlemi Gerçekleştirilmedi." }; if (model.YayineviKey > 0) { var guncellenecekYayinevi = await _yayineviRepository.GetByIdAsync(model.YayineviKey); string eskiAd = guncellenecekYayinevi.Ad; guncellenecekYayinevi.Ad = model.Ad; var guncellemeSonuc = await _yayineviRepository.UpdateAsync(guncellenecekYayinevi); if (guncellemeSonuc > 0) { sonuc.HataMesaji = $"{eskiAd} Yayinevi, {model.Ad} Olarak Güncellenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = model; return(sonuc); } } else { Yayinevi kategori = new Yayinevi() { Ad = model.Ad }; var eklemeSonuc = await _yayineviRepository.InsertAsync(kategori); var eklenenYayinevi = await _yayineviRepository.FindAsync(x => x.Ad == model.Ad); if (eklemeSonuc > 0) { sonuc.HataMesaji = $"{model.Ad} Kategori Olarak Eklenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new YayineviKayitViewModel() { YayineviKey = eklenenYayinevi.YayineviKey, Ad = eklenenYayinevi.Ad }; return(sonuc); } } return(sonuc); }
public ActionResult KullaniciOku(string Durum, string Key) { SonucModel <KullaniciAraModel> oSonucModel = new SonucModel <KullaniciAraModel>() { Durum = "H", Aciklama = "" }; if (string.IsNullOrEmpty(Durum) && string.IsNullOrEmpty(Key)) { oSonucModel.Aciklama = "Hatalı parametre"; return(PartialView(oSonucModel)); } else { string sSQL = "SELECT * FROM public.\"KULLANICI\""; sSQL += " where \"KullaniciKey\" = " + Key; DataSet ds = DBUtilPostger.VeriGetirDS(sSQL); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; int KullaniciTipNo = Convert.ToInt32(dr["KullaniciTipNo"]); int AktifPasifTipNo = Convert.ToInt32(dr["AktifPasifTipNo"]); KullaniciAraModel oKullaniciAraModel = new KullaniciAraModel() { KullaniciKey = Convert.ToInt32(dr["KullaniciKey"]), KullaniciAd = dr["KullaniciAd"].ToString(), Ad = dr["Ad"].ToString(), Soyad = dr["Soyad"].ToString(), KullaniciTipNo = KullaniciTipNo, KullaniciTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, KullaniciTipNo), AktifPasifTipNo = AktifPasifTipNo, AktifPasifTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, AktifPasifTipNo) }; List <KullaniciAraModel> aryKullaniciAraModel = new List <KullaniciAraModel>(); aryKullaniciAraModel.Add(oKullaniciAraModel); oSonucModel.Durum = Durum; oSonucModel.Data = aryKullaniciAraModel; } else { oSonucModel.Aciklama = "Kayıt bulunamadı"; } } return(PartialView(oSonucModel)); }
public PartialViewResult YetkiGrupOku(string Durum, string Key) { SonucModel <YetkiGrupModel> oSonucModel = new SonucModel <YetkiGrupModel>() { Durum = "H", Aciklama = "" }; if (string.IsNullOrEmpty(Durum) && string.IsNullOrEmpty(Key)) { oSonucModel.Aciklama = "Hatalı parametre"; return(PartialView(oSonucModel)); } else { string sSQL = "SELECT * FROM public.\"YETKI_GRUP\""; sSQL += " where \"YetkiGrupKey\" = " + Key; DataSet ds = DBUtilPostger.VeriGetirDS(sSQL); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; YetkiGrupModel oYetkiGrupModel = new YetkiGrupModel() { YetkiGrupKey = Convert.ToInt32(dr["YetkiGrupKey"]), YetkiGrupAd = dr["YetkiGrupAd"].ToString() }; List <YetkiGrupModel> aryYetkiGrupModel = new List <YetkiGrupModel>(); aryYetkiGrupModel.Add(oYetkiGrupModel); oSonucModel.Durum = Durum; oSonucModel.Data = aryYetkiGrupModel; } else { oSonucModel.Aciklama = "Kayıt bulunamadı"; } } return(PartialView(oSonucModel)); }
public async Task <SonucModel <KitapKayitViewModel> > KitapGetir(KitapKayitGuncelleViewModel model) { var sonuc = new SonucModel <KitapKayitViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kitap Guncelleme İşlemi Gerçekleştirilmedi." }; var kitap = _kitapRepository.SelectIncludeMany(y => y.Yazar, x => x.Yayinevi).Where(k => k.KitapKey == model.KitapKey).FirstOrDefault(); if (kitap != null) { sonuc.Tip = SonucTip.Basarili; sonuc.HataMesaji = "Güncellenecek Kitap Bulundu"; sonuc.Data = new KitapKayitViewModel { Ad = kitap.Ad, Isbn = kitap.Isbn, KitapDurumKey = kitap.KitapDurumKey, KitapHakkindaOzet = kitap.KitapHakkindaOzet, KitapKey = kitap.KitapKey, SayfaSayisi = Convert.ToString(kitap.SayfaSayisi), Yayinevi = new YayineviViewModel { Ad = kitap.Yayinevi.Ad, YayineviKey = kitap.Yayinevi.YayineviKey }, Yazar = new YazarViewModel { Ad = kitap.Yazar.Ad, Hakkinda = kitap.Yazar.YazarHakkinda, YazarKey = kitap.Yazar.YazarKey } }; return(sonuc); } return(sonuc); }
public async Task <SonucModel <UyeKayitSilViewModel> > UyeSil(UyeKayitSilViewModel model) { var sonuc = new SonucModel <UyeKayitSilViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kategori Kaydetme İşlemi Gerçekleştirilmedi." }; Uye silenecekUye = new Uye() { UyeKey = model.UyeKey }; var silmeSonuc = await _uyeRepository.DeleteAsync(silenecekUye); if (silmeSonuc > 0) { sonuc.Tip = SonucTip.Basarili; sonuc.HataMesaji = "Silme İşlemi Başarı İle Gerçekleşti"; sonuc.Data = model; return(sonuc); } return(sonuc); }
public async Task <SonucModel <IadeAlSonucViewModel> > IadeAl(IadeAlViewModel model) { var oduncKey = model.OduncKey; var sonuc = new SonucModel <IadeAlSonucViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Iade Alma İşlemi Gerçekleşemedi" }; var oduncAlinmisKitap = _kitapOduncRepository.SelectInclude(k => k.Kitap.Yazar).Where(o => o.KitapOduncKey == oduncKey).FirstOrDefault(); if (oduncAlinmisKitap == null) { sonuc.HataMesaji = "Ödünç Alınmış Kitap Bulunamadı"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } var uye = await _uyeRepository.FindAsync(u => u.UyeKey == oduncAlinmisKitap.UyeKey); if (uye == null) { sonuc.HataMesaji = "Uye Bulunamadı"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } var kitap = await _kitapRepository.FindAsync(k => k.KitapKey == oduncAlinmisKitap.KitapKey); if (kitap == null) { sonuc.HataMesaji = "Kitap Bulunamadı"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } oduncAlinmisKitap.KitapOduncDurum = (int)KitapDurum.Kutuphanede; oduncAlinmisKitap.GetirisTarihi = DateTime.Now; var guncellemeSonuc = await _kitapOduncRepository.UpdateAsync(oduncAlinmisKitap); if (guncellemeSonuc > 0) { kitap.KitapDurumKey = (int)KitapDurum.Kutuphanede; var kitapDurumGuncelle = await _kitapRepository.UpdateAsync(kitap); if (kitapDurumGuncelle > 0) { sonuc.HataMesaji = $"{kitap.Ad} kitabı {uye.Ad} {uye.Soyad}'den iade alınmıştır."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new IadeAlSonucViewModel() { DemirbasNo = oduncAlinmisKitap.Kitap.DemirbasNo, KitapAd = oduncAlinmisKitap.Kitap.Ad, KitapOduncKey = oduncAlinmisKitap.KitapOduncKey, Yazar = oduncAlinmisKitap.Kitap.Yazar.Ad }; return(sonuc); } } return(sonuc); }
public async Task <SonucModel <UyeKayitViewModel> > UyeKaydetGuncelle(UyeKayitViewModel model) { var sonuc = new SonucModel <UyeKayitViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Üyelik Kaydetme İşlemi Gerçekleştirilmedi." }; if (model.UyeKey > 0) { var guncellenecekUye = await _uyeRepository.GetByIdAsync(model.UyeKey); guncellenecekUye.Ad = model.Ad; guncellenecekUye.Soyad = model.Soyad; guncellenecekUye.Email = model.Email; guncellenecekUye.KimlikNo = model.KimlikNo; guncellenecekUye.Telefon = model.Telefon; var guncellemeSonuc = await _uyeRepository.UpdateAsync(guncellenecekUye); if (guncellemeSonuc > 0) { sonuc.HataMesaji = $"Üyelik Bilgileri Güncellenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = model; return(sonuc); } } else { Uye kategori = new Uye() { Ad = model.Ad, Soyad = model.Soyad, Email = model.Email, KimlikNo = model.KimlikNo, Telefon = model.Telefon }; var eklemeSonuc = await _uyeRepository.InsertAsync(kategori); var eklenenUye = await _uyeRepository.FindAsync(x => x.Ad == model.Ad); if (eklemeSonuc > 0) { sonuc.HataMesaji = $"{model.Ad} Kategori Olarak Eklenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new UyeKayitViewModel() { UyeKey = eklenenUye.UyeKey, Ad = eklenenUye.Ad, Soyad = eklenenUye.Soyad, Email = eklenenUye.Email, KimlikNo = eklenenUye.KimlikNo, Telefon = eklenenUye.Telefon }; return(sonuc); } } return(sonuc); }
public async Task <SonucModel <OduncSonucViewModel> > OduncVer(OduncVerViewModel model) { var sonuc = new SonucModel <OduncSonucViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Ödünç Verme İşlemi Başarısız" }; var uye = await _uyeRepository.FindAsync(u => u.UyeKey == model.UyeKey); if (uye == null) { sonuc.HataMesaji = "Üye Bulunamadı"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } var kitap = await _kitapRepository.FindAsync(k => k.DemirbasNo == model.DemirbasNo); if (kitap == null) { sonuc.HataMesaji = "Kitap Bulunamadı"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } if (kitap.KitapDurumKey == (int)KitapDurum.Okuyucuda) { sonuc.HataMesaji = "Ödünç Verilmek İstenen Kitap Okuyucuda Bulunmaktadır"; sonuc.Tip = SonucTip.Basarisiz; return(sonuc); } KitapOdunc odunc = new KitapOdunc() { KitapKey = kitap.KitapKey, UyeKey = uye.UyeKey, KitapOduncDurum = (int)KitapDurum.Okuyucuda, AlisTarihi = DateTime.Now }; var kayitSonuc = await _kitapOduncRepository.InsertAsync(odunc); if (kayitSonuc > 0) { var oduncVerilen = _kitapOduncRepository.SelectIncludeMany(k => k.Kitap.Yazar).Where(o => o.KitapKey == kitap.KitapKey).FirstOrDefault(); kitap.KitapDurumKey = (int)KitapDurum.Okuyucuda; var guncellemeSonuc = await _kitapRepository.UpdateAsync(kitap); if (guncellemeSonuc > 0) { sonuc.HataMesaji = $"{kitap.Ad} kitabı {uye.Ad} {uye.Soyad}'e ödünç verilmiştir"; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new OduncSonucViewModel() { DemirbasNo = oduncVerilen.Kitap.DemirbasNo, KitapAd = oduncVerilen.Kitap.Ad, OduncKey = oduncVerilen.KitapOduncKey, Yazar = oduncVerilen.Kitap.Yazar.Ad, }; return(sonuc); } } return(sonuc); }
public ActionResult Transaction_SemantikAnaliz(FormCollection form_collection) { // form'la gelen veriler alınıyor: string anahtar_kelime = form_collection["anahtar_kelime"]; string url = form_collection["url"]; // verilerin içinden boşluk karakterleri siliniyor: anahtar_kelime = anahtar_kelime.Replace(" ", ""); url = url.Replace(" ", ""); // gelen veriler çoklu olduğundan/virgülle ayrıldığından tek tek elde ediliyor string[] anahtar_kelimeler = anahtar_kelime.Split(','); string[] urller = url.Split(','); // her bir anahtar kelime: Kelime=esAnlamliKelime // şeklinde olduğundan önce bunlar ayrılıyor: string[] esAnlamli_kelimeler = new string[anahtar_kelimeler.Length]; for (int i = 0; i < anahtar_kelimeler.Length; i++) { esAnlamli_kelimeler[i] = anahtar_kelimeler[i].Split('=')[1]; anahtar_kelimeler[i] = anahtar_kelimeler[i].Split('=')[0]; } List <SonucModel> liste = new List <SonucModel>(); // işlemler... for (int i = 0; i < urller.Length; i++) { string _url = urller[i]; Web_Url_Islemleri web_url_islemleri = new Web_Url_Islemleri(); string icerik = web_url_islemleri.TemizWebSayfasiIcerigiAl(_url); SonucModel sonuc = new SonucModel(); sonuc.url = _url; sonuc.baslik = web_url_islemleri.BasligiAl(icerik); for (int j = 0; j < anahtar_kelimeler.Length; j++) { string _anahtar_kelime = anahtar_kelimeler[j]; string _esAnlamli_anahtar_kelime = esAnlamli_kelimeler[j]; // hem anahtar kelimenin geçme sayısı bulunuyor hem de eş anlamlı kelimenin geçme sayısı ölçülüyor int anahtarKelime_gecme_sayisi = web_url_islemleri.IcerikteKelimeSay(icerik, _anahtar_kelime); int esAnlamli_anahtarKelime_gecme_sayisi = web_url_islemleri.IcerikteKelimeSay(icerik, _esAnlamli_anahtar_kelime); Anahtar_Kelime keyword = new Anahtar_Kelime(); keyword.isim = _anahtar_kelime; keyword.esAnlamli_isim = _esAnlamli_anahtar_kelime; // artık bir kelimenin geçme sayısı yerine hem kendisinin hem de eş anlamlı kelimenin geçme sayıları toplanıyor: keyword.sayi = anahtarKelime_gecme_sayisi + esAnlamli_anahtarKelime_gecme_sayisi; sonuc.anahtar_kelimeler.Add(keyword); } // elde edilen her sayfa için oluşturulan sonuc nesnesi listeye ekleniyor: liste.Add(sonuc); } // puanlama işlemi: // formülasyon // her sayfa için verilen anahtar kelimelerin(ve eş anlamlı kelimelerin) bulunma sayıları toplanıp, // elde edilen sayı puan oluyor for (int i = 0; i < liste.Count; i++) { SonucModel sonuc = liste.ElementAt(i); for (int j = 0; j < sonuc.anahtar_kelimeler.Count; j++) { sonuc.puan += sonuc.anahtar_kelimeler.ElementAt(j).sayi; } } TempData["liste"] = liste; return(RedirectToAction("Sonuc")); }
public ActionResult Transaction_SiteSiralama(FormCollection form_collection) { // form'la gelen veriler alınıyor: string anahtar_kelime = form_collection["anahtar_kelime"]; string url = form_collection["url"]; // verilerin içinden boşluk karakterleri siliniyor: anahtar_kelime = anahtar_kelime.Replace(" ", ""); url = url.Replace(" ", ""); // gelen veriler çoklu olduğundan/virgülle ayrıldığından tek tek elde ediliyor string[] anahtar_kelimeler = anahtar_kelime.Split(','); string[] urller = url.Split(','); List <SonucModel> liste = new List <SonucModel>(); // işlemler... for (int i = 0; i < urller.Length; i++) { string _url = urller[i]; Web_Url_Islemleri web_url_islemleri = new Web_Url_Islemleri(); string icerik = web_url_islemleri.TemizWebSayfasiIcerigiAl(_url); SonucModel sonuc = new SonucModel(); sonuc.url = _url; sonuc.baslik = web_url_islemleri.BasligiAl(icerik); for (int j = 0; j < anahtar_kelimeler.Length; j++) { string _anahtar_kelime = anahtar_kelimeler[j]; int gecme_sayisi = web_url_islemleri.IcerikteKelimeSay(icerik, _anahtar_kelime); Anahtar_Kelime keyword = new Anahtar_Kelime(); keyword.isim = _anahtar_kelime; keyword.sayi = gecme_sayisi; sonuc.anahtar_kelimeler.Add(keyword); } // elde edilen her sayfa için oluşturulan sonuc nesnesi listeye ekleniyor: liste.Add(sonuc); } // puanlama işlemi: // formülasyon // her sayfa için verilen anahtar kelimelerin bulunma sayıları toplanıp, // elde edilen sayı puan oluyor for (int i = 0; i < liste.Count; i++) { SonucModel sonuc = liste.ElementAt(i); for (int j = 0; j < sonuc.anahtar_kelimeler.Count; j++) { sonuc.puan += sonuc.anahtar_kelimeler.ElementAt(j).sayi; } } TempData["liste"] = liste; return(RedirectToAction("Sonuc")); }
public async Task <SonucModel <KitapKayitViewModel> > KitapKaydetGuncelle(KitapKayitViewModel model) { var sonuc = new SonucModel <KitapKayitViewModel> { Tip = SonucTip.Belirsiz, HataMesaji = "Kitap Kaydetme İşlemi Gerçekleştirilmedi." }; var yazar = await _yazarRepository.FindAsync(x => x.Ad == model.Yazar.Ad); var yayinevi = await _yayineviRepository.FindAsync(x => x.Ad == model.Yayinevi.Ad); // Eğer autocomplete'te olmayan bir yazar veya yayinevi girildiyse ekle. if (yazar == null) { yazar = new Yazar { Ad = model.Yazar.Ad }; await _yazarRepository.InsertAsync(yazar); yazar = await _yazarRepository.FindAsync(x => x.Ad == model.Yazar.Ad); } if (yayinevi == null) { yayinevi = new Yayinevi { Ad = model.Yayinevi.Ad }; await _yayineviRepository.InsertAsync(yayinevi); yayinevi = await _yayineviRepository.FindAsync(x => x.Ad == model.Yayinevi.Ad); } if (model.KitapKey > 0) { var guncellenecekKitap = await _kitapRepository.GetByIdAsync(model.KitapKey); guncellenecekKitap.Ad = model.Ad; guncellenecekKitap.Isbn = model.Isbn; guncellenecekKitap.YazarKey = yazar.YazarKey; guncellenecekKitap.YayineviKey = yayinevi.YayineviKey; guncellenecekKitap.KitapHakkindaOzet = model.KitapHakkindaOzet; guncellenecekKitap.SayfaSayisi = Convert.ToInt32(model.SayfaSayisi); var guncellemeSonuc = await _kitapRepository.UpdateAsync(guncellenecekKitap); if (guncellemeSonuc > 0) { sonuc.HataMesaji = $"Kitap Bilgileri Güncellenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = model; return(sonuc); } } else { Kitap kitap = new Kitap() { Ad = model.Ad, KitapDurumKey = (int)KitapDurum.Kutuphanede, Isbn = model.Isbn, KitapHakkindaOzet = model.KitapHakkindaOzet, SayfaSayisi = Convert.ToInt32(model.SayfaSayisi), YazarKey = yazar.YazarKey, YayineviKey = yayinevi.YayineviKey, }; var eklemeSonuc = await _kitapRepository.InsertAsync(kitap); var eklenenKitap = await _kitapRepository.FindAsync(x => x.Ad == model.Ad); if (eklemeSonuc > 0) { eklenenKitap.DemirbasNo = DemirbasNoUret(eklenenKitap.KitapKey); var eklenenKitabiGuncelle = await _kitapRepository.UpdateAsync(eklenenKitap); if (eklenenKitabiGuncelle > 0) { sonuc.HataMesaji = $"{model.Ad} Kitap Olarak Eklenmiştir."; sonuc.Tip = SonucTip.Basarili; sonuc.Data = new KitapKayitViewModel() { KitapKey = eklenenKitap.KitapKey, Ad = eklenenKitap.Ad, Isbn = eklenenKitap.Isbn, SayfaSayisi = Convert.ToString(eklenenKitap.SayfaSayisi), KitapHakkindaOzet = eklenenKitap.KitapHakkindaOzet, KitapDurumKey = eklenenKitap.KitapDurumKey }; } return(sonuc); } } return(sonuc); }
public JsonResult KullaniciGetir(string KullaniciKey) { // System.Threading.Thread.Sleep(2000); SonucModel <KullaniciModel> oSonucModel = new SonucModel <KullaniciModel>() { Durum = "H", Aciklama = "" }; if (KullaniciKey == "" || KullaniciKey == "0") { List <KullaniciModel> aryKullaniciModel = new List <KullaniciModel>(); // ilk kayıtta default verilerin dolu gelmesi için KullaniciModel oKullaniciModel = new KullaniciModel() { KullaniciKey = 0, KullaniciTipNo = 1, AktifPasifTipNo = 100 }; aryKullaniciModel.Add(oKullaniciModel); oSonucModel.Durum = ""; oSonucModel.Data = aryKullaniciModel; return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); } else { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "SELECT * FROM public.\"KULLANICI\""; oSQL.Esit("KullaniciKey", KullaniciKey, KolonTipi.Int, true); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { List <KullaniciModel> aryKullaniciModel = new List <KullaniciModel>(); foreach (DataRow dr in dt.Rows) { int KullaniciTipNo = Convert.ToInt32(dr["KullaniciTipNo"]); int AktifPasifTipNo = Convert.ToInt32(dr["AktifPasifTipNo"]); KullaniciModel oKullaniciModel = new KullaniciModel() { KullaniciKey = Convert.ToInt32(dr["KullaniciKey"]), KullaniciAd = dr["KullaniciAd"].ToString(), Ad = dr["Ad"].ToString(), Soyad = dr["Soyad"].ToString(), KullaniciTipNo = KullaniciTipNo, // KullaniciTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, KullaniciTipNo), AktifPasifTipNo = AktifPasifTipNo, // AktifPasifTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, AktifPasifTipNo) }; aryKullaniciModel.Add(oKullaniciModel); } oSonucModel.Durum = ""; oSonucModel.Data = aryKullaniciModel; } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); } } }
public JsonResult SistemeGirisYap(KullaniciLoginModel oKullaniciLoginModel) { SonucModel <KullaniciLoginModel> oSonucModel = new SonucModel <KullaniciLoginModel>() { Durum = "H", Aciklama = "" }; if (ModelState.IsValid) { if (string.IsNullOrEmpty(oKullaniciLoginModel.KullaniciAd) || string.IsNullOrEmpty(oKullaniciLoginModel.Parola)) { oSonucModel.Aciklama = "Kullanıcı adı ve/veya şifre boş"; } else { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "select * " + "from public.\"KULLANICI\" "; oSQL.Esit("KullaniciAd", oKullaniciLoginModel.KullaniciAd, KolonTipi.String); oSQL.Esit("Parola", oKullaniciLoginModel.Parola, KolonTipi.String); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { // todo log kaydı yap if (dt.Rows[0]["AktifPasifTipNo"].ToString() == "100") { ArgemSession.OpKullaniciKey = Convert.ToInt32(dt.Rows[0]["KullaniciKey"]); ArgemSession.OpKullaniciAd = dt.Rows[0]["Ad"].ToString(); ArgemSession.OpKullaniciSoyad = dt.Rows[0]["Soyad"].ToString(); oSonucModel.Durum = ""; } else { oSonucModel.Aciklama = "Kullanıcı pasif durumda"; } } else { oSonucModel.Aciklama = "Kullanıcı adı ve/veya şifre hatalı"; } } /*string sSQL = * "select * " + * "from public.\"KULLANICI\" " + * "where \"KullaniciAd\" = '" + oKullaniciLoginModel.KullaniciAd + "' " + * " and \"Parola\" = '" + oKullaniciLoginModel.Parola + "'"; * DataTable dtP = DBUtil.VeriGetirDT(sSQL); * if (dtP != null) * { * if (dtP.Rows.Count > 0) * { * if (dtP.Rows[0]["AktifPasifTipNo"].ToString() == "100") * { * Session["OpKullaniciKey"] = dtP.Rows[0]["KullaniciKey"].ToString(); * Session["OpKullaniciAd"] = dtP.Rows[0]["Ad"].ToString(); * Session["OpKullaniciSoyad"] = dtP.Rows[0]["Soyad"].ToString(); * oSonucModel.Durum = ""; * } * else * oSonucModel.Aciklama = "Kullanıcı pasif durumda"; * } * else * oSonucModel.Aciklama = "Kullanıcı adı ve/veya şifre hatalı"; * } * else * oSonucModel.Aciklama = "Kullanıcı adı ve/veya şifre hatalı.";*/ } } else { oSonucModel.Aciklama = "Gerekli alanları giriniz"; } return(Json(oSonucModel, JsonRequestBehavior.DenyGet)); }
public JsonResult KullaniciKayit(KullaniciModel oKullaniciModel) { SonucModel <KullaniciModel> oSonucModel = new SonucModel <KullaniciModel>() { Durum = "H", Aciklama = "" }; int KullaniciKey = oKullaniciModel.KullaniciKey; string KullaniciAd = oKullaniciModel.KullaniciAd; string Ad = oKullaniciModel.Ad; string Soyad = oKullaniciModel.Soyad; int KullaniciTipNo = oKullaniciModel.KullaniciTipNo; int AktifPasifTipNo = oKullaniciModel.AktifPasifTipNo; if (string.IsNullOrEmpty(KullaniciAd)) { oSonucModel.Aciklama = "Kullanıcı adı boş olamaz"; } else if (string.IsNullOrEmpty(Ad)) { oSonucModel.Aciklama = "Ad boş olamaz"; } else if (string.IsNullOrEmpty(Soyad)) { oSonucModel.Aciklama = "Soyad boş olamaz"; } else if (KullaniciTipNo == 0) { oSonucModel.Aciklama = "Tip boş olamaz"; } else if (AktifPasifTipNo == 0) { oSonucModel.Aciklama = "Durumu boş olamaz"; } else { if (KullaniciKey == 0) { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "insert into public.\"KULLANICI\" " + " (\"KullaniciAd\", \"Ad\", \"Soyad\", \"KullaniciTipNo\", \"AktifPasifTipNo\", \"Parola\", \"UKullaniciKey\", \"UTar\") " + "values ('" + KullaniciAd + "','" + Ad + "','" + Soyad + "', " + KullaniciTipNo + ", " + AktifPasifTipNo + ", '123', 1, current_timestamp) " + "returning \"KullaniciKey\" "; using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { string SonucKullaniciKey = Convert.ToString(oData.SorguCalistir(oSQL)); if (SonucKullaniciKey != "0") { oSonucModel.Durum = ""; } else { oSonucModel.Aciklama = "Veri kaydedilemedi"; } } } else { ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "update public.\"KULLANICI\" " + "set \"KullaniciAd\" = '" + KullaniciAd + "', " + " \"Ad\" = '" + Ad + "', " + " \"Soyad\"='" + Soyad + "', " + " \"KullaniciTipNo\"=" + KullaniciTipNo + ", " + " \"AktifPasifTipNo\"=" + AktifPasifTipNo + ", " + " \"UKullaniciKey\" = " + ArgemSession.OpKullaniciKey + ", " + " \"UTar\" = current_timestamp "; oSQL.Esit("KullaniciKey", KullaniciKey, KolonTipi.Int, true); using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { oData.SorguCalistir(oSQL); oSonucModel.Durum = ""; } } } return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); }
public JsonResult KullaniciAraSonuc(int SayfaKayitAdet, int AktifSayfaNo, int SiraTip, string SiraAlan, KullaniciModel oKullaniciModel) { // System.Threading.Thread.Sleep(2000); SonucModel <KullaniciAraModel> oSonucModel = new SonucModel <KullaniciAraModel>() { Durum = "H", Aciklama = "" }; int ToplamKayitAdet = 0; ArgemSQL oSQL = new ArgemSQL(); oSQL.CommandText = "select *, count(*) OVER() as \"Adet\" " + "from public.\"KULLANICI\""; // string s = "ddsdf"; // int i = Convert.ToInt32(s); if (!string.IsNullOrEmpty(oKullaniciModel.KullaniciAd)) { oSQL.Gecen("KullaniciAd", oKullaniciModel.KullaniciAd); } else if (!string.IsNullOrEmpty(oKullaniciModel.Ad)) { oSQL.Gecen("Ad", oKullaniciModel.Ad); } else if (!string.IsNullOrEmpty(oKullaniciModel.Soyad)) { oSQL.Gecen("Soyad", oKullaniciModel.Soyad); } oSQL.Esit("KullaniciTipNo", oKullaniciModel.KullaniciTipNo, KolonTipi.Int, false); oSQL.Esit("AktifPasifTipNo", oKullaniciModel.AktifPasifTipNo, KolonTipi.Int, false); if (SiraAlan == "") { oSQL.OrderByAsc("Ad,Soyad"); } else if (SiraTip == 1) { oSQL.OrderByAsc(SiraAlan); } else { oSQL.OrderByDesc(SiraAlan); } if (SayfaKayitAdet != 0 && AktifSayfaNo != 0) { oSQL.KayitSayisiLimit(SayfaKayitAdet, AktifSayfaNo); } using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki)) { DataTable dt = new DataTable(); oData.DataGetir(ref dt, oSQL); if (dt.Rows.Count > 0) { ToplamKayitAdet = Convert.ToInt32(dt.Rows[0]["Adet"].ToString()); List <KullaniciAraModel> aryKullaniciAraModel = new List <KullaniciAraModel>(); foreach (DataRow dr in dt.Rows) { int KullaniciTipNo = Convert.ToInt32(dr["KullaniciTipNo"]); int AktifPasifTipNo = Convert.ToInt32(dr["AktifPasifTipNo"]); KullaniciAraModel oKullaniciAraModel = new KullaniciAraModel() { KullaniciKey = Convert.ToInt32(dr["KullaniciKey"]), KullaniciAd = dr["KullaniciAd"].ToString(), Ad = dr["Ad"].ToString(), Soyad = dr["Soyad"].ToString(), KullaniciTipNo = KullaniciTipNo, KullaniciTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, KullaniciTipNo), AktifPasifTipNo = AktifPasifTipNo, AktifPasifTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, AktifPasifTipNo) }; aryKullaniciAraModel.Add(oKullaniciAraModel); } oSonucModel.Durum = ""; oSonucModel.Data = aryKullaniciAraModel; } else { oSonucModel.Aciklama = "Aradığınız kritere uygun kullanıcı kaydı bulunamadı"; } oSonucModel.ToplamKayitAdet = ToplamKayitAdet; Stopwatch _stopwatch = (Stopwatch)TempData["ServerCalismaSure"]; _stopwatch.Stop(); oSonucModel.SCS = _stopwatch.ElapsedMilliseconds.ToString(); return(Json(oSonucModel, JsonRequestBehavior.AllowGet)); } }