Пример #1
0
    protected void GV_Pedido_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Asignaciones row = new Asignaciones();

        Session["idPed"]      = Convert.ToString(e.CommandArgument);
        Session["sedePedido"] = row.Sede();
        GV_Pedidos.DataSource = row.Row_Command(e.CommandName.ToString(), e.CommandArgument.ToString());
        GV_Pedidos.DataBind();
    }
Пример #2
0
    protected void Button2_Click1(object sender, EventArgs e)
    {
        Asignaciones ingresar = new Asignaciones();

        ingresar.ingresarBD(Session["asignacion2"] as List <Asignacion>, Convert.ToInt32(Session["idproducto"]), Convert.ToInt32(Session["entregado"]));
#pragma warning disable CS0618 // Type or member is obsolete
        RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('" + ingresar.Devuelve_Mensaje() + "');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
        GV_Pedido.DataBind();
        GV_Pedidos.DataBind();
        GV_ProductosBodega.DataBind();
    }
Пример #3
0
    protected void B_Reasignar_Click(object sender, EventArgs e)
    {
        int cantBodega, cont = 0;

        foreach (GridViewRow row in GV_Pedidos.Rows)
        {
            cont++;
            DateTime   fechaHoy = DateTime.Now;
            Asignacion a        = new Asignacion();
            DAOUsuario d        = new DAOUsuario();
            a.Referencia = Convert.ToString(((Label)row.Cells[0].FindControl("L_Referencia")).Text);
            a.Talla      = Convert.ToDouble(((Label)row.Cells[1].FindControl("L_Talla")).Text);
            a.Cantidad   = Convert.ToInt32(((Label)row.Cells[2].FindControl("L_Cantidad")).Text);
            a.Fecha      = fechaHoy.ToString("d");
            a.Estado     = false;
            a.Sede       = Convert.ToString(Session["asig"]);

            DataTable r = d.validarAsignacion(a.Referencia, a.Talla);
            if (r.Rows.Count == 1)
            {
                if (cont == 1)
                {
                    d.crearAsignacion(a);
                }
                foreach (DataRow fi in r.Rows)
                {
                    Producto producto = new Producto();
                    cantBodega          = Convert.ToInt32(fi["cantidad"]);
                    producto.Entregado  = Convert.ToInt32(fi["entregado"]);
                    producto.Idproducto = Convert.ToInt32(fi["idproducto"]);
                    cantBodega          = cantBodega - producto.Entregado;

                    if (a.Cantidad < cantBodega)
                    {
                        this.idpedido2();
                        d.crearAsignaciones(a, Convert.ToInt32(Session["idpedidod"]));
                        d.editarCantidad(Convert.ToInt32(Session["idproducto2"]), (a.Cantidad + producto.Entregado));
                        d.actualizarPedido(false, Convert.ToInt32(Session["idPed2"]));
                    }
                    else
                    {
#pragma warning disable CS0618 // Type or member is obsolete
                        RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('No hay productos suficientes de la referencia " + a.Referencia + " y Talla " + a.Talla + ". Hay " + cantBodega + " producto(s) en bodega.');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                        return;
                    }
                }
            }
        }
        GV_Pedido.DataBind();
        GV_Pedidos.DataBind();
    }
    protected async void Page_Load(object sender, EventArgs e)
    {
        UEncapUsuario user       = JsonConvert.DeserializeObject <UEncapUsuario>(Request.Cookies["cookie"].Value);
        string        url        = "http://18.224.240.8/api/Admin/ConsultarPedidos";
        var           HttpClient = new HttpClient();

        HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", user.Token);
        var json = await HttpClient.GetStringAsync(url);

        List <UEncapPedido> lista = JsonConvert.DeserializeObject <List <UEncapPedido> >(json);

        GV_Pedidos.DataSource = lista;
        GV_Pedidos.DataBind();
    }
Пример #5
0
 protected void GV_Pedido_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Select"))
     {
         DAOUsuario dao   = new DAOUsuario();
         DataTable  data  = new DataTable();
         DataTable  datat = new DataTable();
         datat = dao.verPedido(Convert.ToInt32(e.CommandArgument));
         data  = dao.verPedidos(Convert.ToInt32(e.CommandArgument));
         TB_Observacion.Text   = dao.traerObservacion(Convert.ToInt32(e.CommandArgument));
         Session["idPed2"]     = e.CommandArgument;
         Session["asig"]       = datat.Rows[0]["sede"];
         GV_Pedidos.DataSource = data;
         GV_Pedidos.DataBind();
     }
 }
Пример #6
0
 protected void GV_Pedido_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Select"))
     {
         DAOUsuario dAO     = new DAOUsuario();
         DataTable  detalle = new DataTable();
         DataTable  ped     = new DataTable();
         ped              = dAO.verPedido(Convert.ToInt32(e.CommandArgument));
         detalle          = dAO.verPedidos(Convert.ToInt32(e.CommandArgument));
         Session["idPed"] = Convert.ToString(e.CommandArgument);
         string sed = Convert.ToString(ped.Rows[0]["sede"]);
         Session["sedePedido"] = ped.Rows[0]["sede"];
         GV_Pedidos.DataSource = detalle;
         GV_Pedidos.DataBind();
     }
 }
