protected void BtnGuardar_Click(object sender, EventArgs e)
    {
        List <DCPERSONAS> lstPERSONAS = new List <DCPERSONAS>();
        DataTable         DTPERSONAS  = new DataTable();

        PERSONASELECCIONADA = PERSONAS.PERSONASObtenerbyCriterio(txt_NumeroId.Text, 0);
        Session["PERSONACERSELECCIONADA"] = PERSONASELECCIONADA;
        if (PERSONASELECCIONADA.Count == 0)
        {
            PERSONAS.PERSONASRegistrar(0, txt_NumeroId.Text,
                                       cbo_tipoId.SelectedItem.Text, Convert.ToDateTime(dtpFechaExpedicion.Text), Convert.ToDateTime(dtpFechaNacimiento.Text),
                                       txt_nombres.Text.ToUpper(), txt_apellidos.Text.ToUpper(), txtDireccion.Text, cboPais.SelectedItem.Text,
                                       cboDepto.SelectedItem.Text, cboCiudad.SelectedItem.Text, TextCorreoElectronico.Text, cboGenero.SelectedItem.Text,
                                       txtTelefono.Text, txtCelular.Text, "PERSONA", "SI", 0, DateTime.Now, 0, DateTime.Now);

            //string script = " $.growl.notice({ title: 'Registro Exitoso',message: '' });";
            //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta en la BD, los datos de la persona", "sucessful", this, GetType());
        }
        else
        {
            //string script = "alert(\"No se ha podido agregar la persona pues el numero de identificación ya existe!\");";
            //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            Alerta.notiffy("Operacion incompleta", "No se ha podido agregar la persona, el numero de identificación ya existe!", "warning", this, GetType());
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        USUARIOS user = (Session["user"] == null ? new USUARIOS() : Session["user"]) as USUARIOS;

        if (user.ID_USUARIO > 0)
        {
            Alerta.notiffy("Bienvenido", "Muy buen dia " + (Session["user"] as USUARIOS).LOGIN == null ? "Invitado" : (Session["user"] as USUARIOS).LOGIN, "normal", this, GetType());
        }
    }
Example #3
0
    protected void LogIn(object sender, EventArgs e)
    {
        if (UserName.Text.Length > 0 && Password.Text.Length > 0)
        {
            USUARIOS user = new USUARIOS(UserName.Text, Password.Text);
            if (user.ID_USUARIO > 0)
            {
                Session.Add("User", user);
                IPHostEntry host;
                string      localIP = "";
                host = Dns.GetHostEntry(Dns.GetHostName());
                HISTORICO_LOGIN.HISTORICO_LOGINRegistrar(user.ID_USUARIO, host.AddressList[host.AddressList.Length - 1].ToString(), "", DateTime.Now);
                Session.Timeout = 20;
                Char.IsNumber(Convert.ToChar("1pe".Substring(0, 1)));
                //prueba de login

                //var manager = new UserManager();
                //ApplicationUser user2 = new ApplicationUser();
                //user2.UserName = user.LOGIN;
                //user2.PasswordHash = user.CONTRASENIA;
                ////IdentityHelper.SignIn(manager, user2, RememberMe.Checked);
                ////IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);

                //fin de la prueba
                Response.Redirect("/Default.aspx");
            }
            else
            {
                Alerta.notiffy("Datos Incorrectos", "El nombre de ususario o la contraseña son incorrectos, verifique", "warning", this, GetType());
            }
        }
        //if (IsValid)
        //{
        //    // Validate the user password
        //    var manager = new UserManager();
        //    ApplicationUser user = manager.Find(UserName.Text, Password.Text);
        //    if (user != null)
        //    {
        //        IdentityHelper.SignIn(manager, user, RememberMe.Checked);
        //        IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
        //    }
        //    else
        //    {
        //        FailureText.Text = "Invalid username or password.";
        //        ErrorMessage.Visible = true;
        //    }
        //}
    }
    protected void CreateUser_Click(object sender, EventArgs e)
    {
        List <DCPERSONASCER> lstPERSONASCER = new List <DCPERSONASCER>();
        List <DCPERSONASCER> DTPERSONASCER  = new List <DCPERSONASCER>();

        DTPERSONASCER = PERSONASCER.PERSONASCERObtenerbyCriterio(txtIdentificacion.Text, 0);
        if (DTPERSONASCER.Count == 0)
        {
            PERSONASCER.PERSONASCERRegistrar(0, txtIdentificacion.Text.ToUpper(), txtNombres.Text.ToUpper(), txtApellidos.Text.ToUpper(), new DateTime(2002, 11, 3), txtEmail.Text, txtTelefono.Text.ToUpper(), txtMovil.Text.ToUpper(), "EMPLEADO", "SOLTERO", 0, DateTime.Now, 0, DateTime.Now, txtCargo.Text.ToUpper(), txtDependencia.Text.ToUpper(), txtFunciones.Text.ToUpper(), txtSueldo.Text.ToUpper(), "SI");
            CARGARGRILLA();

            Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta en la BD, los datos de la persona", "sucessful", this, GetType());
        }
        else
        {
            CARGARGRILLA();
            Alerta.notiffy("Operacion incompleta", "No se ha podido agregar la persona, el numero de identificación ya existe!", "warning", this, GetType());
        }
    }
    protected void grdLista_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        var     idpersona         = grdLista.DataKeys[e.RowIndex].Value;
        TextBox txtnombres        = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtNOMBRES");
        TextBox txtapellidos      = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtAPELLIDOS");
        TextBox txtidentificacion = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtIDENTIFICACION");
        TextBox txtemail          = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtEMAIL");
        TextBox txtcargo          = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtCARGO");
        TextBox txtdependencia    = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtDEPENDENCIA");
        TextBox txtfunciones      = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtFUNCIONES");
        TextBox txtsueldo         = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtSUELDO");
        //TextBox txtactivo = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtACTIVO");
        DropDownList Drpactivo = (DropDownList)grdLista.Rows[e.RowIndex].FindControl("DrpACTIVO");

        //String txtnombres = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtNOMBRES");
        //String txtapellidos = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtAPELLIDOS");
        //String txtidentificacion = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtIDENTIFICACION");
        //String txtemail = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtEMAIL");
        //String txtcargo = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtCARGO");
        //String txtdependencia = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtDEPENDENCIA");
        //String txtfunciones = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtFUNCIONES");
        //String txtsueldo = (TextBox)grdLista.Rows[e.RowIndex].FindControl("txtSUELDO");

        if (txtnombres.Text != "" && txtapellidos.Text != "" && txtidentificacion.Text != "" && txtemail.Text != "" && txtcargo.Text != "" && txtdependencia.Text != "" &&
            txtfunciones.Text != "" && txtsueldo.Text != "" && Drpactivo.SelectedItem.ToString() != "")
        {
            if (PERSONASCER.PERSONASCERActualizarbyIDPERSONA(Convert.ToDecimal(idpersona), txtidentificacion.Text, txtnombres.Text, txtapellidos.Text, DateTime.Now,
                                                             txtemail.Text, "", "", "", "", 0, DateTime.Now, 0, DateTime.Now, txtcargo.Text, txtdependencia.Text, txtfunciones.Text, txtsueldo.Text, Drpactivo.SelectedItem.ToString()))
            {
                grdLista.EditIndex = -1;
                CARGARGRILLA();
                Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta la actualización de los datos", "sucessful", this, GetType());
            }
            else
            {
                Alerta.notiffy("Operacion incompleta", "No se han podido actualizar los cambios!", "warning", this, GetType());
                return;
            }
        }
    }
    protected void BTNMODALGUARDAR_Click(object sender, EventArgs e)
    {
        PERSONACERSELECCIONADA = (List <DCPERSONASCER>)Session["PERSONACERSELECCIONADA"];
        if (PERSONASCER.PERSONASCERActualizarbyIDPERSONA(PERSONACERSELECCIONADA[0].IDPERSONA, txt_IDENTIFICACION.Text, txt_NOMBRES.Text,
                                                         txt_APELLIDOS.Text, DateTime.Now, txt_EMAIL.Text, txt_TELEFONO.Text, txt_MOVIL.Text, "PRUEBA", "SOLTERO", 0, DateTime.Now, 0, DateTime.Now,
                                                         txt_CARGO.Text, txt_DEPENDENCIA.Text, txt_FUNCIONES.Text, txt_SUELDO.Text, "SI"))
        {
            //grdLista.EditIndex = -1;
            //CARGARGRILLA();
            Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta la actualización de los datos", "sucessful", this, GetType());
        }
        else
        {
            Alerta.notiffy("Operacion incompleta", "No se han podido actualizar los cambios!", "warning", this, GetType());
        }
        CARGARGRILLA3();
        //List<DCPERSONAS> lstPERSONAS = new List<DCPERSONAS>();
        //DataTable DTPERSONAS = new DataTable();
        //DTPERSONAS = PERSONAS.PERSONASObtenerbyCriterio(txt_NumeroId.Text, 0);
        //if (DTPERSONAS.Rows.Count == 0)
        //{
        //    PERSONAS.PERSONASRegistrar(0, txt_NumeroId.Text,
        //        cbo_tipoId.SelectedItem.Text, Convert.ToDateTime(dtpFechaExpedicion.Text), Convert.ToDateTime(dtpFechaNacimiento.Text),
        //        txt_nombres.Text.ToUpper(), txt_apellidos.Text.ToUpper(), txtDireccion.Text, cboPais.SelectedItem.Text,
        //        cboDepto.SelectedItem.Text, cboCiudad.SelectedItem.Text, TextCorreoElectronico.Text, cboGenero.SelectedItem.Text,
        //        txtTelefono.Text, txtCelular.Text, "PERSONA", "SI", 0, DateTime.Now, 0, DateTime.Now);

        //    //string script = " $.growl.notice({ title: 'Registro Exitoso',message: '' });";
        //    //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
        //    Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta en la BD, los datos de la persona", "sucessful", this, GetType());
        //}
        //else
        //{
        //    //string script = "alert(\"No se ha podido agregar la persona pues el numero de identificación ya existe!\");";
        //    //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
        //    Alerta.notiffy("Operacion incompleta", "No se ha podido agregar la persona, el numero de identificación ya existe!", "warning", this, GetType());
        //}
    }
    public void grdLista_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            int         index = Convert.ToInt32(e.CommandArgument);
            GridViewRow row   = grdLista.Rows[index];
            //decimal IDUSUARIOSELECCIONADODELAGRILLA = Convert.ToDecimal(grdLista.Rows[index].Cells[2].Text);
            var     idpersona = grdLista.DataKeys[index].Value;
            decimal IDUSUARIOSELECCIONADODELAGRILLA = Convert.ToDecimal(idpersona);
            bool    _actualizado;
            _actualizado = PERSONASCER.PERSONASCEREliminarbyIDPERSONA(IDUSUARIOSELECCIONADODELAGRILLA, 0, DateTime.Now);

            if (_actualizado == true)
            {
                CARGARGRILLA();
                Alerta.notiffy("Registro Exitoso", "Se ha eliminado correctamente la persona", "sucessful", this, GetType());
            }
            else
            {
                Alerta.notiffy("Registro Exitoso", "Se ha eliminado correctamente la persona", "warning", this, GetType());
            }
        }
    }
