예제 #1
0
        protected void btnPedir_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                SDSPedido.InsertParameters["IdArticulo"].DefaultValue = Request["IdArticulo"].ToString();
                SDSPedido.InsertParameters["Talla"].DefaultValue      = Request["Talla"].ToString();
                SDSPedido.InsertParameters["Unidades"].DefaultValue   = this.txtUnidades.Text;
                SDSPedido.InsertParameters["Precio"].DefaultValue     = lblPrecio.Text;
                SDSPedido.InsertParameters["Usuario"].DefaultValue    = Contexto.Usuario;
                SDSPedido.InsertParameters["IdEmpleado"].DefaultValue = Contexto.IdEmpleado;
                SDSPedido.InsertParameters["IdTienda"].DefaultValue   = Request["IdTienda"].ToString();
                SDSPedido.InsertParameters["Stock"].DefaultValue      = Request["Stock"].ToString();

                string script;
                if (SDSPedido.Insert() > 0)
                {
                    script = "alert('" + (Request["IdTienda"] == Contexto.IdTienda ? Resource.SolicitudPedidoRegistrado : Resource.CargoSolicitudRegistrado) + " ' + idPedido);" +
                             "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.Inicio) + "';";

                    HttpContext.Current.Session[Constantes.Session.FechaUltimoPedido] = DateTime.Now.AddSeconds(5);
                }
                else
                {
                    script = "alert('" + Resource.ErrorPeticion + "');";
                }

                ClientScript.RegisterStartupScript(typeof(string), "", script, true);
            }
        }
예제 #2
0
    protected void GenerarSolicitud()
    {
        DataView dv;
        String   TipoNegado         = "0";
        String   script             = String.Empty;
        String   TallasOtras        = String.Empty;
        String   TallaMensaje       = String.Empty;
        String   TiendaSeleccionada = String.Empty;
        String   strDescripcion     = "Par Negado en Tienda";



        dv = (DataView)AVE_StockEnTiendaObtener.Select(new DataSourceSelectArguments());


        dv.RowFilter = "idArticulo=" + Request.QueryString[Constantes.QueryString.IdArticulo].ToString() + " and Talla='" + Request.QueryString["Talla"].ToString() + "' and cantidad>0  and idTienda='" + Request.QueryString["idTienda"].ToString() + "'";

        if (dv.Count > 0)
        {
            SDSPedido.InsertParameters["IdArticulo"].DefaultValue = Request["IdArticulo"].ToString();
            SDSPedido.InsertParameters["Talla"].DefaultValue      = Request.QueryString["Talla"].ToString();
            SDSPedido.InsertParameters["Unidades"].DefaultValue   = "1";
            SDSPedido.InsertParameters["Precio"].DefaultValue     = hiddenTallas.Value.ToString();
            SDSPedido.InsertParameters["Usuario"].DefaultValue    = Contexto.Usuario;
            SDSPedido.InsertParameters["IdEmpleado"].DefaultValue = Contexto.IdEmpleado;
            SDSPedido.InsertParameters["IdTienda"].DefaultValue   = Request.QueryString["idTienda"].ToString();
            SDSPedido.InsertParameters["Stock"].DefaultValue      = dv[0]["Cantidad"].ToString();


            if (SDSPedido.Insert() > 0)
            {
                if (Contexto.IdTienda == Request.QueryString["idTienda"].ToString())
                {
                    script += "Solicitud a Bodega con el Nº" + IdPedido.ToString() + ".";
                    script  = "alert('" + script + "');";
                    script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                    // HttpContext.Current.Session[Constantes.Session.FechaUltimoPedido] = DateTime.Now.AddSeconds(5);
                }
                else
                {
                    TipoNegado = "0";
                    //pares negados
                    Comun.InsertarProductoNegado(Request["IdArticulo"].ToString(), Request.QueryString["Talla"].ToString(), "Par Negado en Tienda", ref TipoNegado, TiendaSeleccionada);
                    if (TipoNegado == "1")
                    {
                        script  = "Solicitud de Traspaso con el Nº " + IdPedido.ToString() + " en la tienda " + Request.QueryString["idTienda"].ToString() + ".";
                        script += " Par Negado en Tienda de la talla " + Request.QueryString["Talla"].ToString() + ".";
                    }


                    script  = "alert('" + script + "');";
                    script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                    HttpContext.Current.Session[Constantes.Session.FechaUltimoPedido] = DateTime.Now.AddSeconds(5);
                }
            }
        }
        else
        {
            TipoNegado = "0";
            //pares negados
            if (Contexto.IdTienda != Request.QueryString["idTienda"].ToString() && Request.QueryString["Stock"].ToString().Equals("-"))
            {
                dv.RowFilter = "idArticulo=" + Request.QueryString[Constantes.QueryString.IdArticulo].ToString() + " and Talla='" + Request.QueryString["Talla"].ToString() + "' and cantidad>0  and idTienda='" + Contexto.IdTienda + "'";

                if (dv.Count > 0)
                {
                    script += " No se tienen existencias en la talla seleccionada, en la Tienda foránea " + Request.QueryString["idTienda"].ToString();
                    script  = "alert('" + script + "');";
                    script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                }
                else
                {
                    Comun.InsertarProductoNegado(Request["IdArticulo"].ToString(), Request.QueryString["Talla"].ToString(), strDescripcion, ref TipoNegado, TiendaSeleccionada);

                    if (TipoNegado == "2")
                    {
                        script += " Par Negado en todas las Tiendas de la talla " + Request.QueryString["Talla"].ToString() + ".";
                        script  = "alert('" + script + "');";
                        script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                    }
                    else
                    {
                        script += " Par Negado en Tienda de la talla  " + Request.QueryString["Talla"].ToString() + ".";
                        script  = "alert('" + script + "');";
                        script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                    }
                }
            }
            else
            {
                Comun.InsertarProductoNegado(Request["IdArticulo"].ToString(), Request.QueryString["Talla"].ToString(), strDescripcion, ref TipoNegado, TiendaSeleccionada);

                if (TipoNegado == "2")
                {
                    script += " Par Negado en todas las Tiendas de la talla " + Request.QueryString["Talla"].ToString() + ".";
                    script  = "alert('" + script + "');";
                    script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                }
                else
                {
                    script += " Par Negado en Tienda de la talla  " + Request.QueryString["Talla"].ToString() + ".";
                    script  = "alert('" + script + "');";
                    script += "document.location.href = '" + ResolveClientUrl(Constantes.Paginas.StockEnTienda + "?Talla=&IdArticulo=" + Request["IdArticulo"].ToString()) + "';";
                }
            }
        }



        ClientScript.RegisterStartupScript(typeof(string), "", script, true);
        hiddenTallas.Value   = String.Empty;
        hiddenTallasNo.Value = String.Empty;
    }