Exemplo n.º 1
0
        public ClassResultV Usp_GetListaCompraSeleccionada(DtoB dtoBase)
        {
            ClassResultV cr = new ClassResultV();
            DtoListaCompraSeleccionado dto = (DtoListaCompraSeleccionado)dtoBase;
            List <SqlParameter>        pr  = new List <SqlParameter>
            {
                new SqlParameter("@idListaCompra", dto.Criterio),
            };

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(objCn, CommandType.StoredProcedure, "SP_Get_ListaCompra_Seleccionado", pr.ToArray());
                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    dto = new DtoListaCompraSeleccionado
                    {
                        nombreProducto    = getValue("nombreProducto", reader).Value_String,
                        formato           = getValue("formato", reader).Value_String,
                        nombreLaboratorio = getValue("nombreLaboratorio", reader).Value_String,
                        precioCompra      = getValue("precioCompra", reader).Value_Decimal,
                        idProducto        = getValue("idProducto", reader).Value_Int32,
                        idListaCompra     = getValue("idListaCompra", reader).Value_Int32
                    };
                    cr.List.Add(dto);
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar SP_Get_ListaCompra_Seleccionado";
            }
            objCn.Close();
            return(cr);
        }
Exemplo n.º 2
0
 public void CargarProducto()
 {
     try
     {
         DtoListaCompraSeleccionado dtoPedido = new DtoListaCompraSeleccionado()
         {
             Criterio = Session["idListaCompra"].ToString()
         };
         ClassResultV cr = new CtrPedido().Usp_GetListaCompraSeleccionada(dtoPedido);
         if (!cr.HuboError)
         {
             List <DtoListaCompraSeleccionado> list = cr.List.Cast <DtoListaCompraSeleccionado>().ToList();
             ddlProducto.DataSource     = Session["ProductoPedido2"] = list;
             ddlProducto.DataTextField  = "nombreProducto";
             ddlProducto.DataValueField = "idProducto";
             ddlProducto.DataBind();
             ddlProducto.Items.Insert(0, new ListItem("--Seleccionar--", "0"));
         }
     }
     catch (Exception)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "Pop", @"swal('Error!', '" + "No se pudo cargar los pedidos." + "', 'error');", true);
     }
 }