Example #8
0
 protected void Nottify(object sender, EventArgs e)
 {
     Alerta.notiffy("Sitio en construccion", "Muy pronto tendras mas informacion sobre nosotros, no desesperes", "sucessful", this, GetType());
 }
Example #9
0
    protected void GrdVw_Personas_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Editar"))
        {
            int    index = Convert.ToInt32(e.CommandArgument);
            string code  = GrdVw_Personas.DataKeys[index].Value.ToString();

            PERSONASELECCIONADA            = PERSONAS.PERSONASObtenerbyIDPERSONA(Convert.ToDecimal(code), 0);
            Session["PERSONASELECCIONADA"] = PERSONASELECCIONADA;
            txtCelular.Text            = PERSONASELECCIONADA[0].MOVIL;
            txtDireccion.Text          = PERSONASELECCIONADA[0].DIRECCION;
            txtTelefono.Text           = PERSONASELECCIONADA[0].TELEFONO;
            txt_apellidos.Text         = PERSONASELECCIONADA[0].APELLIDOS;
            txt_nombres.Text           = PERSONASELECCIONADA[0].NOMBRE;
            txt_NumeroId.Text          = PERSONASELECCIONADA[0].IDENTIFICACION;
            TextCorreoElectronico.Text = PERSONASELECCIONADA[0].CORREO;
            cboCiudad.SelectedValue    = PERSONASELECCIONADA[0].CIUDAD;
            cboDepto.SelectedValue     = PERSONASELECCIONADA[0].DEPTO;
            cboGenero.SelectedValue    = PERSONASELECCIONADA[0].GENERO;
            cboPais.SelectedValue      = PERSONASELECCIONADA[0].PAIS;
            cbo_tipoId.SelectedValue   = PERSONASELECCIONADA[0].TIPOIDENTIFICACION;
            dtpFechaExpedicion.Text    = PERSONASELECCIONADA[0].FECHAEXPEDICION.ToShortDateString();
            dtpFechaNacimiento.Text    = PERSONASELECCIONADA[0].FECHAEXPEDICION.ToShortDateString();

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#myModal').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                    "ModalScript", sb.ToString(), false);
        }
        else if (e.CommandName.Equals("Eliminar"))
        {
            int     index = Convert.ToInt32(e.CommandArgument);
            Decimal code  = Convert.ToDecimal(GrdVw_Personas.DataKeys[index].Value);

            bool _actualizado;
            _actualizado = PERSONAS.PERSONASEliminarbyIDPERSONA(code, 0, DateTime.Now);

            if (_actualizado == true)
            {
                CARGARGRILLA3();
                Alerta.notiffy("Eliminación Exitosa", "Se ha Eliminado correctamente la persona", "sucessful", this, GetType());
            }
            else
            {
                Alerta.notiffy("Operacion incompleta", "No se ha podido Eliminar la persona!", "warning", this, GetType());
            }
        }
        else if (e.CommandName.Equals("Detalle"))
        {
            int    index = Convert.ToInt32(e.CommandArgument);
            string code  = GrdVw_Personas.DataKeys[index].Value.ToString();

            PERSONASELECCIONADA             = PERSONAS.PERSONASObtenerbyIDPERSONA(Convert.ToDecimal(code), 0);
            Session["PERSONASELECCIONADA"]  = PERSONASELECCIONADA;
            LblIDPERSONA.InnerText          = PERSONASELECCIONADA[0].IDPERSONA.ToString();
            LblIDENTIFICACION.InnerText     = PERSONASELECCIONADA[0].IDENTIFICACION;
            LblTIPOIDENTIFICACION.InnerText = PERSONASELECCIONADA[0].TIPOIDENTIFICACION;
            LblFECHAEXPEDICION.InnerText    = PERSONASELECCIONADA[0].FECHAEXPEDICION.ToString();
            LblFECHANACIMIENTO.InnerText    = PERSONASELECCIONADA[0].FECHANACIMIENTO.ToString();
            LblNOMBRE.InnerText             = PERSONASELECCIONADA[0].NOMBRE;
            LblApellidos.InnerText          = PERSONASELECCIONADA[0].APELLIDOS;
            LblDIRECCION.InnerText          = PERSONASELECCIONADA[0].DIRECCION;
            LblPAIS.InnerText          = PERSONASELECCIONADA[0].PAIS;
            LblDEPTO.InnerText         = PERSONASELECCIONADA[0].DEPTO;
            LblCIUDAD.InnerText        = PERSONASELECCIONADA[0].CIUDAD;
            LblCORREO.InnerText        = PERSONASELECCIONADA[0].CORREO;
            LblGENERO.InnerText        = PERSONASELECCIONADA[0].GENERO;
            LblTELEFONO.InnerText      = PERSONASELECCIONADA[0].TELEFONO;
            LblMOVIL.InnerText         = PERSONASELECCIONADA[0].MOVIL;
            LblIDUSUARIOCREO.InnerText = PERSONASELECCIONADA[0].IDUSUARIOCREO.ToString();
            LblFECHACREO.InnerText     = PERSONASELECCIONADA[0].FECHACREO.ToString();

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#myModalDetail').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                    "ModalScript", sb.ToString(), false);
        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Editar"))
        {
            int    index = Convert.ToInt32(e.CommandArgument);
            string code  = GridView1.DataKeys[index].Value.ToString();

            PERSONACERSELECCIONADA            = PERSONASCER.PERSONASCERObtenerbyIDPERSONA(Convert.ToDecimal(code), 0);
            Session["PERSONACERSELECCIONADA"] = PERSONACERSELECCIONADA;
            txt_APELLIDOS.Text      = PERSONACERSELECCIONADA[0].APELLIDOS;
            txt_CARGO.Text          = PERSONACERSELECCIONADA[0].CARGO;
            txt_DEPENDENCIA.Text    = PERSONACERSELECCIONADA[0].DEPENDENCIA;
            txt_EMAIL.Text          = PERSONACERSELECCIONADA[0].EMAIL;
            txt_FUNCIONES.Text      = PERSONACERSELECCIONADA[0].FUNCIONES;
            txt_IDENTIFICACION.Text = PERSONACERSELECCIONADA[0].IDENTIFICACION;
            txt_MOVIL.Text          = PERSONACERSELECCIONADA[0].MOVIL;
            txt_NOMBRES.Text        = PERSONACERSELECCIONADA[0].NOMBRE;
            txt_SUELDO.Text         = PERSONACERSELECCIONADA[0].SUELDO;
            txt_TELEFONO.Text       = PERSONACERSELECCIONADA[0].TELEFONO;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#myModal').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                    "ModalScript", sb.ToString(), false);
        }
        else if (e.CommandName.Equals("Eliminar"))
        {
            int     index = Convert.ToInt32(e.CommandArgument);
            Decimal code  = Convert.ToDecimal(GridView1.DataKeys[index].Value);

            bool _actualizado;
            _actualizado = PERSONASCER.PERSONASCEREliminarbyIDPERSONA(code, 0, DateTime.Now);

            if (_actualizado == true)
            {
                CARGARGRILLA();
                CARGARGRILLA2();
                CARGARGRILLA3();
                Alerta.notiffy("Eliminación Exitosa", "Se ha Eliminado correctamente la persona", "sucessful", this, GetType());
            }
            else
            {
                Alerta.notiffy("Operacion incompleta", "No se ha podido Eliminar la persona!", "warning", this, GetType());
            }
            //DataTable dt = new DataTable();
            //dt = PERSONASCER.PERSONASCERObtener(0);
            //DetailsView1.Visible = false;
            //if (dt.Rows.Count > 0)
            //{
            //    DetailsView1.Visible = true;
            //    DetailsView1.DataSource = null;
            //    DetailsView1.DataBind();
            //    DetailsView1.DataSource = dt;
            //    DetailsView1.DataBind();
            //}
            //else
            //{
            //    DetailsView1.Visible = false;
            //    DetailsView1.DataSource = null;
            //    DetailsView1.DataBind();
            //}
        }
    }