public bool Eliminar(Autor autor) { Logs.IniciaMetodo("Item.Eliminar (Autor)", autor.toString()); try { var command = new MySqlCommand() { CommandText = "sp_Autor_Item_Eliminar", CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new MySqlParameter() { ParameterName = "inAutor_Id", Direction = System.Data.ParameterDirection.Input, Value = autor.Id }); command.Parameters.Add(new MySqlParameter() { ParameterName = "inItem_Id", Direction = System.Data.ParameterDirection.Input, Value = this.Id }); var temp = DB.QueryCommand(command); if (temp == 1) { Logs.InfoResult("Item.Eliminar (Autor)", true.ToString()); return(true); } } catch (Exception ex) { Logs.Error(ex); } finally { Logs.SalirMetodo("Item.Eliminar (Autor)"); } return(false); }
public List <Autor> Autores() { Logs.IniciaMetodo("Item.Autores", string.Empty); List <Autor> autores = new List <Autor>(); try { var command = new MySqlCommand() { CommandText = "sp_Autor_Item_Seleccionar_Item", CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new MySqlParameter() { ParameterName = "inItem_Id", Direction = System.Data.ParameterDirection.Input, Value = this.Id }); var datos = DB.GetDataSet(command); if (datos.Tables[0].Rows.Count > 0) { for (int i = 0; i < datos.Tables[0].Rows.Count; i++) { Autor a = new Autor(); a.Id = Convert.ToInt64(datos.Tables[0].Rows[i]["Autor_Id"]); a.Nombre = datos.Tables[0].Rows[i]["Autor_Nombre"].ToString(); autores.Add(a); Logs.InfoResult("Item.Autores", a.toString()); } return(autores); } } catch (Exception ex) { Logs.Error(ex); } finally { Logs.SalirMetodo("Item.Autores"); } return(autores); }
public List <Autor> Buscar_Autores(string Nombre) { Logs.IniciaMetodo("Autor.Buscar_Autores", "Nombre: " + Nombre); try { var command = new MySqlCommand() { CommandText = "sp_Autor_Buscar", CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new MySqlParameter() { ParameterName = "inNombre", Direction = System.Data.ParameterDirection.Input, Value = Nombre }); var datos = DB.GetDataSet(command); if (datos.Tables[0].Rows.Count > 0) { List <Autor> autores = new List <Autor>(); for (int i = 0; i < datos.Tables[0].Rows.Count; i++) { Autor a = new Autor(); a.Id = (Convert.ToInt64(datos.Tables[0].Rows[i]["AutorId"])); a.Nombre = datos.Tables[0].Rows[i]["Nombre"].ToString(); autores.Add(a); Logs.InfoResult("Autor.Buscar_Autores", a.toString()); } return(autores); } } catch (Exception ex) { Logs.Error(ex); } finally { Logs.SalirMetodo("Autor.Buscar_Autores"); } return(null); }