public bool KayitOl(Personel personel) { TblPersonel per = new TblPersonel(); try { per.Email = personel.Email; per.Password = personel.Password; per.Telefon = personel.Telefon; per.Ad = personel.Ad; per.Soyad = personel.Soyad; per.TipNo = 7; per.FirmaID = null; per.IsAdmin = true; per.DurumNo = 1; db.TblPersonel.Add(per); db.SaveChanges(); // per.WebSite=per return(true); } catch { return(false); } }
public bool PersonelDelete(Personel personel) { ResponseUserData tmp = Kontrol(); if (tmp != null) { try { int id = Convert.ToInt32(personel.ID); TblPersonel per = db.TblPersonel.Single(pe => pe.ID == id); per.IsSilindi = true; db.TblPersonel.Add(per); db.Entry(per).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } } else { return(false); } }
// public ResponseUserData Login(UserLoginData data) public ResponseUserData Login(Personel data) { // private string secureToken; // var bul = db.TblPersonel.FirstOrDefault(x => x.Ad == data.Username && x.Password == data.Password); var bul = db.TblPersonel.FirstOrDefault(x => x.Ad == data.Ad && x.Password == data.Password); // if(bul.ID) if (bul != null) { // secureToken = GetJwt(data.Ad, bul.ID, bul.FirmaID.Value, bul.IsAdmin.Value, bul.TipNo.Value); secureToken = GetJwt(data.Ad, bul.ID, bul.FirmaID.Value, bul.IsAdmin.Value, bul.TipNo.Value); tokentut = secureToken; TblPersonel bil = db.TblPersonel.Single(pe => pe.ID == bul.ID); if (bil != null) { bil.TokenTut = tokentut; db.TblPersonel.Add(bil); db.Entry(bil).State = EntityState.Modified; db.SaveChanges(); } var response = new ResponseUserData { UserID = bul.ID, // UserName = data.Username, UserName = data.Ad, Authenticated = true, Token = secureToken, IsAdmin = bul.IsAdmin.Value, FirmaID = bul.FirmaID.Value, TipNo = bul.TipNo.Value }; return(response); } else { OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse; response.StatusCode = System.Net.HttpStatusCode.InternalServerError; return(null); } }
private void simpleButtonKaydet_Click(object sender, EventArgs e) { TblPersonel t = new TblPersonel(); if (t.AD != "" & t.SOYAD != "") { t.AD = textAd.Text; t.SOYAD = textSoyad.Text; t.DEPARTMAN = byte.Parse(lookUpEdit1.EditValue.ToString()); db.TblPersonel.Add(t); db.SaveChanges(); MessageBox.Show("Personel Sisteme Eklendi", "bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); liste(); } else { MessageBox.Show("HATA Bilgileri Tekrar Kontrol Edin!", "bilgi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool PersonelUpdate(Personel personel) { ResponseUserData tmp = Kontrol(); if (tmp != null) { try { int id = Convert.ToInt32(personel.ID); TblPersonel per = db.TblPersonel.Single(pe => pe.ID == id); per.Ad = personel.Ad; per.Soyad = personel.Soyad; per.Departman = personel.Departman; per.Email = personel.Email; per.Telefon = personel.Telefon; per.Telefon2 = personel.Telefon2; per.Adres = personel.Adres; per.WebSite = personel.WebSite; db.TblPersonel.Add(per); db.Entry(per).State = EntityState.Modified; // db.TblFirma.Add(fir); db.SaveChanges(); return(true); } catch { return(false); } } else { return(false); } }
public bool PersonelEkle(Personel personel) { ResponseUserData tmp = Kontrol(); if (tmp != null) { try { TblPersonel per = new TblPersonel(); per.Ad = personel.Ad; per.Soyad = personel.Soyad; per.Departman = personel.Departman; per.Email = personel.Email; per.Telefon = personel.Telefon; per.Telefon2 = personel.Telefon2; per.Adres = personel.Adres; per.WebSite = personel.WebSite; per.Password = personel.Password; per.FirmaID = tmp.FirmaID; per.TipNo = tmp.TipNo; per.IsSilindi = false; per.IsAdmin = false; db.TblPersonel.Add(per); db.SaveChanges(); return(true); } catch { return(false); } } else { return(false); } }