Beispiel #1
0
 protected void BotonHistorialPrestamos_Click(object sender, EventArgs e)
 {
     String MensajeDevuelto = "";
     try
     {
         if (Page.IsValid)
         {
             validarFechaInicio();
             validarFechaFinal();
             cSGPRPRESTAMONegocios Prestamo = new cSGPRPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
             string[] arregloFechas = TextBoxFechaInicio.Text.Split('/');
             string fechaInicio = arregloFechas[1] + "/" + arregloFechas[0] + "/" + arregloFechas[2];
             arregloFechas = TextBoxFechaFinal.Text.Split('/');
             string fechaFinal = arregloFechas[1] + "/" + arregloFechas[0] + "/" + arregloFechas[2];
             DataTable DT_Prestamos = Prestamo.obtenerReporte(Convert.ToDateTime(fechaInicio), Convert.ToDateTime(fechaFinal));
             llenarTablaPrestamos(TextBoxFechaInicio.Text, TextBoxFechaFinal.Text, DT_Prestamos);
         }
         LabelMensaje.ForeColor = System.Drawing.Color.Blue;
     }
     catch (Exception ex)
     {
         MensajeDevuelto = ex.Message;
         LabelMensaje.ForeColor = System.Drawing.Color.Red;
     }
     LabelMensaje.Text = MensajeDevuelto;
 }
        private String VerificarEstado(cSGMUUSUARIONegocios pUsuarioGimnasio)
        {
            cSGPRPRESTAMONegocios tempPrestamo = new cSGPRPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
            tempPrestamo.CAR_USUARIOGIMNASIO = pUsuarioGimnasio.CAR_USUARIO;
            tempPrestamo.ESTADO = _PENDIENTE;
            DataTable prestamosPendientes = tempPrestamo.Buscar();
            if (prestamosPendientes.Rows.Count == 0)
            {
                return "No tiene préstamos pendientes";
            }

            return "Tiene préstamos pendientes";
        }
        private void RealizarPrestamo()
        {
            cSGPRPRESTAMONegocios nuevoPrestamo = new cSGPRPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
            nuevoPrestamo.ESTADO = _PENDIENTE;
            nuevoPrestamo.FEC_PRESTAMO = DateTime.Now;
            nuevoPrestamo.FK_IDTIPOPRESTAMO = drpTipoPrestamo.SelectedIndex + 1;
            nuevoPrestamo.CAR_USUARIOGIMNASIO = txtIdentificacion.Text;
            nuevoPrestamo.Insertar();

            AgregarImplementosPrestamo((int)nuevoPrestamo.ID_PRESTAMO);

            IniciarVentana();
        }
Beispiel #4
0
        protected void btnRealizarDevolucion_Click(object sender, EventArgs e)
        {
            cSGPRDEVOLUCIONNegocios devolucion = new cSGPRDEVOLUCIONNegocios(Global.gCOD_APLICACION, "CA", 0, "0");
            devolucion.FEC_DEVOLUCION = DateTime.Now;
            Label lblIdentifiacion = (Label)_prestamoElegido.FindControl("lblIdentificacion");
            devolucion.CAR_USUARIOGIMNASIO = lblIdentifiacion.Text;

            Char[] delimiter = { '_' };
            string idPanel = _prestamoElegido.ID;
            string idPrestamo = idPanel.Split(delimiter)[1];

            devolucion.FK_IDPRESTAMO = int.Parse(idPrestamo);

            if (!ComprobarDevolucionValida(devolucion))
            {
                if (!Page.ClientScript.IsStartupScriptRegistered("DevolucionInvalida"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "DevolucionInvalida",
                        "<script type=\"text/javascript\"> alert('Debe ingresar alguna cantidad a devolver para al menos uno de los implementos.'); </script>");
                }
                return;
            }

            devolucion.Insertar();

            AgregarImplementosDevueltos(devolucion);

            WrapperDetalle.Controls.Clear();
            _prestamoElegido = null;

            cSGPRIMPLEMENTOPORPRESTAMONegocios implementosTemp = new cSGPRIMPLEMENTOPORPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
            implementosTemp.FK_IDPRESTAMO = int.Parse(idPrestamo);
            DataTable tablaImplementos = implementosTemp.SeleccionarTodos_Con_FK_IDPRESTAMO_FK();
            if (tablaImplementos.Rows.Count == 0)
            {
                cSGPRPRESTAMONegocios prestamos = new cSGPRPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
                prestamos.ID_PRESTAMO = int.Parse(idPrestamo);
                prestamos.ESTADO = true;
                prestamos.Actualizar();
            }

            if (!Page.ClientScript.IsStartupScriptRegistered("DevolucionSatisfactoria"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "DevolucionSatisfactoria",
                    "<script type=\"text/javascript\"> __doPostBack(); alert('La devolución se realizó satisfactoriamente.'); </script>");
            }
        }
Beispiel #5
0
 public void ObtenerPrestamos()
 {
     cSGPRPRESTAMONegocios prestamos = new cSGPRPRESTAMONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
     _prestamos = prestamos.SeleccionarTodos();
 }