Пример #7
0
    void ingresarBD()
    {
        DAOUsuario d = new DAOUsuario();

        listaAsignacion2 = (Session["asignacion2"] as List <Asignacion>);

        int cont = 0;

        if (listaAsignacion2.Count > 0)
        {
            foreach (Asignacion a in listaAsignacion2)
            {
                cont++;
                if (cont == 1)
                {
                    d.crearAsignacion(a);
                }
                DataTable id = new DataTable();
                id = d.verUltimoId2();
                if (id.Rows.Count > 0)
                {
                    foreach (DataRow ff in id.Rows)
                    {
                        Session["idpedido"] = Convert.ToInt32(ff["f_verultimoid2"]);
                    }

                    d.crearAsignaciones(a, Convert.ToInt32(Session["idpedido"]));
                    d.editarCantidad(Convert.ToInt32(Session["idproducto"]), (a.Cantidad + Convert.ToInt32(Session["entregado"])));
                    d.actualizarPedido(true, Convert.ToInt32(Session["idPed"]));
#pragma warning disable CS0618 // Type or member is obsolete
                    RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Base de Datos actualizada. Asignación completada.');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                }
            }
            GV_Pedido.DataBind();
            GV_Pedidos.DataBind();
            GV_ProductosBodega.DataBind();
        }
        else
        {
#pragma warning disable CS0618 // Type or member is obsolete
            RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('No hay una lista llena para enviar.');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
        }
    }
Пример #8
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Asignaciones validar = new Asignaciones();

        foreach (GridViewRow row in GV_Pedidos.Rows)
        {
            validar.Asignar(Convert.ToString(((Label)row.Cells[0].FindControl("L_Referencia")).Text), Convert.ToDouble(((Label)row.Cells[1].FindControl("L_Talla")).Text), Convert.ToInt32(((Label)row.Cells[2].FindControl("L_Cantidad")).Text), GV_Pedidos.Rows.Count, (Session["asignacion2"] as List <Asignacion>), Convert.ToString(Session["sedePedido"]));
            Session["entregado"]   = validar.GetEntregado();
            Session["asignacion2"] = validar.GetPedidos();
            Session["idproducto"]  = validar.GetId();
#pragma warning disable CS0618 // Type or member is obsolete
            RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('" + validar.Devuelve_Mensaje() + "');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
        }
        Button2.Enabled = validar.GeT_Estado();
        Button3.Enabled = !validar.GeT_Estado();
        GV_Pedido.DataBind();
        GV_Pedidos.DataBind();
        GV_ProductosBodega.DataBind();
    }
Пример #9
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        DAOUsuario d        = new DAOUsuario();
        Producto   producto = new Producto();
        Pedido     pedido   = new Pedido();

        Session["asignacion2"] = null;
        int cantBodega = 0;
        int idPedi     = Convert.ToInt32(Session["idPed"]);
        int cont       = 0;

        if (GV_Pedidos.Rows.Count > 0)
        {
            foreach (GridViewRow row in GV_Pedidos.Rows)
            {
                Asignacion asignacion = new Asignacion();
                cont++;
                asignacion.Referencia = Convert.ToString(((Label)row.Cells[0].FindControl("L_Referencia")).Text);
                asignacion.Talla      = Convert.ToDouble(((Label)row.Cells[1].FindControl("L_Talla")).Text);
                asignacion.Cantidad   = Convert.ToInt32(((Label)row.Cells[2].FindControl("L_Cantidad")).Text);

                DataTable r = d.validarAsignacion(asignacion.Referencia, asignacion.Talla);

                if (r.Rows.Count == 1)
                {
                    foreach (DataRow ro in r.Rows)
                    {
                        cantBodega            = Convert.ToInt32(ro["cantidad"]);
                        producto.Entregado    = Convert.ToInt32(ro["entregado"]);
                        Session["entregado"]  = producto.Entregado;
                        producto.Idproducto   = Convert.ToInt32(ro["idproducto"]);
                        Session["idproducto"] = producto.Idproducto;
                        cantBodega            = cantBodega - producto.Entregado;
                    }
                    if (asignacion.Cantidad < cantBodega)
                    {
                        Response.Write("esto da" + (cantBodega - asignacion.Cantidad));
                        if ((cantBodega - asignacion.Cantidad) >= 5)
                        {
                            DateTime fechaHoy = DateTime.Now;
                            asignacion.Fecha  = fechaHoy.ToString("d");
                            asignacion.Estado = false;
                            asignacion.Sede   = Convert.ToString(Session["sedePedido"]);

                            if (Session["asignacion2"] == null)
                            {
                                listaAsignacion2 = new List <Asignacion>();
                                listaAsignacion2.Add(asignacion);
                                Session["asignacion2"] = listaAsignacion2;
                            }
                            else
                            {
                                listaAsignacion2 = (Session["asignacion2"] as List <Asignacion>);
                                listaAsignacion2.Add(asignacion);
                                Session["asignacion2"] = listaAsignacion2;
                            }
                        }
                        else
                        {
#pragma warning disable CS0618 // Type or member is obsolete

                            RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('En la sede principal deben quedar al menos 5 productos. Revise el producto Referencia:" + asignacion.Referencia + " y talla " + asignacion.Talla + "');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                            return;
                        }
                    }
                    else
                    {
#pragma warning disable CS0618 // Type or member is obsolete
                        RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('La cantidad de productos a asignar debe ser menor a la que esta en bodega. ');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                        return;
                    }
                }

                else
                {
#pragma warning disable CS0618 // Type or member is obsolete
                    RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('No hay productos con esta descripción en la bodega validar. ');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
                    return;
                }
            }
#pragma warning disable CS0618 // Type or member is obsolete
            RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('El pedido esta listo para ser enviado.');</script>");
#pragma warning restore CS0618 // Type or member is obsolete
        }
        if (Session["asignacion2"].Equals(null) == false)
        {
            Button2.Enabled = true;
            Button3.Enabled = false;
        }

        GV_Pedido.DataBind();
        GV_Pedidos.DataBind();
        GV_ProductosBodega.DataBind();
    }