public IEnumerable <CatGenero> ListarTallasPorGenero(string genero) { List <CatGenero> listGenero = new List <CatGenero>(); comando.Connection = conn.AbrirConexion(); comando.CommandText = "Listar_Tallas_Por_Genero"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Genero", genero); leer = comando.ExecuteReader(); while (leer.Read()) { CatGenero generos = new CatGenero() { IdGender = Convert.ToInt32(leer["ID_GENDER"]), Genero = leer["GENERO"].ToString() }; CatTallaItem catTalla = new CatTallaItem() { Id = Convert.ToInt32(leer["ID"]), Talla = leer["TALLA"].ToString() }; generos.CatTallaItem = catTalla; listGenero.Add(generos); } leer.Close(); conn.CerrarConexion(); return(listGenero); }
public IEnumerable <CatTallaItem> Lista_tallas_Estilo_Arte(int?idEstilo) { Conexion con = new Conexion(); List <CatTallaItem> Lista = new List <CatTallaItem>(); try { SqlCommand com = new SqlCommand(); SqlDataReader leer = null; //string listaStag=""; com.Connection = con.AbrirConexion(); com.CommandText = "SELECT S.TALLA FROM ITEM_SIZE IZ " + "INNER JOIN CAT_ITEM_SIZE S ON IZ.TALLA_ITEM=S.ID " + "WHERE ID_SUMMARY='" + idEstilo + "' ORDER by cast(ORDEN AS int) ASC "; leer = com.ExecuteReader(); while (leer.Read()) { CatTallaItem catTalla = new CatTallaItem() { Talla = leer["TALLA"].ToString() }; Lista.Add(catTalla); } leer.Close(); } finally { con.CerrarConexion(); con.Dispose(); } return(Lista); }
//Permite consultar los detalles de una talla public CatTallaItem ConsultarListaTallas(int?id) { CatTallaItem tallas = new CatTallaItem(); try { comando.Connection = conn.AbrirConexion(); comando.CommandText = "Listar_Talla_Por_Id"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Id", id); leer = comando.ExecuteReader(); while (leer.Read()) { tallas.Id = Convert.ToInt32(leer["ID"]); tallas.Talla = leer["TALLA"].ToString(); if (!Convert.IsDBNull(leer["ORDEN"])) { tallas.Orden = Convert.ToInt32(leer["ORDEN"]); } } leer.Close(); } finally { conn.CerrarConexion(); conn.Dispose(); } return(tallas); }
//Muestra la lista de tallas public IEnumerable <CatTallaItem> ListaTallas() { List <CatTallaItem> listTallas = new List <CatTallaItem>(); try { comando.Connection = conn.AbrirConexion(); comando.CommandText = "Listar_Tallas"; comando.CommandType = CommandType.StoredProcedure; leer = comando.ExecuteReader(); while (leer.Read()) { CatTallaItem tallas = new CatTallaItem() { Id = Convert.ToInt32(leer["ID"]), Talla = leer["TALLA"].ToString(), }; if (!Convert.IsDBNull(leer["ORDEN"])) { tallas.Orden = Convert.ToInt32(leer["ORDEN"]); } listTallas.Add(tallas); } leer.Close(); } finally { conn.CerrarConexion(); conn.Dispose(); } return(listTallas); }
//Permite crear una nueva talla public void AgregarTallas(CatTallaItem tallas) { comando.Connection = conn.AbrirConexion(); comando.CommandText = "AgregarTalla"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Talla", tallas.Talla); comando.ExecuteNonQuery(); conn.CerrarConexion(); }
//Permite actualiza la informacion de una talla public void ActualizarTallas(CatTallaItem tallas) { try { comando.Connection = conn.AbrirConexion(); comando.CommandText = "Actualizar_Talla"; comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Id", tallas.Id); comando.Parameters.AddWithValue("@Talla", tallas.Talla); comando.Parameters.AddWithValue("@Orden", tallas.Orden); comando.ExecuteNonQuery(); } finally { conn.CerrarConexion(); conn.Dispose(); } }
public IEnumerable <CatGenero> ListarTallasPorGenero(string genero) { List <CatGenero> listGenero = new List <CatGenero>(); Conexion conne = new Conexion(); try { SqlCommand comand = new SqlCommand(); SqlDataReader leerTG = null; comand.Connection = conne.AbrirConexion(); comand.CommandText = "Listar_Tallas_Por_Genero"; comand.CommandType = CommandType.StoredProcedure; comand.Parameters.AddWithValue("@Genero", genero); leerTG = comand.ExecuteReader(); while (leerTG.Read()) { CatGenero generos = new CatGenero() { IdGender = Convert.ToInt32(leerTG["ID_GENDER"]), Genero = leerTG["GENERO"].ToString() }; CatTallaItem catTalla = new CatTallaItem() { Id = Convert.ToInt32(leerTG["ID"]), Talla = leerTG["TALLA"].ToString() }; generos.CatTallaItem = catTalla; listGenero.Add(generos); } leerTG.Close(); } finally { conne.CerrarConexion(); conne.Dispose(); } return(listGenero); }