Example #1
0
        public DtoListaCompra Usp_CancelListaCompra(DtoB dtoBase)
        {
            DtoListaCompra dto = (DtoListaCompra)dtoBase;
            ClassResultV   cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[2];
            try
            {
                pr[0] = new SqlParameter("@idListaCompra", SqlDbType.Int)
                {
                    Value = dto.@idListaCompra
                };
                pr[1]           = new SqlParameter("@msj", SqlDbType.Int);
                pr[1].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(objCn, CommandType.StoredProcedure, "SP_Cancel_ListaCompra", pr);
                if (pr[1].Value.ToString() != "")
                {
                    dto.Msj = pr[1].Value.ToString();
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al anular lista de compras";
            }
            objCn.Close();
            return(dto);
        }
Example #2
0
        public void AnularLista(int idListaCompraA)
        {
            DtoListaCompra dtoListaCompra = new DtoListaCompra()
            {
                idListaCompra = idListaCompraA
            };

            DtoListaCompra dto = new CtrListaCompra().Usp_CancelListaCompra(dtoListaCompra);

            if (!dto.HuboError)
            {
                switch (dto.Msj)
                {
                case "1":
                    ScriptManager.RegisterStartupScript(UpdatePanelUsuario, UpdatePanelUsuario.GetType(), "Pop", mensajeConfirmacion("Error", "La lista ya se encuentra anulada.", "error"), true);
                    break;

                case "2":
                    ScriptManager.RegisterStartupScript(UpdatePanelUsuario, UpdatePanelUsuario.GetType(), "Pop", mensajeConfirmacion("Error", "No se puede anular una lista ya ingresada a un pedido.", "error"), true);
                    break;

                case "3":
                    ScriptManager.RegisterStartupScript(UpdatePanelUsuario, UpdatePanelUsuario.GetType(), "Pop", mensajeConfirmacion("Exito", "Se elimino la lista correctamente.", "success"), true);
                    break;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanelUsuario, UpdatePanelUsuario.GetType(), "Pop", mensajeConfirmacion("Error!", "No se puede eliminar la Lista", "error"), true);
            }
        }
Example #3
0
        public ClassResultV Usp_GetAllListaCompra(DtoB dtoBase)
        {
            ClassResultV        cr  = new ClassResultV();
            DtoListaCompra      dto = (DtoListaCompra)dtoBase;
            List <SqlParameter> pr  = new List <SqlParameter>
            {
                new SqlParameter("@Id", dto.Criterio),
                new SqlParameter("@NomUsuario", dto.NomUsuario)
                //new SqlParameter("@tienda", dto.Tienda),
                //new SqlParameter("@tipo", dto.TipoMovimiento),
                //new SqlParameter("@estado", dto.IB_Estado)
            };

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(objCn, CommandType.StoredProcedure, "SP_Get_ListaCompras", pr.ToArray());
                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    dto = new DtoListaCompra
                    {
                        idListaCompra = getValue("idListaCompra", reader).Value_Int32,
                        correlativo   = getValue("correlativo", reader).Value_String,
                        NombreEstado  = getValue("NombreEstado", reader).Value_String,
                        fecha         = getValue("fecha", reader).Value_DateTime,
                        NomUsuario    = getValue("NomUsuario", reader).Value_String
                    };
                    cr.List.Add(dto);
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar SP_Get_ListaCompras";
            }
            objCn.Close();
            return(cr);
        }
Example #4
0
        public void CargarGrilla()
        {
            try
            {
                DtoListaCompra dtoListaCompra = new DtoListaCompra()
                {
                    Criterio   = tCodigo.Text,
                    NomUsuario = tQuimico.Text
                };
                ClassResultV cr = new CtrListaCompra().Usp_GetAllListaCompra(dtoListaCompra);
                if (!cr.HuboError)
                {
                    List <DtoListaCompra> list = cr.List.Cast <DtoListaCompra>().ToList();

                    gvLista.DataSource = list;
                    gvLista.DataBind();
                }
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(UpdatePanelUsuario, UpdatePanelUsuario.GetType(), "script", "verAlerta('No se pudo cargar las ordenes de compra.');", true);
            }
        }