protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            try{
                String vQuery = "";
                if (Convert.ToBoolean(Session["ACTIVOS_PI_PERSONAL"]))
                {
                    validarPersonal();
                    vQuery = "[RSP_ActivosPI] 11" +
                             "," + DDLCategoria.SelectedValue +
                             "," + DDLTipo.SelectedValue +
                             ",'" + TxMarca.Text + "'" +
                             ",'" + TxSerie.Text + "'" +
                             ",'" + TxModelo.Text + "'" +
                             "," + Session["USUARIO"].ToString() +
                             "," + DDLEmpleado.SelectedValue +
                             ",1";
                }
                else
                {
                    vQuery = "[RSP_ActivosPI] 6" +
                             "," + LbIdEquipoEnt.Text +
                             ",1," + Session["USUARIO"].ToString() + "";
                }

                int vInfo = vConexion.ejecutarSql(vQuery);
                if (vInfo > 0)
                {
                    cargarDatos();
                    UpdateDivBusquedas.Update();
                    Mensaje("Entrada guardada con éxito", WarningType.Success);
                }
                else
                {
                    Mensaje("Hubo un error al guardar la entrada.", WarningType.Danger);
                }

                limpiarFormulario();
                LbMensaje.Text            = "";
                DivResultado.Visible      = false;
                DivRegistrar.Visible      = false;
                DivEquipoPersonal.Visible = false;
                UpdatePanel7.Update();
                TxBusqueda.Focus();
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Convert.ToBoolean(Session["AUTH"]))
                {
                    generales vGenerales = new generales();
                    DataTable vDatos     = (DataTable)Session["AUTHCLASS"];
                    if (!vGenerales.PermisosPersonalSeguridad(vDatos))
                    {
                        Response.Redirect("/login.aspx");
                    }

                    TxBusqueda.Focus();
                    cargarDatos();
                }
            }
        }
