/// <summary> /// Procedura selecteaza datele unei boli /// </summary> /// <returns>Returneaza un obiect care contine aceste date</returns> public Boala GetDetalii() { DataSet detaliiCategorie = RunProcedure("spGetAllBoli", new SqlParameter[0], "Boli"); using ( detaliiCategorie ) { Boala boala = new Boala(); if (detaliiCategorie.Tables["Boli"].Rows.Count > 0) { DataRow dr = detaliiCategorie.Tables["Boli"].Rows[0]; boala.BoalaId = int.Parse(dr["BoalaID"].ToString()); boala.CodBoala = dr["Cod"].ToString(); boala.CategorieBoala = dr["Categorie"].ToString(); boala.Procent = float.Parse(dr["Procent"].ToString()); boala.Stagiu = dr["Stagiu"].ToString().Equals("da"); } else { boala.BoalaId = -1; } return(boala); } }
/// <summary> /// Procedura selecteaza datele unei boli /// </summary> /// <param name="idBoala">Id-ul bolii selectate</param> /// <returns>Returneaza un obiect care contine aceste date</returns> public Boala GetDetalii(string idBoala) { SqlParameter[] parameters = { new SqlParameter("@BoalaID", SqlDbType.Int, 4) }; parameters[0].Value = idBoala; DataSet detaliiCategorie = RunProcedure("spGetBoala", parameters, "Boli"); using ( detaliiCategorie ) { Boala boala = new Boala(); if (detaliiCategorie.Tables["Boli"].Rows.Count > 0) { DataRow dr = detaliiCategorie.Tables["Boli"].Rows[0]; boala.BoalaId = int.Parse(dr["BoalaID"].ToString()); boala.CodBoala = dr["Cod"].ToString(); boala.CategorieBoala = dr["Categorie"].ToString(); boala.Procent = float.Parse(dr["Procent"].ToString()); boala.Stagiu = dr["Stagiu"].ToString().Equals("da"); } else { boala.BoalaId = -1; } return(boala); } }
/// <summary> /// Procedura adauga o boala /// </summary> /// <param name="boala">Obiectul care contine datele bolii</param> /// <returns>Returneaza true daca a fost facuta adaugarea si false altfel</returns> public bool InsertBoala(Boala boala) { return(this.InsertBoli(boala.Procent, boala.CodBoala, boala.CategorieBoala, boala.Stagiu)); }
/// <summary> /// Procedura actualizeaza o boala /// </summary> /// <param name="boala">Obiectul care contine datele bolii</param> /// <returns>Returneaza true daca s-a facut actualizarea si false altfel</returns> public bool UpdateBoala(Boala boala) { return(this.UpdateBoli(boala.BoalaId, boala.Procent, boala.CodBoala, boala.CategorieBoala, boala.Stagiu)); }