// PUT: api/Sala/5
 public bool Put(int id, [FromBody] DirDireccion _DirDireccion)
 {
     try
     {
         using (var dcTemp = new PaslumBaseDatoDataContext())
         {
             var result = dcTemp.GetTable <TblDireccion>().Where(c => c.id == id).FirstOrDefault();
             if (result != null)
             {
                 result.strcalle       = _DirDireccion.strCalle;
                 result.strcolonia     = _DirDireccion.strColonia;
                 result.intcodpost     = _DirDireccion.intCp;
                 result.strestado      = _DirDireccion.strEst;
                 result.strmunicipio   = _DirDireccion.strMun;
                 result.strnumExt      = _DirDireccion.strNoExt;
                 result.strnumInt      = _DirDireccion.strNoInt;
                 result.strreferencias = _DirDireccion.strRef;
                 dcTemp.SubmitChanges();
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception _e)
     {
         //Informar error por correo.
         return(false);
     }
 }
 // PUT: api/Sala/5
 public bool Put(int id, [FromBody]TelTelefono _TelTelefono)
 {
     try
     {
         using (var dcTemp = new PaslumBaseDatoDataContext())
         {
             var result = dcTemp.GetTable<TblTelefono>().Where(c => c.id == id).FirstOrDefault();
             if (result != null)
             {
                 result.strcelular = _TelTelefono.strCelular;
                 result.strtelCasa = _TelTelefono.strTelCasa;
                 result.strotro = _TelTelefono.strOtro;
                 dcTemp.SubmitChanges();
                 //ediater
             }
             else
             {
                 return false;
             }
         }
         return true;
     }
     catch (Exception _e)
     {
         //Informar error por correo.
         return false;
     }
 }
 // POST: api/Sala
 public bool Post([FromBody] DirDireccion _DirDireccion)
 {
     try
     {
         using (var dcTemp = new PaslumBaseDatoDataContext())
         {
             var objTemp = new TblDireccion();
             objTemp.strcalle       = _DirDireccion.strCalle;
             objTemp.strcolonia     = _DirDireccion.strColonia;
             objTemp.strestado      = _DirDireccion.strEst;
             objTemp.strmunicipio   = _DirDireccion.strMun;
             objTemp.intcodpost     = _DirDireccion.intCp;
             objTemp.strnumExt      = _DirDireccion.strNoExt;
             objTemp.strnumInt      = _DirDireccion.strNoInt;
             objTemp.strreferencias = _DirDireccion.strRef;
             dcTemp.GetTable <TblDireccion>().InsertOnSubmit(objTemp);
             dcTemp.SubmitChanges();
             return(true);
         }
     }
     catch (Exception _e)
     {
         return(false);
     }
 }
 public bool Put(int id, [FromBody] Alumno _Alumno)
 {
     try
     {
         using (var dcTemp = new PaslumBaseDatoDataContext())
         {
             var result = dcTemp.GetTable <TblAlumno>().Where(c => c.id == id).FirstOrDefault();
             if (result != null)
             {
                 result.strCorreo = _Alumno.correo;
                 dcTemp.SubmitChanges();
                 //ediater
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception _e)
     {
         //Informar error por correo.
         return(false);
     }
 }
Esempio n. 5
0
        public bool InsertarAlmacen(tblAlmacen _TBL_Alm)
        {
            bool respuesta = false;

            try
            {
                contexto.tblAlmacen.InsertOnSubmit(_TBL_Alm);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
        public bool InsertarProducto(tblProducto _TBL_Prod)
        {
            bool respuesta = false;

            try
            {
                contexto.tblProducto.InsertOnSubmit(_TBL_Prod);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            var               almacen    = ddlAlmacen.SelectedItem.Value;
            var               producto   = ddlProducto.SelectedItem.Value;
            var               movimiento = ddlMovimiento.SelectedItem.Value;
            DateTime          fechact    = DateTime.Now;
            ControllerAlmacen ctrlAlm    = new ControllerAlmacen();
            CultureInfo       culture    = new CultureInfo("en-US");

            var cantidadExistente = (from existe in contexto.tblStock
                                     where existe.fkProducto == Int32.Parse(producto)
                                     select existe);

            var actualizar = 1;

            foreach (tblStock ord in cantidadExistente)
            {
                actualizar += 1;
                var suma = decimal.Parse(txtCantidad.Text, culture) + ord.dblCantidad;

                tblMovimiento mov = new tblMovimiento();
                mov.strTipo    = movimiento;
                mov.fecha      = fechact;
                mov.dblValAnt  = ord.dblCantidad;
                mov.dblValNvo  = suma;
                mov.fkStock    = ord.idStock;
                mov.fkEmpleado = Int32.Parse(lbEmpleado.Text);

                ord.dblCantidad = suma;

                ctrlAlm.InsertarMovimientoAlmacen(mov);
                contexto.SubmitChanges();
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                this.LimpiarCampos();
            }
            if (actualizar == 1)
            {
                tblStock stock = new tblStock();
                stock.dblCantidad = decimal.Parse(txtCantidad.Text, culture);
                stock.fkProducto  = Int32.Parse(producto);
                ctrlAlm.InsertarEntradaAlmacen(stock);

                tblMovimiento mov = new tblMovimiento();
                mov.strTipo    = movimiento;
                mov.fecha      = fechact;
                mov.dblValAnt  = 0;
                mov.dblValNvo  = Int32.Parse(txtCantidad.Text);
                mov.fkStock    = stock.idStock;
                mov.fkEmpleado = Int32.Parse(lbEmpleado.Text);

                ctrlAlm.InsertarMovimientoAlmacen(mov);
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                this.LimpiarCampos();
            }
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            var               almacen    = ddlAlmacen.SelectedItem.Value;
            var               producto   = ddlProducto.SelectedItem.Value;
            var               movimiento = ddlMovimiento.SelectedItem.Value;
            DateTime          fechact    = DateTime.Now;
            ControllerAlmacen ctrlAlm    = new ControllerAlmacen();
            CultureInfo       culture    = new CultureInfo("en-US");

            var cantidadExistente = (from existe in contexto.tblStock
                                     where existe.fkProducto == Int32.Parse(producto)
                                     select existe);

            var existente = (from existe in contexto.tblStock
                             where existe.fkProducto == Int32.Parse(producto)
                             select existe).FirstOrDefault();


            if (existente == null)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "fallo()", true);
            }
            else
            {
                foreach (tblStock ord in cantidadExistente)
                {
                    var resta = ord.dblCantidad - decimal.Parse(txtCantidad.Text, culture);

                    if (resta >= 0)
                    {
                        tblMovimiento mov = new tblMovimiento();
                        mov.strTipo    = movimiento;
                        mov.fecha      = fechact;
                        mov.dblValAnt  = ord.dblCantidad;
                        mov.dblValNvo  = resta;
                        mov.fkStock    = ord.idStock;
                        mov.fkEmpleado = Int32.Parse(lbEmpleado.Text);
                        mov.strNumVen  = txtOrdenCompra.Text;
                        mov.strFactura = txtFactura.Text;

                        ctrlAlm.InsertarMovimientoAlmacen(mov);
                        ord.dblCantidad = resta;
                        contexto.SubmitChanges();
                        this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                        this.LimpiarCampos();
                    }
                    else
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "alerta()", true);
                    }
                }
            }
        }
Esempio n. 9
0
        public bool InsertarQr(TblQR _TBL_QR)
        {
            bool respuesta = false;

            try
            {
                contexto.TblQR.InsertOnSubmit(_TBL_QR);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
Esempio n. 10
0
        public bool InsertarAsignacionGrupo(TblAsignacionGrupo _TBL_AsigGrupo)
        {
            bool respuesta = false;

            try
            {
                contexto.TblAsignacionGrupo.InsertOnSubmit(_TBL_AsigGrupo);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
Esempio n. 11
0
        public bool InsertarEvaluacion(TblCatalogoEvaluacion _TBL_Evaluacion)
        {
            bool respuesta = false;

            try
            {
                contexto.TblCatalogoEvaluacion.InsertOnSubmit(_TBL_Evaluacion);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
        public bool InsertarParcial(TblCatalogoParcial _TBL_Parcial)
        {
            bool respuesta = false;

            try
            {
                contexto.TblCatalogoParcial.InsertOnSubmit(_TBL_Parcial);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
Esempio n. 13
0
        public bool InsertarUnidadMedida(tblUnidadMedida _TBL_UniMedida)
        {
            bool respuesta = false;

            try
            {
                contexto.tblUnidadMedida.InsertOnSubmit(_TBL_UniMedida);
                contexto.SubmitChanges();
                respuesta = true;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                respuesta = false;
            }
            return(respuesta);
        }
 // POST: api/Sala
 public bool Post([FromBody]TelTelefono _TelTelefono)
 {
     try
     {
         using (var dcTemp = new PaslumBaseDatoDataContext())
         {
             var objTemp = new TblTelefono();
             objTemp.strcelular = _TelTelefono.strCelular;
             objTemp.strtelCasa = _TelTelefono.strTelCasa;
             objTemp.strotro = _TelTelefono.strOtro;
             dcTemp.GetTable<TblTelefono>().InsertOnSubmit(objTemp);
             dcTemp.SubmitChanges();
             return true;
         }
     }
     catch (Exception _e)
     {
         return false;
     }
 }
Esempio n. 15
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            DateTime          fechact = DateTime.Now;
            ControllerCliente ctrlCli = new ControllerCliente();
            CultureInfo       culture = new CultureInfo("en-US");

            tblOrdenCompra ord = new tblOrdenCompra();

            ord.Fecha          = fechact;
            ord.strNumOrden    = null;
            ord.strLugar       = txtEntregar.Text;
            ord.strCantidad    = txtCantidad.Text;
            ord.strProducto    = txtProducto.Text;
            ord.strDescripcion = txtDescripcion.Text;
            ord.strConfirmo    = txtConfirmo.Text;
            ord.fechaEntrega   = Convert.ToDateTime(calEntregas.Text);;
            ord.fkEmpleado     = int.Parse(Session["id"].ToString());
            ord.fkProveedor    = Convert.ToInt32(ddlProveedor.SelectedValue);

            //Si no tiene iva ni descuento entra aqui
            if (string.IsNullOrWhiteSpace(txtIVA.Text) == true && (string.IsNullOrWhiteSpace(txtDescuento.Text)) == true)
            {
                ord.dblCostoUnitario = (decimal.Parse(txtCostoUni.Text, culture));
                ord.dblImporte       = (decimal.Parse(txtImporte.Text, culture));
                ord.dblTotal         = decimal.Parse(txtImporte.Text, culture);
            }

            else if (string.IsNullOrWhiteSpace(txtIVA.Text) == false && (string.IsNullOrWhiteSpace(txtDescuento.Text)) == false)
            {
                var Descuen     = (decimal.Parse(txtImporte.Text, culture) - decimal.Parse(txtDescuento.Text, culture));
                var iva         = (Descuen * int.Parse(txtIVA.Text) / 100);
                var TotalInicio = (Descuen + iva);


                ord.dblCostoUnitario = (decimal.Parse(txtCostoUni.Text, culture));
                ord.dblDescuento     = decimal.Parse(txtDescuento.Text, culture);
                ord.dblDescuentoFin  = Descuen;
                ord.intIva           = int.Parse(txtIVA.Text);
                ord.dblImporte       = (decimal.Parse(txtImporte.Text, culture));
                ord.dblTotal         = TotalInicio;
            }

            else
            {
                if (string.IsNullOrWhiteSpace(txtDescuento.Text))
                {
                    ord.dblDescuento = null;
                }
                //si tiene descuento cae aqui
                else
                {
                    var Descuen = (decimal.Parse(txtImporte.Text, culture) - decimal.Parse(txtDescuento.Text, culture));

                    ord.dblCostoUnitario = decimal.Parse(txtCostoUni.Text, culture);
                    ord.dblDescuento     = decimal.Parse(txtDescuento.Text, culture);
                    ord.dblDescuentoFin  = Descuen;
                    ord.dblImporte       = (decimal.Parse(txtImporte.Text, culture));
                    ord.dblTotal         = Descuen;
                }

                if (string.IsNullOrWhiteSpace(txtIVA.Text))
                {
                    ord.intIva = null;
                }
                //si tiene IVA cae aqui
                else
                {
                    var iva         = ((decimal.Parse(txtImporte.Text, culture) * int.Parse(txtIVA.Text)) / 100);
                    var TotalInicio = (decimal.Parse(txtImporte.Text, culture) + iva);

                    ord.intIva           = int.Parse(txtIVA.Text);
                    ord.dblCostoUnitario = (decimal.Parse(txtCostoUni.Text, culture));
                    ord.dblImporte       = (decimal.Parse(txtImporte.Text, culture));
                    ord.dblTotal         = TotalInicio;
                }
            }

            ctrlCli.InsertarOrdenCompra(ord);
            contexto.SubmitChanges();

            this.Response.Redirect("./AlertaExito2.aspx", true);
        }
Esempio n. 16
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            var         vacio   = 0.0000;
            CultureInfo culture = new CultureInfo("en-US");

            this.Calcular();

            //Advertencia si el campo no se a calculado correctamente
            if (double.Parse(lblTotal2.Text) == vacio)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "fallo()", true);
                this.Calcular();
            }

            //Advertencia si hay campos vacios de dinero, hora y fecha.
            else if (string.IsNullOrWhiteSpace(txtDinero.Text) ||
                     string.IsNullOrWhiteSpace(txtHora.Text) ||
                     string.IsNullOrWhiteSpace(fechaEntrega.Text))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "vacio()", true);
                this.Calcular();
            }

            //Advertencia si el dinero no es el suficiente para liquidar la cuenta
            else if (double.Parse(txtDinero.Text, culture) >= double.Parse(lblTotal2.Text, culture))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "fallo()", true);
                this.Calcular();
            }


            else
            {
                DateTime          fechact = DateTime.Now;
                ControllerCliente ctrlCli = new ControllerCliente();
                var      CanStock         = 0;
                tblVenta ven     = new tblVenta();
                var      ExStock = 0;

                //Si cae en que el cliente es mostrador significa que la venta
                //se esta realizando al momento y eso va a afectar en el descuento del inventario
                if ((Session["cliente"].ToString() == "MOSTRADOR"))
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        var existente = (from existe in contexto.tblStock
                                         where existe.fkProducto == int.Parse(row.Cells[1].Text)
                                         select existe).FirstOrDefault();

                        var cantidadExistente = (from existe in contexto.tblStock
                                                 where existe.fkProducto == int.Parse(row.Cells[1].Text)
                                                 select existe);

                        //Si cae aqui significa que no hay un historial en stock
                        if (existente == null)
                        {
                            CanStock++;
                        }
                        else
                        {
                            foreach (tblStock ord in cantidadExistente)
                            {
                                //Aqui se hace la resta de la catidad solicitada menos lo que esxita en stock
                                var resta = ord.dblCantidad - int.Parse(((TextBox)row.Cells[3].FindControl("TextBox1")).Text);

                                if (resta >= 0)
                                {
                                }
                                else
                                {
                                    ExStock++;
                                }
                            }
                        }
                    }
                    //Alertas en caso de que haya caido en las validaciones anteriores
                    if (CanStock > 0)
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "falloCantidad()", true);
                    }
                    //Alertas en caso de que haya caido en las validaciones anteriores
                    else if (ExStock > 0)
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "alerta()", true);
                    }

                    else
                    {
                        ven.Fecha    = fechact;
                        ven.dblTotal = decimal.Parse(lblTotal2.Text, culture);
                        //ven.dblSubTotal = decimal.Parse(lblSubTotal.Text);
                        //ven.dblIGV = decimal.Parse(lblIGV.Text);
                        ven.strEstado      = "FINALIZADO";
                        ven.dblAbono       = decimal.Parse(txtDinero.Text, culture);;
                        ven.dblInteres     = null;
                        ven.strFechaEntega = fechaEntrega.Text;
                        ven.strHoraEntega  = txtHora.Text;
                        ven.fkCliente      = null;
                        ctrlCli.InsertarVenta(ven);

                        foreach (GridViewRow row in GridView1.Rows)
                        {
                            var cantidadExistente = (from existe in contexto.tblStock
                                                     where existe.fkProducto == int.Parse(row.Cells[1].Text)
                                                     select existe);

                            foreach (tblStock ord in cantidadExistente)
                            {
                                var resta = ord.dblCantidad - int.Parse(((TextBox)row.Cells[3].FindControl("TextBox1")).Text);

                                ControllerAlmacen ctrlAlm = new ControllerAlmacen();
                                tblMovimiento     mov     = new tblMovimiento();
                                mov.strTipo    = "VENTA NUMERO " + ven.idVenta;
                                mov.fecha      = fechact;
                                mov.dblValAnt  = ord.dblCantidad;
                                mov.dblValNvo  = resta;
                                mov.fkStock    = ord.idStock;
                                mov.fkEmpleado = Int32.Parse(Session["id"].ToString());
                                mov.strNumVen  = ven.idVenta.ToString();
                                mov.strFactura = "";

                                ctrlAlm.InsertarMovimientoAlmacen(mov);
                                ord.dblCantidad = resta;
                                contexto.SubmitChanges();
                            }


                            ControllerCliente ctrlClie = new ControllerCliente();
                            tblDetalleVenta   detalle  = new tblDetalleVenta();
                            detalle.Fecha       = fechact;
                            detalle.intCantidad = int.Parse(((TextBox)row.Cells[3].FindControl("TextBox1")).Text);
                            detalle.fkProducto  = int.Parse(row.Cells[1].Text);
                            detalle.dblPrecio   = decimal.Parse(((TextBox)row.Cells[4].FindControl("TextBox2")).Text, culture);
                            detalle.fkVenta     = ven.idVenta;
                            detalle.fkEmpleado  = int.Parse(Session["id"].ToString());
                            ctrlClie.InsertarDetalle(detalle);
                        }
                        Session["contado"] = null;
                        this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                    }
                }
                else
                {
                    ven.Fecha    = fechact;
                    ven.dblTotal = decimal.Parse(lblTotal2.Text);
                    //ven.dblSubTotal = decimal.Parse(lblSubTotal.Text);
                    //ven.dblIGV = decimal.Parse(lblIGV.Text);
                    ven.strEstado      = "PENDIENTE";
                    ven.dblAbono       = decimal.Parse(txtDinero.Text, culture);;
                    ven.dblInteres     = null;
                    ven.strFechaEntega = fechaEntrega.Text;
                    ven.strHoraEntega  = txtHora.Text;
                    ven.fkCliente      = int.Parse(Session["cliente"].ToString());
                    ctrlCli.InsertarVenta(ven);

                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        ControllerCliente ctrlClie = new ControllerCliente();
                        tblDetalleVenta   detalle  = new tblDetalleVenta();
                        detalle.Fecha       = fechact;
                        detalle.intCantidad = int.Parse(((TextBox)row.Cells[3].FindControl("TextBox1")).Text);
                        detalle.fkProducto  = int.Parse(row.Cells[1].Text);
                        detalle.dblPrecio   = decimal.Parse(((TextBox)row.Cells[4].FindControl("TextBox2")).Text, culture);
                        detalle.fkVenta     = ven.idVenta;
                        detalle.fkEmpleado  = int.Parse(Session["id"].ToString());
                        ctrlClie.InsertarDetalle(detalle);
                    }
                    Session["contado"] = null;
                    this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true);
                }

                this.Limpiar();
            }
        }
        protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
        {
            string cod;

            if (e.CommandName == "Seleccionar")
            {
                DataList2.SelectedIndex = e.Item.ItemIndex;

                cod = ((Label)this.DataList2.SelectedItem.FindControl("idVentaLabel")).Text;
                Session["desgloce_req_alm"] = cod;

                Response.Redirect("/Almacen/DesgloceRequisicionAlmacen.aspx");
            }

            else if (e.CommandName == "Finalizar")
            {
                string confirmValue = Request.Form["confirm_value"];

                if (confirmValue == "Si")
                {
                    ControllerAlmacen ctrlAlm = new ControllerAlmacen();
                    tblVenta          ven     = new tblVenta();
                    DateTime          fechact = DateTime.Now;

                    DataList2.SelectedIndex = e.Item.ItemIndex;

                    cod = ((Label)this.DataList2.SelectedItem.FindControl("idVentaLabel")).Text;

                    var Productos = (from prod in contexto.tblDetalleVenta
                                     where prod.fkVenta == Int32.Parse(cod)
                                     select prod);

                    foreach (tblDetalleVenta det in Productos)
                    {
                        var cantidadExistente = (from existe in contexto.tblStock
                                                 where existe.fkProducto == det.fkProducto
                                                 select existe);

                        var existente = (from existe in contexto.tblStock
                                         where existe.fkProducto == det.fkProducto
                                         select existe).FirstOrDefault();


                        if (existente == null)
                        {
                            Response.Redirect("/Almacen/AlertaFallo.aspx");
                        }
                        else
                        {
                            foreach (tblStock ord in cantidadExistente)
                            {
                                var resta = ord.dblCantidad - det.intCantidad;

                                if (resta >= 0)
                                {
                                    tblMovimiento mov = new tblMovimiento();
                                    mov.strTipo    = "VENTA NUMERO " + cod;
                                    mov.fecha      = fechact;
                                    mov.dblValAnt  = ord.dblCantidad;
                                    mov.dblValNvo  = resta;
                                    mov.fkStock    = ord.idStock;
                                    mov.fkEmpleado = Int32.Parse(lbEmpleado.Text);
                                    mov.strNumVen  = cod;
                                    mov.strFactura = "";

                                    ctrlAlm.InsertarMovimientoAlmacen(mov);
                                    ord.dblCantidad = resta;
                                    contexto.SubmitChanges();
                                    ven.idVenta   = Convert.ToInt32(cod);
                                    ven.strEstado = "FINALIZADO";

                                    ctrlAlm.EditarFinalizado(ven);
                                    Response.Redirect("/Almacen/AlertaExito.aspx");
                                }
                                else
                                {
                                    Response.Redirect("/Almacen/AlertaAlerta.aspx");
                                }
                            }
                        }
                    }
                }
            }

            else if (e.CommandName == "Pendiente")
            {
                string confirmValue = Request.Form["confirm_value"];

                if (confirmValue == "Si")
                {
                    ControllerAlmacen ctrlAlm = new ControllerAlmacen();
                    tblVenta          ven     = new tblVenta();

                    DataList2.SelectedIndex = e.Item.ItemIndex;

                    cod           = ((Label)this.DataList2.SelectedItem.FindControl("idVentaLabel")).Text;
                    ven.idVenta   = Convert.ToInt32(cod);
                    ven.strEstado = "PENDIENTE";

                    ctrlAlm.EditarPendiente(ven);
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Se regreso a estado PENDIENTE la requisición')", true);
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Se cancelo la finalización de la requisición')", true);
                }
            }

            Response.Redirect("/Almacen/RequisicionAlmacen.aspx");
        }