private void btncreateFarmaceut_Click(object sender, EventArgs e) { try { ISession s = DataLayer.GetSession(); ProdajnoMesto p = s.Load <ProdajnoMesto>(1); Farmaceut f = new Farmaceut(); f.adresaZaposlenog = "Pantelejska"; f.brojTelefona = "+38164"; f.datumRodjenja = DateTime.Now; f.ime = "AN"; f.maticniBroj = "11111"; f.prezime = "Pr"; f.radi = p; f.datumObnoveLicence = DateTime.Now; f.datumDiplomiranja = DateTime.Now; s.Save(f); s.Flush(); s.Close(); } catch (Exception ec) { MessageBox.Show(ec.Message); } }
public int UpdateFarmaceut(int idZaposlenog, Farmaceut z) { try { ISession s = DataLayer.GetSession(); Farmaceut zap = s.Get <Farmaceut>(idZaposlenog); zap.adresaZaposlenog = z.adresaZaposlenog; zap.brojTelefona = z.brojTelefona; zap.datumRodjenja = z.datumRodjenja; zap.ime = z.ime; zap.prezime = z.prezime; zap.maticniBroj = z.maticniBroj; zap.datumObnoveLicence = z.datumObnoveLicence; zap.datumDiplomiranja = z.datumDiplomiranja; s.SaveOrUpdate(zap); s.Flush(); s.Close(); return(1); } catch (Exception ec) { return(-1); } }
public FarmaceutView GetFarmaceutView(int idZaposlenog) { ISession s = DataLayer.GetSession(); Farmaceut p = s.Query <Farmaceut>() .Where(pp => pp.idZaposlenog == idZaposlenog).Select(ss => ss).FirstOrDefault(); if (p == null) { return(new FarmaceutView()); } return(new FarmaceutView(p)); }
public FarmaceutView(Farmaceut f) : base(f) { /* this.idZaposlenog = f.idZaposlenog; * this.adresaZaposlenog = f.adresaZaposlenog; * this.brojTelefona = f.brojTelefona; * this.datumRodjenja = f.datumRodjenja; * this.ime = f.ime; * this.prezime = f.prezime; * this.maticniBroj = f.maticniBroj;*/ this.datumObnoveLicence = f.datumObnoveLicence; this.datumDiplomiranja = f.datumDiplomiranja; }
private void button2_Click(object sender, EventArgs e) { try { ISession sd = DataLayer.GetSession(); IList <Zaposleni> zap = sd.QueryOver <Zaposleni>() .Where(p => p.idZaposlenog == 2).List <Zaposleni>(); Farmaceut z = (Farmaceut)zap[0]; MessageBox.Show(z.ime); sd.Close(); } catch (Exception ec) { MessageBox.Show(ec.Message); } }
public int RemoveFarmaceut(int idZaposlenog) { try { ISession s = DataLayer.GetSession(); Farmaceut l = s.Get <Farmaceut>(idZaposlenog); s.Delete(l); s.Flush(); s.Close(); return(1); } catch (Exception ec) { return(-1); } }
public int AddFarmaceut(Farmaceut l) { try { ISession s = DataLayer.GetSession(); s.Save(l); s.Flush(); s.Close(); return(1); } catch (Exception ec) { return(-1); } }
public int Put(int id, [FromBody] Farmaceut r) { DataProvider provider = new DataProvider(); return(provider.UpdateFarmaceut(id, r)); }
public int Post([FromBody] Farmaceut r) { DataProvider provider = new DataProvider(); return(provider.AddFarmaceut(r)); }