Exemplo n.º 1
0
        public static List <CENPreventaPromocionProducto> obtenerPromocionesProducto(CENPreventaPromocionParametro parametro)
        {
            CADPreventa cadPreventa = new CADPreventa();
            List <CENPreventaPromocionProducto> lista = null;

            try
            {
                lista = cadPreventa.obtenerPromocionesProducto(parametro);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lista);
        }
        public List <CENPreventaPromocionProducto> obtenerPromocionesProducto(CENPreventaPromocionParametro parametro)
        {
            SqlConnection con = null;
            SqlCommand    cmd = null;
            SqlDataReader dr  = null;

            CENPreventaPromocionProducto        obj   = null;
            List <CENPreventaPromocionProducto> lista = new List <CENPreventaPromocionProducto>();
            CADConexion CadCx = new CADConexion();

            try
            {
                con             = new SqlConnection(CadCx.CxSQL());
                cmd             = new SqlCommand("pa_preventa_promociones", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@p_codProducto", SqlDbType.VarChar, 50).Value = parametro.codProducto.Trim();
                cmd.Parameters.Add("@p_codCliente", SqlDbType.Int).Value          = parametro.codCliente;
                cmd.Parameters.Add("@p_codUsuario", SqlDbType.Int).Value          = parametro.codUsuario;
                cmd.Parameters.Add("@p_tipoVenta", SqlDbType.Int).Value           = parametro.tipoVenta;
                con.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    obj = new CENPreventaPromocionProducto();
                    obj.ntraPromocion = Convert.ToInt32(dr["ntraPromocion"]);
                    obj.valor         = Convert.ToDouble(dr["valor"]);
                    obj.tipo          = Convert.ToInt32(dr["tipo"]);
                    obj.descPromocion = dr["descPromocion"].ToString();
                    lista.Add(obj);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return(lista);
        }