public void UpdatePlanTerapije(PlanTerapije pt) { try { using (SqlConnection conn = new SqlConnection(_cs)) { conn.Open(); SqlCommand command = new SqlCommand("dbo.UpdatePlanTerapije", conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@IDPlanTerapije", pt.IDPlanTerapije)); command.Parameters.Add(new SqlParameter("@DoktorID", pt.DoktorID)); command.Parameters.Add(new SqlParameter("@PacijentID", pt.PacijentID)); command.Parameters.Add(new SqlParameter("@TerapijaID", pt.TerapijaID)); command.Parameters.Add(new SqlParameter("@DatumPocetka", pt.DatumPocetka)); command.ExecuteNonQuery(); } } catch (Exception ex) { throw ex; } }
public List <PlanTerapije> GetPlanTerapije(int id) { List <PlanTerapije> lista = new List <PlanTerapije>(); try { using (SqlConnection Sqlcon = new SqlConnection(_cs)) { SqlCommand cmd = new SqlCommand("dbo.GetPlanTerapije", Sqlcon); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@PacijentID", id)); Sqlcon.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { PlanTerapije pt = new PlanTerapije(); pt.IDPlanTerapije = Convert.ToInt32(dr["IDPlanTerapije"]); pt.DoktorID = Convert.ToInt32(dr["DoktorKorisnickiRacunID"]); pt.PacijentID = Convert.ToInt32(dr["PacijentKorisnickiRacunID"]); pt.TerapijaID = Convert.ToInt32(dr["TerapijaID"]); pt.NazivTerapije = dr["Naziv"].ToString(); pt.DatumPocetka = Convert.ToDateTime(dr["DatumPocetka"]); pt.DatumZavrsetka = Convert.ToDateTime(dr["DatumZavrsetka"]); lista.Add(pt); } ; } } catch (Exception ex) { throw ex; } return(lista); }
public void UpdatePlanTerapije(PlanTerapije pt) { new Repository().UpdatePlanTerapije(pt); }
public void AddPlanTerapije(PlanTerapije pt) { new Repository().AddPlanTerapije(pt); }