public static kullanici getKullaniciAsClass(string tc) { otoservisdbEntities db = new otoservisdbEntities(); using (db) { kullanici k = new kullanici(); var query = (from c in db.kullanicis where c.tckn == tc select new { c.kullaniciID, c.kullaniciAdi, c.parola, c.tckn, c.adSoyad, c.iseGirisTarihi, c.bolumID, c.pozisyonID, c.telno }).Single(); k.kullaniciID = query.kullaniciID; k.kullaniciAdi = query.kullaniciAdi; k.parola = query.parola; k.tckn = query.tckn; k.adSoyad = query.adSoyad; k.iseGirisTarihi = query.iseGirisTarihi; k.bolumID = query.bolumID; k.pozisyonID = query.pozisyonID; k.telno = query.telno; return(k); } }
public ActionResult Create(kullanici yeni) { try { var ekle = db.kullanicis.Where(i => i.kullaniciAd == yeni.kullaniciAd).SingleOrDefault(); if (ekle != null) { return(View()); } if (string.IsNullOrEmpty(yeni.kullaniciSifre)) { return(View()); } yeni.yetkiID = 1; db.kullanicis.Add(yeni); db.SaveChanges(); Session["username"] = yeni.kullaniciAdSoyad; return(RedirectToAction("Index", "Kullanici")); } catch (Exception) { return(View()); } }
private void btnGiris_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtKullaniciAdi.Text) || !string.IsNullOrEmpty(txtSifre.Text)) { kullaniciService kullaniciService = new kullaniciService(); kullanici kontrolKullanici = kullaniciService.kullaniciKontrol(txtKullaniciAdi.Text, txtSifre.Text); if (kontrolKullanici != null) { Form anaForm = Application.OpenForms["Form1"]; Panel solPanel = (Panel)anaForm.Controls["pnlIslemListesi"]; GroupBox gbIslemListe = (GroupBox)solPanel.Controls["grpBoxIslemListe"]; foreach (Control item in gbIslemListe.Controls) { if (item is Button) { item.Enabled = true; } } MessageBox.Show("Merhaba " + kontrolKullanici.kullaniciAdi, "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Hatalı kullaıcı adı veya şifre girdiniz", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Lütfeln giriş bilgilerinini Eksiksiz olarak giriniz", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult DuyuruEkle(duyuru duyuru, string baslik, string icerik, DateTime tarih) { if (ModelState.IsValid == false) // validation hatası varsa demek { var yetkiler = db.yetki.ToList(); ViewBag.yetkiler = new SelectList(yetkiler, "yetkiID", "adi"); return(View()); } if (Session["kullanici"] != null) { kullanici k = (kullanici)Session["kullanici"]; duyuru duy = (duyuru)Session["duyuru"]; duyuru.kullaniciID = k.kullaniciID; duyuru.baslik = baslik; duyuru.icerik = icerik; duyuru.tarih = DateTime.Now; } db.duyuru.Add(duyuru); db.SaveChanges(); return(RedirectToAction("Index")); }
public JsonResult Kayit(kullanici kullanici_, int?YetkiID) { if (kullanici_ != null) { var KullaniciVarmi = _kullaniciRepository.KullaniciBul(kullanici_.Email); if (KullaniciVarmi != null) { return(Json(new ResultJson { Success = false, Message = kullanici_.Email + " Daha önce Kayıt Edilmiş" })); } kullanici_.Tarih = DateTime.Now.ToLocalTime().ToString(); kullanici_.YetkiID = 3; kullanici_.Onay = true; _kullaniciRepository.Insert(kullanici_); try { _kullaniciRepository.Save(); return(Json(new ResultJson { Success = true, Message = "Başarılı bir şekilde kayıt oldunuz. Hadi ilk makaleyi yazalım." })); } catch (Exception ex) { return(Json(new ResultJson { Success = false, Message = "Kayıt olurken Hata oluştu !" })); } } return(Json(new ResultJson { Success = false, Message = "Kayıt olurken Hata oluştu !" })); }
public static int GirisYap(kullanici kullanici) { try { using (idDBEntities db = new idDBEntities()) { kullanici.sifre = MD5Sifrele(kullanici.sifre); var kul = (from k in db.kullanicis where k.kullaniciAdi == kullanici.kullaniciAdi && k.sifre == kullanici.sifre select k).SingleOrDefault(); if (kul == null) { return(0); } else { return(kul.kullaniciId); } } } catch { return(0); } }
public ActionResult Create(kullanici kullaniciModel) { try { var varmi = rehberDB.kullanicis .Where(i => i.kullanici_adi == kullaniciModel.kullanici_adi) .SingleOrDefault(); if (varmi != null) { return(View()); } if (String.IsNullOrEmpty(kullaniciModel.sifre)) { return(View()); } rehberDB.kullanicis.Add(kullaniciModel); rehberDB.SaveChanges(); Session["username"] = kullaniciModel.kullanici_adi; return(RedirectToAction("Index", "Kullanici")); } catch { return(View()); } }
public HttpResponseMessage Login(LoginDTO kullanici2) { if (kullanici2.TCKN != null && kullanici2.sifre != null) { try { //UInt32.Parse(TCKN); kullanici kullanici = db.kullanici.FirstOrDefault(x => x.TCKN == kullanici2.TCKN && x.sifre == kullanici2.sifre); if (kullanici != null) { return(Request.CreateResponse(HttpStatusCode.OK, kullanici)); } else { return(Request.CreateResponse(HttpStatusCode.Accepted, "TCKN veya Şifre Hatalı")); } } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.Accepted, "TCKN sadece rakamlardan oluşmaldır.")); } } else { return(Request.CreateResponse(HttpStatusCode.Accepted, "Eksik Bilgi Girdiniz")); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["unique-site-user"] != null) { kullanici _authority = (kullanici)Session["unique-site-user"]; onayBekleyenRepeater.DataSource = ilanb.list(2, _authority.kullaniciId, 2, false, false); onayBekleyenRepeater.DataBind(); if (Request.QueryString["classified"] != null) { if (Request.QueryString["proc"] == "2") { ilanb.update(2, Request.QueryString["classified"]); } if (Request.QueryString["proc"] == "3") { ilanb.update(3, Request.QueryString["classified"]); //düzenlenecek } //if (Request.QueryString["proc"] == "4") //{ // ilanb.update(3, Request.QueryString["classified"]); //} onayBekleyenRepeater.DataSource = ilanb.list(2, _authority.kullaniciId, 2, false, false); onayBekleyenRepeater.DataBind(); } } }
private void cbKullaniciKodu_SelectedValueChanged(object sender, EventArgs e) { string kullaniciKodu = cbKullaniciKodu.Text; kullanici kullanicis = databaseControl.GetKullanici(kullaniciKodu); formControl.Open(new KullaniciPage(kullanicis)); }
private void GirisYap_Click(object sender, EventArgs e) { OleDbConnection con = new OleDbConnection(kodlar.Yol()); con.Open(); string sql = "select * from uyeler where Tc=@Tc and Sifre=@Sifre"; DataTable dt = new DataTable(); OleDbDataAdapter adp = new OleDbDataAdapter(sql, con); adp.SelectCommand.Parameters.AddWithValue("@Tc", kullanici.Text); adp.SelectCommand.Parameters.AddWithValue("@Sifre", sifre.Text); adp.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("Hatalı Giriş Yaptınız. Lütfen Bilgilerinizi Kontrol Edin", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Yetki = dt.Rows[0]["Yetki"].ToString(); if (Yetki == "Üye" || Yetki == "Yetkili") { kullanici uyeForm = new kullanici(); uyeForm.Show(); Giris ac = (Giris)((Panel)Parent).Parent; ac.Hide(); } else { MessageBox.Show("Üyeliğiniz Aktifleştirilmemiş Olabilir. Lütfen Yetkililerle İletişime Geçin.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
protected void Iptal_Click(object sender, EventArgs e) { kullanici _authority = (kullanici)Session["unique-site-user"]; kullanicib.update(2, _authority.kullaniciId, true); Response.Redirect("~/giris-yap.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["unique-site-user"] != null) { kullanici _authority = (kullanici)Session["unique-site-user"]; } }
private void Form1_Load(object sender, EventArgs e) { frmKullaniciGiris kullaniciKontrol = new frmKullaniciGiris(); kullaniciKontrol.MdiParent = this; kullaniciKontrol.StartPosition = FormStartPosition.Manual; kullaniciKontrol.Location = new Point(280, 130); kullaniciKontrol.Show(); admin a = new admin(); a.id = "admin"; a.sifre = "123"; a.kullaniciTip = "admin"; dataBase.dataBase.kullaniciEkle(a); kullanici k = new kullanici(); k.id = "user"; k.sifre = "123"; k.kullaniciTip = "kullanici"; dataBase.dataBase.kullaniciEkle(k); kullanici k1 = new kullanici(); k1.id = "user2"; k1.sifre = "123"; k1.kullaniciTip = "kullanici"; dataBase.dataBase.kullaniciEkle(k1); }
public static int KayitOl(kullanici kullanici) { try { idDBEntities db = new idDBEntities(); var kul = (from k in db.kullanicis where k.kullaniciAdi == kullanici.kullaniciAdi select k).SingleOrDefault(); if (kul == null) { kullanici.sifre = MD5Sifrele(kullanici.sifre); db.kullanicis.Add(kullanici); db.SaveChanges(); return(0); // kayıt başarılı } else { return(1); // kayıt başarısız } } catch { return(2); // işlem başarısız } }
protected void Gonder_Click(object sender, EventArgs e) { ilan _ilan = ilanb.search(2, Convert.ToInt32(Request.QueryString["ilan"])); kullanici _authority = (kullanici)Session["unique-site-user"]; mesajb.insert(_ilan.kullaniciId, _authority.kullaniciId, _ilan.ilanId, txtMesaj.InnerText); }
public static char SifreGuncelle(string eski, string yeni, int kulId) { char res = '*'; try { using (idDBEntities db = new idDBEntities()) { kullanici k = db.kullanicis.Find(kulId); eski = MD5Sifrele(eski); if (k.sifre == eski) { k.sifre = MD5Sifrele(yeni); db.SaveChanges(); res = '+'; } else { res = '-'; } } } catch { res = '?'; } return(res); }
protected void Button2_Click(object sender, EventArgs e) { kullanici kul = (kullanici)Session["kullanici"]; Result <int> sonuc = new Result <int>(new Exception("Hata Oluştu!")); if (kul != null) { kul.AdiSoyadi = AdiTextBox.Text.Trim(); kul.Tel = telTextBox.Text.Trim(); kul.Mail = MailTextBox.Text.Trim(); kul.Adres = adresTextBox.Text.Trim(); kul.KullaniciAdi = kullaniciAdiTextBox.Text.Trim(); kul.Sifre = sifre1TextBox1.Text.Trim(); sonuc = kul.Update(); } if (sonuc.HasError) { Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>"; Session.Add("kullanici", kul); return; } else { Labelbilgi.Text = "<p class='msg done'><b>KAYIT BAŞARILI...</b></p>"; } }
public ActionResult Login(kullanici kullaniciModel) { try { var varmi = rehberDB.kullanicis .Where(i => i.kullanici_adi == kullaniciModel.kullanici_adi) .SingleOrDefault(); if (varmi == null) { return(View()); } if (varmi.sifre == kullaniciModel.sifre) { Session["username"] = varmi.kullanici_adi; return(RedirectToAction("Index", "Kullanici")); } else { return(View()); } } catch { return(View()); } }
public async Task <IActionResult> Putkullanici(long id, kullanici kullanici) { if (id != kullanici.kullanici_id) { return(BadRequest()); } _context.Entry(kullanici).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!kullaniciExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected void Buttongiris_Click(object sender, EventArgs e) { List <kullanici> kullanicilar = kullanici.SelectAll(); kullanici kul = (from k in kullanici.SelectAll() where k.KullaniciAdi == TextBoxkullaniciadi.Text && k.Sifre == TextBoxsifre.Text select k).FirstOrDefault(); if (kul == null) { Labelbilgi.Text = "<p class='msg error'><b>Kullanıcı Adı ve/veya Şifre Hatalı! Tekrar Deneyiniz...</b></p>"; return; } Session.Add("kullanici", kul); aktivite akt = aktivite.SelectByKullaniciId(kul.Id); if (akt != null) { Session.Add("bilgi", "Merhaba<br/><b>" + kul.AdiSoyadi + "</b><br/>Son Giriş Zamanınız<br/><b>" + akt.Tarih.ToString() + "</b>"); } aktivite yeni = new aktivite(kul.Id, DateTime.Now); try { Result <int> sonuc = yeni.Insert(); } catch { } Response.Redirect("haberler.aspx"); }
public async Task <ActionResult <kullanici> > Postkullanici(kullanici kullanici) { _context.kullanicilar.Add(kullanici); await _context.SaveChangesAsync(); return(CreatedAtAction("Getkullanici", new { id = kullanici.kullanici_id }, kullanici)); }
public ActionResult Login(kullanici kullanici) { if (kullanici.KullaniciAdi != null || kullanici.Sifre != null) { var kullaniciindb = db.kullanici.FirstOrDefault(m => m.KullaniciAdi == kullanici.KullaniciAdi && m.Sifre == kullanici.Sifre); //veri tabanında bu kullanıcı adı ve şifresi olan kullanıcı var mı? if (kullaniciindb != null) //varsa index sayfasına git { FormsAuthentication.SetAuthCookie(kullaniciindb.KullaniciAdi, false); Response.Cookies["KullaniciID"].Value = kullaniciindb.KullaniciID.ToString(); Response.Cookies["KullaniciID"].Expires = DateTime.Now.AddDays(2); return(RedirectToAction("Index", "Home")); } else { var model = new UserModelClass() { Sehirler = db.Sehirler.ToList() }; ViewBag.Mesaj = "Hatalı kullanıcı adı veya parola.";//Eğer yoksa bu uyarıyı ver return(View("Login", model)); } } else { var model = new UserModelClass() { Sehirler = db.Sehirler.ToList() }; ViewBag.Mesaj = "Kullanıcı adı ve parola kısmı boş geçilemez."; return(View("Login", model)); } }
public HttpResponseMessage HesapAc(hesap hesap) { if (hesap.musteriNo != null) { kullanici user = db.kullanici.FirstOrDefault(x => x.musteriNo == hesap.musteriNo); if (user != null) { try { int hesapNo = 1000; List <hesap> hesaps = db.hesap.Where(x => x.musteriNo == hesap.musteriNo).ToList(); hesapNo = hesapNo + hesaps.Count + 1; hesap.hesapNo = hesap.musteriNo + hesapNo.ToString(); hesap.aktiflikDurumu = true; hesap.bakiye = 0; db.hesap.Add(hesap); db.SaveChanges(); var hesaplar = db.hesap.Where(x => x.musteriNo == hesap.musteriNo && x.aktiflikDurumu == true).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, hesaplar)); } catch (Exception e) { } return(Request.CreateResponse(HttpStatusCode.Accepted, "Bilgileriniz Hatalıdır Lütfen Kontrol Edip Tekrar Deneyiniz!")); } else { return(Request.CreateResponse(HttpStatusCode.Accepted, "Bilgileriniz Hatalıdır Lütfen Kontrol Edip Tekrar Deneyiniz!")); } } return(Request.CreateResponse(HttpStatusCode.Accepted, "Eksik Bilgi Girdiniz")); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { string ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; if (HttpContext.Current.Session["kullanici"] == null && ControllerName != "Login" && ControllerName != "RM") { filterContext.Result = new RedirectResult("/Login/Index"); return; } if (HttpContext.Current.Session["kullanici"] != null) { kullanici k = (kullanici)HttpContext.Current.Session["kullanici"]; if (k.yetkiID == 1) { yetkili = "Müdür"; } if (yetkili != "Müdür" && (ControllerName == "Müdür" || ControllerName == "ogretmen")) { filterContext.Result = new RedirectResult("/Talep/Index"); return; } } base.OnActionExecuting(filterContext); }
public HttpResponseMessage Hesaplar(HesaplarDTO hesap) { if (hesap.musteriNo != null) { kullanici user = db.kullanici.FirstOrDefault(x => x.musteriNo == hesap.musteriNo); if (user != null) { try { var hesaplar = db.hesap.Where(x => x.musteriNo == hesap.musteriNo && x.aktiflikDurumu == true).ToList(); if (hesaplar.Count() > 0) { return(Request.CreateResponse(HttpStatusCode.OK, hesaplar)); } else { return(Request.CreateResponse(HttpStatusCode.Accepted, "Hesabınız bulunmamaktadır")); } } catch (Exception e) { } return(Request.CreateResponse(HttpStatusCode.Accepted, "Bilgileriniz Hatalıdır Lütfen Kontrol Edip Tekrar Deneyiniz!")); } else { return(Request.CreateResponse(HttpStatusCode.Accepted, "Bilgileriniz Hatalıdır Lütfen Kontrol Edip Tekrar Deneyiniz!")); } } return(Request.CreateResponse(HttpStatusCode.Accepted, "Eksik Bilgi Girdiniz")); }
public ActionResult makaleYaz(makale makale, HttpPostedFileBase Resim2, string etiketler) { if (makale != null) { kullanici aktif = Session["Kullanici"] as kullanici; makale.YayinTarihi = DateTime.Now; makale.MakaleTipID = 1; makale.YazarID = aktif.Id; makale.KapakResimID = ResimKaydet(Resim2, HttpContext); db.makale.Add(makale); db.SaveChanges(); string[] etikets = etiketler.Split(','); foreach (string etiket in etikets) { etiket etk = db.etiket.FirstOrDefault(x => x.Ad.ToLower() == etiket.ToLower().Trim()); if (etk == null) { etk = new etiket(); etk.Ad = etiket; db.etiket.Add(etk); db.SaveChanges(); } //etiket var makale.etiket.Add(etk); db.SaveChanges(); } } return(RedirectToAction("MakaleListele")); }
protected void btn_kayitekle_Click(object sender, EventArgs e) { int ID = int.Parse(HttpContext.Current.Request.Cookies["" + Class.Fonksiyonlar.Genel.ParametreAl("GuvenlikKodu") + "KullaniciID"].Value); try { using (BaglantiCumlesi db = new BaglantiCumlesi()) { kullanici TblEkle = db.kullanici.First(a => a.ID == ID); TblEkle.Adi = Class.Fonksiyonlar.Genel.SQLTemizle(form_ad.Text); TblEkle.EPosta = Class.Fonksiyonlar.Genel.SQLTemizle(form_eposta.Text); TblEkle.Telefon = Class.Fonksiyonlar.Genel.SQLTemizle(form_telefon.Text); if (form_sifre.Text != "") { TblEkle.Sifre = Class.Fonksiyonlar.Genel.Sifrele(form_sifre.Text); } TblEkle.GuncelleyenID = int.Parse(HttpContext.Current.Request.Cookies["" + Class.Fonksiyonlar.Genel.ParametreAl("GuvenlikKodu") + "KullaniciID"].Value); TblEkle.DegisTarih = DateTime.Now; db.SaveChanges(); } Yonetim.Olay.Islem("kullanici", "Güncellendi", ID.ToString()); Class.Fonksiyonlar.JavaScript.MesajKutusuVeYonlendir("Profiliniz başarıyla düzenlenmiştir.", "Profil.aspx"); } catch (Exception ex) { Class.Fonksiyonlar.JavaScript.MesajKutusuVeYonlendir(Yonetim.Degiskenler.Hata + ex.Message, "Profil.aspx"); } }
private void btnZimmetle_Click(object sender, EventArgs e) { if (txtKullaniciAdi.Text == "") { MessageBox.Show("Lütfen alanları boş geçmeyiniz."); return; } context = new yazilim_sinama_projesiEntities(); zimmet zim = new zimmet(); kullanici kul = context.kullanicis.FirstOrDefault(c => c.kullaniciAdi == txtKullaniciAdi.Text); if (kul != null && kul.bolumID == frmSistemeGiris.bolumID && kul.kullaniciTipi == "calisan") { zim.zimmet1 = UrunAd; zim.kullaniciID = kul.kullaniciID; zim.urunID = UrunID; context.zimmets.Add(zim); context.SaveChanges(); MessageBox.Show("Ürün Zimmetlendi."); } else { MessageBox.Show("Kullanıcı Adı Bulunamadı."); } }
public ActionResult Register(kullanici model) { if (model.email == null || model.adSoyad == null || model.sifre == null) { return(Json(new { success = false, res = "Boşluk Bırakmayınız." })); } calisartikContext db = new calisartikContext(); try { var query = db.kullanicilar.SingleOrDefault(w => w.email == model.email); if (query != null) { return(Json(new { success = false, res = "Bu email kullanılmış!" })); } db.kullanicilar.Add(model); db.SaveChanges(); FormsAuthentication.SetAuthCookie(model.email, false); return(Redirect(Request.UrlReferrer.PathAndQuery)); } catch (Exception ex) { return(Json(new { success = false, res = ex.ToString() })); } }