public static CENPreventaProductoPrecio precioProducto(string codProducto, int tipoListaPrecio) { CADPreventa cadPreventa = new CADPreventa(); CENPreventaProductoPrecio lista = null; try { lista = cadPreventa.precioProducto(codProducto, tipoListaPrecio); } catch (Exception ex) { throw ex; } return(lista); }
public CENPreventaProductoPrecio precioProducto(string codProducto, int tipoListaPrecio) { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr = null; CENPreventaProductoPrecio obj = null; //List<CENPreventaProductoPrecio> lista = new List<CENPreventaProductoPrecio>(); CADConexion CadCx = new CADConexion(); try { con = new SqlConnection(CadCx.CxSQL()); cmd = new SqlCommand("pa_preventa_precio_producto", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@p_codProducto", SqlDbType.VarChar, 50).Value = codProducto.Trim(); cmd.Parameters.Add("@p_tipoListaPrecio", SqlDbType.Int).Value = tipoListaPrecio; con.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { if (dr["flag"] != DBNull.Value && Convert.ToInt32(dr["flag"].ToString()) == 0) { obj = new CENPreventaProductoPrecio(); obj.precio = Convert.ToDouble(dr["precioVenta"].ToString()); obj.tipoProducto = Convert.ToInt32(dr["tipoProducto"].ToString()); } //lista.Add(obj); } } catch (Exception ex) { throw ex; } finally { con.Close(); } return(obj); }