Ejemplo n.º 3
0
        protected void TxBusqueda_TextChanged(object sender, EventArgs e)
        {
            try{
                if (TxBusqueda.Text != "" || TxBusqueda.Text != string.Empty)
                {
                    String    vQuery        = "[RSP_Seguridad] 16,'" + TxBusqueda.Text + "'";
                    DataTable vVerificacion = vConexion.obtenerDataTable(vQuery);
                    if (vVerificacion.Rows.Count > 0)
                    {
                        TxBusqueda.Focus();
                        limpiarFormulario();
                        Mensaje("El número de serie tiene una entrada pendiente. Favor ingrese otro.", WarningType.Warning);
                    }
                    else
                    {
                        vQuery = "[RSP_Seguridad] 21,'" + TxBusqueda.Text + "'";
                        DataTable vDatos1 = vConexion.obtenerDataTable(vQuery);
                        if (vDatos1.Rows.Count > 0)
                        {
                            LbAprobacion.Text = "Aprobado!";
                            LbAprobacion.Attributes.CssStyle.Value = "color:Green; margin-top:100px; margin-left:20px;";

                            //divAutorizado.Visible = false;
                            Session["SEC_APROBACION_SALIDA"] = vDatos1;
                        }
                        else
                        {
                            LbAprobacion.Text = "No Aprobado!";
                            LbAprobacion.Attributes.CssStyle.Value = "color:Tomato; margin-bottom:10px; margin-left:20px;";
                            //divAutorizado.Visible = true;
                        }
                        LbAprobacion.Visible = true;

                        vQuery = "[RSP_Seguridad] 6,'" + TxBusqueda.Text + "'";
                        DataTable vDatos = vConexion.obtenerDataTable(vQuery);
                        if (vDatos.Rows.Count > 0)
                        {
                            Session["ID_ENTRADA"] = vDatos.Rows[0]["id"].ToString();

                            DivEntradas.Visible      = true;
                            LbIdEntrada.Text         = vDatos.Rows[0]["id"].ToString();
                            LbNombreEntrada.Text     = vDatos.Rows[0]["nombre"].ToString();
                            LbArticuloEntrada.Text   = vDatos.Rows[0]["articulo"].ToString();
                            LbSerieEntrada.Text      = vDatos.Rows[0]["serie"].ToString();
                            LbInventarioEntrada.Text = vDatos.Rows[0]["inventario"].ToString();
                            LbFechaEntrada.Text      = vDatos.Rows[0]["fechaEntrada"].ToString();

                            TxInventario.Text         = vDatos.Rows[0]["inventario"].ToString();
                            DDLArticulo.SelectedValue = vDatos.Rows[0]["idArticulo"].ToString();

                            DivBody.Visible   = true;
                            TxMensaje.Text    = "";
                            TxMensaje.Visible = false;
                            UpdatePanel1.Update();
                        }
                        else
                        {
                            TxInventario.Text         = string.Empty;
                            DDLArticulo.SelectedIndex = -1;
                            Session["ID_ENTRADA"]     = null;
                            DivEntradas.Visible       = false;
                            DivBody.Visible           = false;
                            TxMensaje.Visible         = true;
                            TxMensaje.Text            = LbAprobacion.Text == "Aprobado!" ? "Cree un nuevo registro." : string.Empty;
                            UpdatePanel1.Update();
                        }
                        TxNombre.Focus();
                        TxSerie.Text = TxBusqueda.Text;
                    }
                    UpdatePanel2.Update();
                }
                else
                {
                    limpiarFormulario();
                }
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }
Ejemplo n.º 4
0
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            try{
                validaciones();
                String    vQuery = "";
                DataTable vInfo  = new DataTable();
                DataTable vAprob = (DataTable)Session["SEC_APROBACION_SALIDA"];

                if (Session["ID_ENTRADA"] != null)
                {
                    String vId = Session["ID_ENTRADA"].ToString();
                    vQuery = "[RSP_Seguridad] 10," + vId +
                             ",'" + TxNombre.Text + "'" +
                             "," + DDLMotivo.SelectedValue +
                             ",'" + TxObservaciones.Text + "'" +
                             "," + vAprob.Rows[0]["id"].ToString();

                    vInfo = vConexion.obtenerDataTable(vQuery);
                    if (vInfo.Rows.Count > 0)
                    {
                        if (vAprob != null)
                        {
                            String vIdAprob = vAprob.Rows[0]["id"].ToString();
                            vQuery = "[RSP_Seguridad] 20," + vIdAprob;
                            vConexion.ejecutarSql(vQuery);
                        }
                        //else
                        //    enviaCorreo(vInfo);

                        cargarDatos();
                        UpdateDivBusquedas.Update();
                        Mensaje("Salida guardada con éxito", WarningType.Success);
                    }
                    else
                    {
                        Mensaje("Hubo un error al guardar la salida.", WarningType.Danger);
                    }
                }
                else
                {
                    String vRSP = DDLMotivo.SelectedValue == "9" ? "[RSP_Seguridad] 13" : "[RSP_Seguridad] 2";

                    vQuery = vRSP +
                             ",'" + TxNombre.Text + "'" +
                             "," + DDLArticulo.SelectedValue +
                             ",'" + TxSerie.Text + "'" +
                             ",'" + TxInventario.Text + "'" +
                             "," + DDLMotivo.SelectedValue +
                             ",'" + TxObservaciones.Text + "'" +
                             ",'" + Session["USUARIO"].ToString() + "'";
                    vInfo = vConexion.obtenerDataTable(vQuery);
                    if (vInfo.Rows.Count > 0)
                    {
                        if (vAprob != null)
                        {
                            String vIdAprob = vAprob.Rows[0]["id"].ToString();
                            vQuery = "[RSP_Seguridad] 20," + vIdAprob;
                            vConexion.ejecutarSql(vQuery);
                        }//else
                         //enviaCorreo(vInfo);

                        cargarDatos();
                        UpdateDivBusquedas.Update();
                        Mensaje("Salida guardada con éxito", WarningType.Success);
                    }
                    else
                    {
                        Mensaje("Hubo un error al guardar la entrada.", WarningType.Danger);
                    }
                }

                limpiarFormulario();
                TxBusqueda.Focus();
            }catch (Exception Ex) {
                Mensaje(Ex.Message, WarningType.Danger);
            }
        }
        protected void TxBusqueda_TextChanged(object sender, EventArgs e)
        {
            try{
                DivResultado.Visible      = false;
                DivEquipoPersonal.Visible = false;
                DivRegistrar.Visible      = false;
                DivInfoIN.Visible         = false;

                if (TxBusqueda.Text != "" || TxBusqueda.Text != string.Empty)
                {
                    String    vQuery = "[RSP_ActivosPI] 5,'" + TxBusqueda.Text + "'";
                    DataTable vDatos = vConexion.obtenerDataTable(vQuery);
                    Session["ACTIVOS_PI_PERSONAL"] = vDatos.Rows.Count < 1 ? true : false;
                    if (vDatos.Rows.Count < 1)
                    {
                        vQuery = "[RSP_ActivosPI] 15,'" + TxBusqueda.Text + "'";
                        vDatos = vConexion.obtenerDataTable(vQuery);
                        DivResultado.Visible = true;
                        if (vDatos.Rows.Count > 0)
                        {
                            if (vDatos.Rows[0]["idEstado"].ToString() == "1")
                            {
                                LbMensaje.Text = "El equipo no tiene permiso de salir.";
                            }
                            if (vDatos.Rows[0]["idEstado"].ToString() == "0")
                            {
                                LbMensaje.Text = "El equipo no ha sido asignado a un empleado.";
                            }
                        }
                        else
                        {
                            TxBusqueda.Focus();
                            LbMensaje.Text            = "El equipo con serie " + TxBusqueda.Text + " no está registrado! Si es equipo personal regístrelo.";
                            DivEquipoPersonal.Visible = true;
                            DivRegistrar.Visible      = true;
                            TxSerie.Text = TxBusqueda.Text;
                            limpiarFormulario();
                        }
                    }
                    else
                    {
                        Session["ACTIVOS_ID"] = vDatos.Rows[0]["idEquipo"].ToString();
                        if (vDatos.Rows[0]["nombre"].ToString() == "")
                        {
                            DivResultado.Visible = true;
                            LbMensaje.Text       = "El equipo no está asignado a un empleado!";
                        }
                        else if (vDatos.Rows[0]["autorizado"].ToString() == "")
                        {
                            DivResultado.Visible = true;
                            LbMensaje.Text       = "El equipo no está autorizado para salir!";
                        }
                        else
                        {
                            DivRegistrar.Visible = true;
                            DivInfoIN.Visible    = true;
                            LbIdEquipoEnt.Text   = vDatos.Rows[0]["idEquipo"].ToString();
                            LbNombre.Text        = vDatos.Rows[0]["nombre"].ToString();
                            LbSerieSalida.Text   = vDatos.Rows[0]["serie"].ToString();
                            LbMarca.Text         = vDatos.Rows[0]["marca"].ToString();
                            LbTipo.Text          = vDatos.Rows[0]["TipoEquipo"].ToString();
                            LbCodInventario.Text = vDatos.Rows[0]["inventario"].ToString();
                            DivBody.Visible      = true;
                        }
                    }
                    UpdatePanel1.Update();
                }
                else
                {
                    limpiarFormulario();
                }
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }
Ejemplo n.º 6
0
        protected void TxBusqueda_TextChanged(object sender, EventArgs e)
        {
            try{
                if (TxBusqueda.Text != "" || TxBusqueda.Text != string.Empty)
                {
                    String    vQuery        = "[RSP_Seguridad] 15,'" + TxBusqueda.Text + "'";
                    DataTable vVerificacion = vConexion.obtenerDataTable(vQuery);
                    if (vVerificacion.Rows.Count > 0)
                    {
                        TxBusqueda.Focus();
                        limpiarFormulario();
                        Mensaje("El número de serie tiene una salida pendiente. Favor ingrese otro.", WarningType.Warning);
                    }
                    else
                    {
                        vQuery = "[RSP_Seguridad] 8,'" + TxBusqueda.Text + "'";
                        DataTable vDatos = vConexion.obtenerDataTable(vQuery);
                        if (vDatos.Rows.Count > 0)
                        {
                            Session["ID_SALIDA"] = vDatos.Rows[0]["id"].ToString();

                            DivSalidas.Visible      = true;
                            LbIdSalida.Text         = vDatos.Rows[0]["id"].ToString();
                            LbNombreSalida.Text     = vDatos.Rows[0]["nombreSalida"].ToString();
                            LbSerieSalida.Text      = vDatos.Rows[0]["serie"].ToString();
                            LbArticuloSalida.Text   = vDatos.Rows[0]["articulo"].ToString();
                            LbInventarioSalida.Text = vDatos.Rows[0]["inventario"].ToString();
                            LbFechaSalida.Text      = vDatos.Rows[0]["fechaSalida"].ToString();

                            TxInventario.Text          = vDatos.Rows[0]["inventario"].ToString();
                            DDLArticulos.SelectedValue = vDatos.Rows[0]["idArticulo"].ToString();

                            DivBody.Visible   = true;
                            TxMensaje.Text    = "";
                            TxMensaje.Visible = false;
                            UpdatePanel1.Update();
                        }
                        else
                        {
                            TxInventario.Text          = string.Empty;
                            DDLArticulos.SelectedIndex = -1;
                            Session["ID_SALIDA"]       = null;
                            DivSalidas.Visible         = false;
                            DivBody.Visible            = false;
                            TxMensaje.Visible          = true;
                            TxMensaje.Text             = "Cree un nuevo registro.";
                            UpdatePanel1.Update();
                        }
                        TxNombre.Focus();
                        TxSerie.Text = TxBusqueda.Text;
                    }
                    UpdatePanel2.Update();
                }
                else
                {
                    limpiarFormulario();
                }
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }
Ejemplo n.º 7
0
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            try{
                validaciones();
                String    vQuery = "";
                DataTable vInfo  = new DataTable();

                if (Session["ID_SALIDA"] != null)
                {
                    vQuery = "[RSP_Seguridad] 7" +
                             "," + Session["ID_SALIDA"].ToString() +
                             ",'" + TxNombre.Text + "'" +
                             ",'" + TxDestinatario.Text + "'" +
                             "," + DDLDepartamento.SelectedValue +
                             "," + DDLMotivo.SelectedValue +
                             ",'" + TxObservaciones.Text + "'";
                    vInfo = vConexion.obtenerDataTable(vQuery);
                    if (vInfo.Rows.Count > 0)
                    {
                        //enviaCorreo(vInfo);
                        cargarDatos();
                        UpdateDivBusquedas.Update();
                        Mensaje("Entrada guardada con éxito", WarningType.Success);
                    }
                    else
                    {
                        Mensaje("Hubo un error al guardar la entrada.", WarningType.Danger);
                    }
                }
                else
                {
                    String vRSP = DDLMotivo.SelectedValue == "9" ? "[RSP_Seguridad] 12," : "[RSP_Seguridad] 1,";

                    if (DDLMotivo.SelectedValue == "13")
                    {
                        vQuery = "[RSP_Seguridad] 17" +
                                 ",'" + Session["USUARIO"].ToString() + "'" +
                                 "," + DDLArticulos.SelectedValue +
                                 "," + 1 +
                                 ",'" + TxSerie.Text + "'" +
                                 ",'" + TxObservaciones.Text + "'";
                        vConexion.ejecutarSql(vQuery);
                    }

                    vQuery = vRSP + "'" + TxNombre.Text + "'" +
                             "," + DDLArticulos.SelectedValue +
                             ",'" + TxSerie.Text + "'" +
                             ",'" + TxInventario.Text + "'" +
                             ",'" + TxDestinatario.Text + "'" +
                             ",'" + Session["USUARIO"].ToString() + "'" +
                             "," + DDLMotivo.SelectedValue +
                             ",'" + TxObservaciones.Text + "'" +
                             "," + DDLDepartamento.SelectedValue;
                    vInfo = vConexion.obtenerDataTable(vQuery);
                    if (vInfo.Rows.Count > 0)
                    {
                        cargarDatos();
                        UpdateDivBusquedas.Update();
                        Mensaje("Entrada guardada con éxito", WarningType.Success);
                    }
                    else
                    {
                        Mensaje("Hubo un error al guardar la entrada.", WarningType.Danger);
                    }
                }
                limpiarFormulario();
                TxBusqueda.Focus();
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }