Beispiel #1
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            int aux = 1;

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    this.entidades = new AEUSP();

                    int       index   = int.Parse(this.strIdActivo);
                    tbActivo  activo  = entidades.tbActivo.FirstOrDefault(a => a.idActivo == index);
                    tbColchon colchon = entidades.tbColchon.FirstOrDefault(c => c.idActivo == index);

                    this.entidades.SP_DTL_ELIMINARDETALLECOLCHO(index);
                    this.entidades.tbColchon.Remove(colchon);
                    this.entidades.tbActivo.Remove(activo);
                    this.entidades.SaveChanges();
                    scope.Complete();
                }
            }
            catch
            {
                aux = 0;
                ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                    "alertIns", "alert('Error al eliminar el colchón');", true);
            }
            if (aux == 1)
            {
                Response.Redirect("FrmConsultarCol.aspx");
            }
        }
Beispiel #2
0
        protected void btnPrestar_Click(object sender, EventArgs e)
        {
            int aux = 1;

            try
            {
                if (!string.IsNullOrEmpty(txtCedula.Text) && !string.IsNullOrEmpty(this.txtUbicacion.Text) && this.dgtListaColchones.Rows.Count > 0)
                {
                    this.entidades = new AEUSP();
                    using (TransactionScope scope = new TransactionScope())
                    {
                        this.entidades.SP_INS_REGISTRARMOVIMIENTO("B75566", this.txtCedula.Text, "S", DateTime.Now);
                        this.registrarPrestamosColchones();
                        scope.Complete();
                    }
                }
                else
                {
                    aux = 0;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns",
                                                        "alert('Se necesita seleccionar colchones para realizar el préstamo');", true);
                }
            }
            catch
            {
                aux = 0;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns",
                                                    "alert('Se presentó un error al realizar el prestamo, favor verificar los datos.');", true);
            }
            if (aux == 1)
            {
                Response.Redirect("FrmConsultarCol.aspx");
            }
        }
#pragma warning restore CS0246 // El nombre del tipo o del espacio de nombres 'AEUSP' no se encontró (¿falta una directiva using o una referencia de ensamblado?)

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.entidades = new AEUSP();
                var organismo1 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo3 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("C001") && !organismo2.Single().ToString().Equals("IF1") && !organismo3.Single().ToString().Equals("AS1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
            if (!IsPostBack)
            {
                this.cargarDatos();
            }
        }
Beispiel #4
0
        private void llenarCampos()
        {
            try
            {
                this.entidades = new AEUSP();

                int       index   = int.Parse(this.strIdActivo);
                tbActivo  activo  = entidades.tbActivo.FirstOrDefault(a => a.idActivo == index);
                tbColchon colchon = entidades.tbColchon.FirstOrDefault(c => c.idActivo == index);

                //Se llenan los datos
                this.txtNumero.Enabled = false;
                this.txtNumero.Text    = colchon.numeroColchon.ToString();

                this.txtProveniencia.Enabled = false;
                this.txtProveniencia.Text    = colchon.procedencia;

                this.dlEstado.SelectedValue = activo.estado;

                this.txtObservacion.Text = activo.observacion;
                this.entidades           = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCant.Text))// no hacemos nada si el espacio es vacio
                {
                    Response.Write("<script language='JavaScript'>" +
                                   "alert('Problemas, ingresa una Cantidad valida para el producto')</script>");
                }
                else
                {
                    //Se instancia las entidades
                    this.entidad = new AEUSP();

                    // se busca al estudiante
                    tbConsumible consumible = this.entidad.tbConsumible.FirstOrDefault(u => u.idConsumible == this.pid);

                    //se modifican los datos del estudiante con los datos del FRONT-END
                    consumible.inventario = Convert.ToInt32(this.txtCant.Text);


                    // se aplican los cambios
                    this.entidad.SaveChanges();

                    //se redirecciona en la lista de estudiantes
                    Response.Redirect("FrmConsultarConsu-Ali.aspx");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        private void recargarTabla()
        {
            try
            {
                this.entidades = new AEUSP();
                var colchonSolicitado = this.entidades.SP_CNS_COLCHONPORNUMERO(int.Parse(this.cboxColchones.Text));

                if (colchonSolicitado != null)
                {
                    this.tabla = new DataTable();
                    this.tabla.Columns.Add(new DataColumn("NumeroColchon", typeof(int)));
                    this.tabla.Columns.Add(new DataColumn("Estado", typeof(string)));

                    this.listaColchones = new List <Colchon>();

                    //Se almancena el colchon solicitado nuevamente
                    this.colchon = new Colchon();
                    this.colchon.numeroColchon = colchonSolicitado.Single().numeroColchon;
                    colchonSolicitado          = null;
                    colchonSolicitado          = this.entidades.SP_CNS_COLCHONPORNUMERO(int.Parse(this.cboxColchones.Text));
                    this.colchon.estado        = colchonSolicitado.Single().Estado;
                    colchonSolicitado          = null;
                    colchonSolicitado          = this.entidades.SP_CNS_COLCHONPORNUMERO(int.Parse(this.cboxColchones.Text));
                    this.listaColchones.Add(this.colchon);

                    //Se obtienen los datos almacenados en la tabla
                    for (int i = 0; i < this.dgtListaColchones.Rows.Count; i++)
                    {
                        if (int.Parse(this.dgtListaColchones.Rows[i].Cells[0].Text) == colchonSolicitado.Single().numeroColchon)
                        {
                            this.listaColchones.RemoveAt(0);
                        }
                        this.colchon = new Colchon();
                        this.colchon.numeroColchon = int.Parse(this.dgtListaColchones.Rows[i].Cells[0].Text);
                        this.colchon.estado        = this.dgtListaColchones.Rows[i].Cells[1].Text;
                        this.listaColchones.Add(this.colchon);
                        colchonSolicitado = null;
                        colchonSolicitado = this.entidades.SP_CNS_COLCHONPORNUMERO(int.Parse(this.cboxColchones.Text));
                    }

                    //Se procede a llenar la tabla
                    for (int i = 0; i < this.listaColchones.Count; i++)
                    {
                        DataRow fila = tabla.NewRow();
                        fila["NumeroColchon"] = this.listaColchones[i].numeroColchon;
                        fila["Estado"]        = this.listaColchones[i].estado;
                        this.tabla.Rows.Add(fila);
                    }
                    this.dgtListaColchones.DataSource = this.tabla;
                    this.dgtListaColchones.DataBind();
                }
                this.btnPrestar.Visible = true;
                this.btnLimpiar.Visible = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
0
        private void cargarDatos()
        {
            AEUSP db   = new AEUSP();
            var   list = db.Sp_Cns_InvActivosAso();

            GVConsulta.DataSource = list;
            GVConsulta.DataBind();
        }
        private void FillGVAsistencias(string movimiento, DateTime fechaI, DateTime fechaF)
        {
            AEUSP db   = new AEUSP();
            var   list = db.Sp_Cns_EntradasPorFecha(movimiento, fechaI, fechaF);

            GVAsistencias.DataSource = list;
            GVAsistencias.DataBind();
        }
        public void cargarDatos()
        {
            this.entidades = new AEUSP();

            this.dtgListaConsumibles.DataSource = this.entidades.Sp_Cns_ConsumiblesLimpiezaPorNombre(this.txtBuscar.Text.Trim());

            this.dtgListaConsumibles.DataBind();

            this.dtgListaConsumibles.Visible = true;
        }
        private void FillGVEntradasActivas()
        {
            AEUSP db   = new AEUSP();
            var   list = db.Sp_Cns_EntradasActivas();

            GVEntradas.DataSource = list;
            GVEntradas.DataBind();

            //GVEntradas.Columns["ultFecha"].Default
        }
Beispiel #11
0
        protected void btnTransaccion_Click(object sender, EventArgs e)
        {
            int aux = 1;

            try
            {
                if (!string.IsNullOrEmpty(this.txtNumero.Text) && !string.IsNullOrEmpty(this.txtObservacion.Text) && !string.IsNullOrEmpty(this.txtProveniencia.Text))
                {
                    //Se instancian las entidades de la BD
                    this.entidades = new AEUSP();

                    if (accion == 1)
                    {
                        using (TransactionScope scope = new TransactionScope())
                        {
                            //Se instancia la tabla para registrar el activo
                            tbActivo activo = new tbActivo();

                            //Se llenan los datos del activo
                            activo.estado      = this.dlEstado.SelectedValue;
                            activo.observacion = this.txtObservacion.Text;

                            //Se procede a llenar los datos del colchón
                            this.llenarDatosColchon();

                            this.entidades.SP_INS_REGISTRARCOLCHON(activo.estado, activo.observacion, colchon.numeroColchon,
                                                                   colchon.procedencia);
                            this.entidades.SaveChanges();
                            scope.Complete();
                        }
                    }
                    else
                    {
                        int      index  = int.Parse(this.strIdActivo);
                        tbActivo activo = entidades.tbActivo.FirstOrDefault(a => a.idActivo == index);

                        activo.estado      = this.dlEstado.SelectedValue;
                        activo.observacion = this.txtObservacion.Text;

                        this.entidades.SaveChanges();
                    }
                }
            }
            catch
            {
                aux = 0;
                ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                    "alertIns", "alert('Se presentó un error con los datos del colchón, favor comprobrar');", true);
            }
            if (aux == 1)
            {
                Response.Redirect("FrmConsultarCol.aspx");
            }
        }
 protected void dgtListaColchonesPrestados_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     this.entidades = new AEUSP();
     if (this.rbgConsulta.SelectedIndex == 0)
     {
         this.tablaNumero();
     }
     else
     {
         this.tablaCedula();
     }
 }
        private void cargarDatosUsuario(string carnet)
        {
            db = new AEUSP();
            var usuario = db.tbUsuario.FirstOrDefault(u => u.carnet.Equals(carnet));

            if (usuario != null)
            {
                txtCarnet.Text = usuario.carnet;
                txtNombre.Text = usuario.nombreCompleto;
                txtCedula.Text = usuario.cedula;
                txtContra.Text = usuario.clave;
            }
        }
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                long num = 0;

                bool valido = long.TryParse(txtCantidad.Text.Trim(), out num);

                if (valido)
                {
                    if (int.Parse(this.txtCantidad.Text.Trim()) >= 0)
                    {
                        using (TransactionScope scope = new TransactionScope())
                        {
                            this.varCons = new Consumible();

                            this.varCons.codigoOrganismo = "C001";
                            this.varCons.nombre          = this.txtNombre.Text.Trim();
                            this.varCons.inventario      = int.Parse(this.txtCantidad.Text.Trim());

                            this.entidades = new AEUSP();

                            tbConsumible tablaCons = new tbConsumible();

                            tablaCons.codigoOrganismo = this.varCons.codigoOrganismo;
                            tablaCons.nombre          = this.varCons.nombre;
                            tablaCons.inventario      = this.varCons.inventario;

                            this.entidades.tbConsumible.Add(tablaCons);

                            this.entidades.SaveChanges();

                            scope.Complete();

                            this.txtNombre.Text   = "";
                            this.txtCantidad.Text = "";

                            Response.Redirect("FrmConsulta-Lim.aspx");
                        }
                    }
                    else
                    {
                        lbNotificaciones.Text = "Consumible existente, modifique la cantidad o ingrese uno nuevo";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        } //fin del else
 protected void dgtConsulta_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
     }
     catch
     {
         this.entidades = new AEUSP();
         var consulta = this.entidades.SP_CNS_MOVIMIENTOSTRACTOXFECHA(DateTime.Parse(this.txtFechaI.Text),
                                                                      DateTime.Parse(this.txtFechaF.Text).AddDays(1));
         this.dgtConsulta.DataSource = consulta;
         this.dgtConsulta.DataBind();
     }
 }
 protected void btnConsultar_Click(object sender, EventArgs e)
 {
     try
     {
         this.entidades = new AEUSP();
         var consulta = this.entidades.SP_CNS_MOVIMIENTOSTRACTOXFECHA(DateTime.Parse(this.txtFechaI.Text),
                                                                      DateTime.Parse(this.txtFechaF.Text).AddDays(1));
         this.dgtConsulta.DataSource = consulta;
         this.dgtConsulta.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.db = new AEUSP();
                var organismo1 = this.db.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.db.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo3 = this.db.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo2.Single().ToString().Equals("IF1") && !organismo3.Single().ToString().Equals("AS1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }

            db = new AEUSP();
            if (Request.QueryString["placa"] != null)
            {
                this.pid = Convert.ToInt32(Request.QueryString["placa"]);
                this.btnRegistrar.Visible = false;
                this.btnEliminar.Visible  = true;
                this.btnModificar.Visible = true;
                this.txtPlaca.Enabled     = false;
                this.txtNombre.Enabled    = false;
            }
            else
            {
                this.pid = 0;
            }

            // un postback es un evento generado por un control web
            // al negarlo es la carga inicial del formulario
            if (!IsPostBack)
            {
                this.cargardatos(this.pid);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.db = new AEUSP();
                var organismo1 = this.db.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.db.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("IF1") && !organismo2.Single().ToString().Equals("AS1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
            db = new AEUSP();

            if (Request.QueryString["carnet"] != null)
            {
                carne = Request.QueryString["carnet"];
                btnRegistrar.Visible      = false;
                btnModificar.Visible      = true;
                btnEliminar.Visible       = true;
                txtCarnet.Enabled         = false;
                txtCedula.Enabled         = false;
                txtNombre.Enabled         = false;
                DDLOrganizaciones.Enabled = false;
            }
            else
            {
                carne = "";
            }
            if (!IsPostBack)
            {
                this.cargarDatosUsuario(carne);
            }
        }
Beispiel #19
0
#pragma warning restore CS0246 // El nombre del tipo o del espacio de nombres 'tbColchon' no se encontró (¿falta una directiva using o una referencia de ensamblado?)
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["id"] != null)
                {
                    strIdActivo = Request.QueryString["id"];
                    this.btnTransaccion.Text = "Modificar";
                    this.btnEliminar.Enabled = true;
                    this.btnEliminar.Visible = true;
                    this.accion = 2;
                    if (!IsPostBack)
                    {
                        this.llenarCampos();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (Session["Usuario"] != null)
            {
                this.entidades = new AEUSP();
                var organismo1 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("CO1") && !organismo2.Single().ToString().Equals("IF1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
Beispiel #20
0
#pragma warning restore CS0246 // El nombre del tipo o del espacio de nombres 'AEUSP' no se encontró (¿falta una directiva using o una referencia de ensamblado?)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.entidades = new AEUSP();
                var organismo1 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo3 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("CO1") && !organismo2.Single().ToString().Equals("IF1") && !organismo3.Single().ToString().Equals("AS1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
            try
            {
                if (!IsPostBack)
                {
                    //Se instancian las entidades de la BD
                    this.entidades = new AEUSP();

                    //Se obtienen los datos apartir de las letras tecleadas
                    var colchones = entidades.SP_CNS_COLCHONES();

                    //Se actualiza la tabla
                    this.dgtListaColchones.DataSource = colchones;
                    this.dgtListaColchones.DataBind();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 protected void txtBusqueda_TextChanged(object sender, EventArgs e)
 {
     try
     {
         this.entidades = new AEUSP();
         if (this.rbgConsulta.SelectedIndex == 0)
         {
             this.tablaNumero();
         }
         else
         {
             this.tablaCedula();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #22
0
        protected void btnConsultarCedula_Click(object sender, EventArgs e)
        {
            try
            {
                this.entidades = new AEUSP();

                var    nombre         = this.entidades.SP_CNS_Asistente(this.txtCedula.Text);
                string nombreCompleto = nombre.ElementAt(0);
                this.txtNombre.Text            = nombreCompleto;
                this.btnLimpiar.Visible        = true;
                this.txtUbicacion.Enabled      = true;
                this.cboxColchones.Enabled     = true;
                this.btnAgregarColchon.Enabled = true;
            }
            catch (Exception)
            {
                Response.Write("<script>window.alert('La persona consultada no esta almacenada en el sistema.');</script>"
                               + "<script>window.setTimeout(location.href='FrmPrestamoColchones.aspx', 2000);</script>");
            }
        }
        private bool intentoLogueo(string carnet, string password)
        {
            bool autorizado = false;

            //Se instancia las entidades de la base de datos
            this.db = new AEUSP();

            tbUsuario user = null;

            user = this.db.tbUsuario.FirstOrDefault(u => u.carnet == carnet.Trim());

            if (user != null)
            {
                if (user.clave.Equals(password.Trim()))
                {
                    autorizado = true;
                }
            }
            return(autorizado);
        }
Beispiel #24
0
        private void cargarDatosAlimento(int pid)
        {
            //se busca un estudiante con la cedula enviada por parametro
            //metodo firstordefault() permite buscar entidades ORM
            this.entidad = new AEUSP();
            tbConsumible consumible =
                this.entidad.tbConsumible.FirstOrDefault(e => e.idConsumible == pid);
            tbConsumibleAlimentacion consuAli =
                this.entidad.tbConsumibleAlimentacion.FirstOrDefault(c => c.idConsumible == pid);

            //se pregunta si tine datos

            if (consumible != null)
            {
                //se asignan los datos del Objeto al front-end
                this.txtNombre.Text = consumible.nombre;
                this.txtCant.Text   = consumible.inventario.ToString();
                this.dlTipo.Text    = consuAli.categoria;
                this.dlUnidad.Text  = consuAli.unidadMedida;
            }
        }
Beispiel #25
0
        protected void btnTransaccion_Click(object sender, EventArgs e)
        {
            int aux = 1;

            try
            {
                if (decimal.Parse(this.txtIngresar.Text) <= decimal.Parse(this.txtPresupuesto.Text) && this.dlTipo.SelectedValue.Equals("S") || this.dlTipo.SelectedValue.Equals("E"))
                {
                    //Se instancias las entidades de la BD
                    entidades = new AEUSP();
                    using (TransactionScope scope = new TransactionScope())
                    {
                        this.entidades.SP_ISN_CUENTA("T", Session["Usuario"].ToString(), this.txtDetalle.Text, DateTime.Now, this.dlTipo.SelectedValue, Convert.ToDecimal(this.txtIngresar.Text));
                        var idMov = this.entidades.SP_CNS_MOVTRACTO();
                        int idM   = int.Parse(idMov.Single().Value.ToString());
                        this.entidades.SP_ISN_TRACTO(idM, this.txtFactura.Text, this.txtEmpresa.Text);
                        //Se guardan los cambios en la BD
                        this.entidades.SaveChanges();
                        scope.Complete();
                    }
                }
                else
                {
                    aux = 0;
                    ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                        "alertIns", "alert('El monto a retirar es mayor que la cantidad almacenada');", true);
                }
            }
            catch
            {
                aux = 0;
                ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                    "alertIns", "alert('Se presentó un error');", true);
            }
            if (aux == 1)
            {
                Response.Redirect("FrmCuentaTracto.aspx");
            }
        }
Beispiel #26
0
 private void cargarDatos()
 {
     try
     {
         this.entidades = new AEUSP();
         if (dlConsulta.SelectedValue == "A")
         {
             var listaColchones = this.entidades.SP_CNS_COLCHONES();
             this.dgtListaColchones.DataSource = listaColchones;
         }
         else
         {
             var listaColchones = this.entidades.SP_CNS_DISPONIBILIDADCOLCHONES(int.Parse(this.dlConsulta.SelectedValue));
             this.dgtListaColchones.DataSource = listaColchones;
         }
         this.dgtListaColchones.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #27
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            //se instancia las entidades

            this.entidad = new AEUSP();
            // se busca el estudiante

            tbConsumible consumible =
                this.entidad.tbConsumible.FirstOrDefault(u => u.idConsumible == this.pid);
            tbConsumibleAlimentacion consuAli =
                this.entidad.tbConsumibleAlimentacion.FirstOrDefault(c => c.idConsumible == this.pid);

            // se elimina el estudiante de la tabla
            this.entidad.tbConsumible.Remove(consumible);
            this.entidad.tbConsumibleAlimentacion.Remove(consuAli);

            // se aplican los cambios
            this.entidad.SaveChanges();

            //se redirecciona al listado

            Response.Redirect("FrmConsultarConsu-Ali.aspx");
        }
#pragma warning restore CS0246 // El nombre del tipo o del espacio de nombres 'AEUSP' no se encontró (¿falta una directiva using o una referencia de ensamblado?)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.entidades = new AEUSP();
                var organismo1 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo3 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("PE1") && !organismo2.Single().ToString().Equals("IF1") && !organismo3.Single().ToString().Equals("AS1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }

            try
            {
                this.entidades = new AEUSP();
                cuenta         =
                    this.entidades.tbCuenta.FirstOrDefault(c => c.idCuenta == "E");
                this.txtPresupuesto.Text = cuenta.monto.ToString();
                this.entidades           = null;
            }
            catch (Exception ex)
            {
                Response.Write("<script language='JavaScript'>alert(" + ex + ");</script>");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                this.entidades = new AEUSP();
                var organismo1 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                var organismo2 = this.entidades.SP_CNS_ORGANISMOUSUARIO(Session["Usuario"].ToString());
                //Se pregunta si no está autenticado el usuario
                if (!HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    Response.Redirect("Default.aspx");
                }
                else if (!organismo1.Single().ToString().Equals("CO1") && !organismo2.Single().ToString().Equals("IF1"))
                {
                    Response.Write("<script language=javascript>alert('El usuario actual no Posee Permisos para acceder a este módulo');</script>");
                    Response.Redirect("FrmModulos.aspx");
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }

            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    this.strId                   = Request.QueryString["id"].ToString();
                    this.entidades               = new AEUSP();
                    this.txtNombre.Text          = this.entidades.SP_CNS_ASISTENTEPRESTAMO(int.Parse(strId)).Single().nombreCompleto;
                    this.strCedula               = this.entidades.SP_CNS_ASISTENTEPRESTAMO(int.Parse(strId)).Single().cedula;
                    Session["CedulaSolicitante"] = this.strCedula;
                    this.cargarTabla();
                }
            }
        }
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            int aux = 1;

            try
            {
                List <int> listaColchones = (List <int>)Session["listaColchones"];
                if (listaColchones.Count > 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        this.entidades = new AEUSP();
                        this.entidades.SP_INS_REGISTRARMOVIMIENTO(Session["Usuario"].ToString(), Session["CedulaSolicitante"].ToString(), "E", DateTime.Now);
                        for (int i = 0; i < listaColchones.Count; i++)
                        {
                            var idAct = this.entidades.SP_CNS_COLCHONXNUMERO(listaColchones[i]);
                            this.entidades.SP_INS_REGISTRARDEVOLUCIONESCOLCHON(idAct.Single(), 1);
                        }
                        this.entidades.SaveChanges();
                        scope.Complete();
                    }
                }
            }
            catch
            {
                aux = 0;
                ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                    "alertIns", "alert('Se presentó un error');", true);
            }
            Session["listaColchones"]    = null;
            Session["CedulaSolicitante"] = null;
            if (aux == 1)
            {
                Response.Redirect("FrmListaPrestamosColchones.aspx");
            }
        }