private void buttonAceptar_Click(object sender, EventArgs e)
        {
            string patente = comboBoxPatente.Text;
            int    estado  = Convert.ToInt32(checkBoxEstado.Checked);
            int    chofer  = Convert.ToInt32(textBox_chofer_dni.Text);
            string nombre  = textBox_chofer_nombre.Text;

            var resultado = Mensaje_Pregunta("¿Está seguro que desea modificar el automovil?", "Modificar Automovil");

            if (resultado == DialogResult.Yes)
            {
                if (modificacionDeEstado == 0)
                {
                    if (Turno.CheckedItems.Count == 0)
                    {
                        Mensaje_Error("No se ha/n seleccionado turno/s"); return;
                    }
                }
                if (DAOAutomovil.choferAsignado(chofer, patente) == true)
                {
                    Mensaje_Error("El chofer ya posee auto"); return;
                }
                if (!(DAOPersona.choferActivo(chofer, nombre)))
                {
                    Mensaje_Error("El chofer no se encuentra habilitado"); return;
                }
                else
                {
                    DAOAutomovil.modificarAutomovilPorPatente(patente, estado, chofer);
                    this.actualizarTurnosAutomovil(patente);
                    Mensaje_OK("El automovil fue modificado");
                    this.Close();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        ///

        public override void mostrar(Form parent, params object[] values)
        {
            Persona persona      = (Persona)values[0];
            string  codigoPostal = values[1] as string;
            string  tipo         = values[2] as string;

            this.persona           = persona;
            textBox_Direccion.Text = persona.Direccion;
            textBox_Apellido.Text  = persona.Apellido;
            textBox_DNI.Text       = Convert.ToString(persona.Dni);
            dateTimePicker_FechaNacimiento.Text    = persona.FechaDeNacimiento.ToString();
            dateTimePicker_FechaNacimiento.Enabled = false;
            textBox_Telefono.Text     = Convert.ToString(persona.Telefono);
            textBox_Mail.Text         = persona.Mail;
            textBox_Nombre.Text       = persona.Nombre;
            textBox_CodigoPostal.Text = codigoPostal;
            if (!(DAOPersona.estadoDePerfil(persona.Telefono, persona.Dni, tipo)))
            {
                checkBox_Estado.Visible = false;
                label8.Visible          = false;
            }
            else
            {
                checkBox_Estado.Visible = false;
                label8.Visible          = false;
            }
            base.mostrar(parent);
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var resultado = Mensaje_Pregunta("¿Está seguro que desea guardar los datos ingresados en el formulario?", "Modificar Persona");

            if (resultado == DialogResult.Yes)
            {
                try
                {
                    if (textBox_DNI.Text == "")
                    {
                        string mensaje1 = "El dni está vacío"; Mensaje_Error(mensaje1);
                    }
                    int telefono1 = Convert.ToInt32(textBox_Telefono.Text);
                    int dni1      = Convert.ToInt32(textBox_DNI.Text);
                    if ((!ValidarTelefono(telefono1, dni1)))
                    {
                        string mensaje1 = "El telefono ingresado o el dni pertenece a otra persona"; Mensaje_Error(mensaje1);
                    }
                }
                catch { Mensaje_Error("El dni y el telefono son campos de numeros"); return; }
                if (!Validaciones())
                {
                    return;
                }
                int estadoPerfil = Convert.ToInt32(checkBox_Estado.Checked);
                DAOPersona.ModificarPersona(GenerarPersona(), persona.ID, estadoPerfil, tipo);
                Mensaje_OK("Los datos han sido almacenados con éxito");
                this.Close();
            }
        }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString.Count > 0)
        {
            EPersona user = new DAOPersona().BuscarToken(Request.QueryString[0] == null ? "" : Request.QueryString[0]);

            if (user == null)
            {
                this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('El Token es invalido. Genere uno nuevo');window.location=\"Inicio.aspx\"</script>");
            }
            else if (user.VencimientoToken < DateTime.Now)
            {
                this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('El Token esta vencido. Genere uno nuevo');window.location=\"Inicio.aspx\"</script>");
            }
            else
            {
                Session["user_id"] = user;
            }
        }

        else
        {
            Response.Redirect("Inicio.aspx");
        }
    }
示例#5
0
    protected void Unnamed5_Click(object sender, EventArgs e)
    {
        EPersona eUser = new EPersona();

        eUser.Username = tb_nombre.Text;
        eUser.Clave    = tb_pass.Text;

        eUser = new DAOPersona().Login_Vasbor(eUser);

        if (eUser == null)
        {
            ((Label)lb_error).Text = ("Usuario o clave incorecta");
        }
        else if (eUser.Id_rol == 1)
        {
            ((Label)lb_error).Text    = ("Administrador: " + eUser.Nombre);
            Session["validar_sesion"] = eUser;
            Response.Redirect("Crear_Persona.aspx");
        }
        else if (eUser.Id_rol == 2)
        {
            ((Label)lb_error).Text = ("Empleado: " + eUser.Nombre);
        }
        else if (eUser.Id_rol == 3)
        {
            ((Label)lb_error).Text = ("Usuario " + eUser.Nombre);
        }
    }
示例#6
0
    protected void btn_olvido_Click(object sender, EventArgs e)
    {
        EPersona            persona = new DAOPersona().BuscarCorreo(txt_correo.Text);
        ClientScriptManager csm     = this.ClientScript;

        /*if(persona.Clave == null)
         * {
         *  //Response.Redirect("Ingresar.aspx");
         *  //csm.RegisterClientScriptBlock(this.GetType(), " ", "<script type='text/javascript'>alert('Correo no encontrado');</script>");
         *  return;
         * }*/
        if (persona == null)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Correo no encontrado";
        }
        else if (persona.Id_rol == 3)
        {
            persona.Estado_id        = 2;
            persona.Token            = encriptar(JsonConvert.SerializeObject(persona));
            persona.VencimientoToken = DateTime.Now.AddDays(1);
            persona.Session          = persona.Session = "Sistema";

            new Correo().enviarCorreo(persona.Correo, persona.Token, "");
            new DAOPersona().ActualizarUsuario(persona);
            txt_correo.Text      = string.Empty;
            lb_mensaje.ForeColor = Color.Green;
            lb_mensaje.Text      = "Validacion exitosa. Revisar correo";
        }
    }
示例#7
0
    protected void Unnamed5_Click(object sender, EventArgs e)
    {
        EPersona            eUser = new EPersona();
        ClientScriptManager csm   = this.ClientScript;

        eUser.Username = tb_nombre.Text;
        eUser.Clave    = tb_pass.Text;

        eUser = new DAOPersona().Login_Vasbor(eUser);

        if (eUser == null)
        {
            ((Label)lb_error).Text = ("Usuario o clave incorecta");
        }
        else if (eUser.Estado_id == 2)
        {
            csm.RegisterClientScriptBlock(this.GetType(), " ", "<script type='text/javascript'>alert('Su cuenta esta en espera para la recuperacion de contraseña');</script>");
            return;
        }
        else if (eUser.Id_rol == 1)
        {
            ((Label)lb_error).Text    = ("Administrador: " + eUser.Nombre);
            Session["validar_sesion"] = eUser;
            Response.Redirect("Crear_Persona.aspx");
        }
        else if (eUser.Id_rol == 2)
        {
            ((Label)lb_error).Text = ("Empleado: " + eUser.Nombre);
        }
        else if (eUser.Id_rol == 3)
        {
            ((Label)lb_error).Text = ("Usuario " + eUser.Nombre);
        }
    }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            var resultado = Mensaje_Pregunta("¿Está seguro que desea dar la alta de la persona al sistema?", "Alta Persona");

            if (resultado == DialogResult.Yes)
            {
                try
                {
                    if (textBox_DNI.Text == "")
                    {
                        string mensaje1 = "El dni está vacío"; Mensaje_Error(mensaje1);
                    }
                    if (textBox_Telefono.Text == "")
                    {
                        string mensaje1 = "El telefono está vacío"; Mensaje_Error(mensaje1);
                    }
                    int telefono1 = Convert.ToInt32(textBox_Telefono.Text);
                    int dni1      = Convert.ToInt32(textBox_DNI.Text);
                    if (!(ValidarTelefono(telefono1, dni1)))
                    {
                        string mensaje1 = "El telefono ingresado o el dni pertenece a otra persona"; Mensaje_Error(mensaje1);
                    }
                }
                catch { Mensaje_Error("El dni y el telefono son campos de numeros"); return; }

                string mensaje;
                int    telefono  = Convert.ToInt32(textBox_Telefono.Text);
                int    dni       = Convert.ToInt32(textBox_DNI.Text);
                string nombre    = textBox_Nombre.Text;
                string apellido  = textBox_Apellido.Text;
                string direccion = textBox_Direccion.Text;
                string mail      = textBox_Mail.Text;
                string codPos    = textBox_CodigoPostal.Text;

                if (!Validaciones(tipo))
                {
                    return;
                }
                ;
                if (DAOPersona.existePersona(dni, tipo)) //Si existe la persona, devuelve un errr
                {
                    mensaje = "La persona ya se encuentraba ingresada"; Mensaje_Error(mensaje); return;
                }
                else if (!(DAOPersona.existePersona(dni, tipoOpuesto)))
                {
                    //Tipo: Variable que depende de donde viene el formulario (alta de chofer o cliente).
                    //Ese mismo tipo se usa para saber que tipo de persona se dará de alta en la BD.
                    DAOPersona.altaPersona(telefono, nombre, apellido, dni, dateTimePicker_FechaNacimiento.Value, direccion, mail, codPos, tipo);
                    Mensaje_OK("La persona ha sido dada de alta");
                }
                else //la persona ya existe en la base de datos, pero con otro rol.
                {
                    DAOPersona.actuaizarTipoPersona(telefono, codPos, tipo);
                    mensaje = "La persona ya se encuentraba ingresada, se le agregó el nuevo perfil"; Mensaje_OK(mensaje); return;
                }

                this.Close();
            }
        }
示例#9
0
        private void button_Buscar_Click(object sender, EventArgs e)
        {
            nombre   = textBox_Nombre.Text;
            apellido = textBox_Apellido.Text;
            doc      = textBox_Documento.Text;

            dataGridView_Seleccion.DataSource = DAOPersona.getPersona(nombre, apellido, doc, tipoPersona);
        }
示例#10
0
    protected void btn_confirmar_Click(object sender, EventArgs e)
    {
        EPersona user = new EPersona();

        user.Clave = txt_anterior.Text;

        user = new DAOPersona().cambiarClave(user);

        if (user.Clave == txt_anterior.Text)
        {
            if (txt_nueva.Text == txt_confirmar.Text)
            {
                EPersona user2 = new EPersona();
                user2.Id    = int.Parse(Session["id_usuario"].ToString());
                user2.Clave = txt_confirmar.Text;
                new DAOPersona().ActualizaClaveUsuario(user2);
                txt_confirmar.Text    = string.Empty;
                txt_nueva.Text        = string.Empty;
                txt_anterior.Text     = string.Empty;
                txt_anterior.Enabled  = true;
                txt_confirmar.Enabled = true;
                txt_nueva.Enabled     = true;
                lb_anterior.Enabled   = true;
                Lb_confirmar.Enabled  = true;
                Lb_nueva.Enabled      = true;
                btn_confirmar.Enabled = true;
                btn_volver.Enabled    = true;
                btn_cambiar.Enabled   = false;
                lb_mensaje.ForeColor  = Color.Green;
                lb_mensaje.Text       = "Contraseña actualizada";
                // Response.Redirect(Request.Url.ToString());
            }
            else
            {
                txt_anterior.Enabled  = true;
                txt_confirmar.Enabled = true;
                txt_nueva.Enabled     = true;
                lb_anterior.Enabled   = true;
                Lb_confirmar.Enabled  = true;
                Lb_nueva.Enabled      = true;
                btn_confirmar.Enabled = true;
                btn_volver.Enabled    = true;
                btn_cambiar.Enabled   = false;
                lb_mensaje.ForeColor  = Color.Red;
                lb_mensaje.Text       = "Nueva contraseña no coincide";
            }
        }
        else
        {
            txt_confirmar.Text   = string.Empty;
            txt_nueva.Text       = string.Empty;
            txt_anterior.Text    = string.Empty;
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "La contraseña ingresada no coincide con la registrada";
        }
    }
示例#11
0
 private bool ValidarTelefono(int telefono, int dni)
 {
     if ((DAOPersona.existeTelefono(telefono, dni, tipo)))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#12
0
        private void dataGridView_Seleccion_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > 0 || e.RowIndex < 0)
            {
                return;
            }
            int       id      = Convert.ToInt32(dataGridView_Seleccion.Rows[e.RowIndex].Cells[1].Value);
            DataTable table   = DAOPersona.getPersona(id);
            Persona   persona = DAOPersona.dataRowToPersona(table.Rows[0]);


            if (abm == 1)     //SI VIENE DE REGISTRAR VIAJE EL ABM ES 1 Y HACE ESTO
            {
                otro.setnombreChofer   = persona.Nombre;
                otro.setapellidoChofer = persona.Apellido;
                otro.setndniChofer     = persona.Dni.ToString();
                otro.Show();
                //fm.Show();
                cerrar();
            }
            else
            if (abm == 2)
            {
                otro.setnombreCliente   = persona.Nombre;
                otro.setapellidoCliente = persona.Apellido;
                otro.setndniCliente     = persona.Dni.ToString();
                cerrar();
                otro.Show();
            }
            else
            if (abm == 3)
            {
                altaAutomovil.settextBox_Chofer_dni = persona.Dni.ToString();
                altaAutomovil.settextBox_Chofer     = persona.Nombre + ' ' + persona.Apellido;
                cerrar();
                altaAutomovil.Show();
            }
            else
            if (abm == 4)
            {
                modificacionAutomovil.settextBox_Chofer_dni = persona.Dni.ToString();
                modificacionAutomovil.settextBox_Chofer     = persona.Nombre + ' ' + persona.Apellido;
                cerrar();
                modificacionAutomovil.Show();
            }
            else
            {
                nombre = persona.Nombre + ' ' + persona.Apellido;
                caller.mostrar(this.MdiParent, persona);
                cerrar();
                caller.Show();
            }
        }
示例#13
0
        private void button1_Click(object sender, EventArgs e)
        {
            var resultado = Mensaje_Pregunta("¿Está seguro que desea dar la baja a la persona del sistema?", "Baja Persona");

            if (resultado == DialogResult.Yes)
            {
                int id = persona.ID;
                DAOPersona.bajaPersona(id, tipo);
                Mensaje_OK("La persona ha sido dada de baja");
                this.Close();
            }
        }
示例#14
0
        private void dataGridView_Seleccion_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > 0 || e.RowIndex < 0)
            {
                return;
            }
            int       id           = Convert.ToInt32(dataGridView_Seleccion.Rows[e.RowIndex].Cells[1].Value);
            DataTable table        = DAOPersona.getPersona(id);
            Persona   persona      = DAOPersona.dataRowToPersona(table.Rows[0]);
            string    codigoPostal = DAOPersona.getCodigoPostal(persona.ID);

            caller.mostrar(this.MdiParent, persona, codigoPostal, tipoPersona);
            cerrar();
        }
    protected void btn_olvido_Click(object sender, EventArgs e)
    {
        EPersona            persona = new DAOPersona().BuscarCorreo(txt_correo.Text);
        ClientScriptManager csm     = this.ClientScript;

        if (persona == null)
        {
            csm.RegisterClientScriptBlock(this.GetType(), " ", "<script type='text/javascript'>alert('Correo no encontrado');</script>");
            return;
        }
        //persona.Clave = "";
        persona.Estado_id = 2;
        persona.Token     = encriptar(JsonConvert.SerializeObject(persona));
        new Correo().enviarCorreo(persona.Correo, persona.Token, "");
        new DAOPersona().ActualizarUsuario(persona);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["validar_sesion_usuario"] != null && ((EPersona)Session["validar_sesion_usuario"]).Id_rol == 3)
        {
            EPersona usuario = new EPersona();
            usuario        = new DAOPersona().obtenerUsuario(((EPersona)Session["validar_sesion_usuario"]).Id);
            lb_sesion.Text = usuario.Nombre + " " + usuario.Apellido; //((EPersona)Session["validar_sesion_usuario"]).Nombre.ToString() + " "+((EPersona)Session["validar_sesion_usuario"]).Apellido.ToString();

            l_nombre.Text   = usuario.Nombre;
            l_apellido.Text = usuario.Apellido;
            l_username.Text = usuario.Username;
            l_correo.Text   = usuario.Correo;
            l_telefono.Text = (usuario.Telefono).ToString();


            if (txt_Pnombre.Text.Equals(""))
            {
                txt_Pnombre.Text     = usuario.Nombre;
                txt_apellido.Text    = usuario.Apellido;
                txt_username.Text    = usuario.Username;
                txt_telefono.Text    = (usuario.Telefono).ToString();
                txt_correo.Text      = usuario.Correo;
                txt_Pnombre.Visible  = false;
                txt_apellido.Visible = false;
                txt_username.Visible = false;
                txt_correo.Visible   = false;
                txt_telefono.Visible = false;
            }
            btn_guardar.Visible  = false;
            btn_cancelar.Visible = false;
        }
        else
        {
            Response.Redirect("Ingresar.aspx");
        }
    }
        public Boolean ActualizarContraseña(string pEmail, string pClave)
        {
            DAOPersona dAOPersona = new DAOPersona();

            return(dAOPersona.ActualizarContraseña(pEmail, pClave));
        }
        public Boolean ValidarExistenciaEmail(string pEmail)
        {
            DAOPersona dAOPersona = new DAOPersona();

            return(dAOPersona.ValidarExistenciaEmail(pEmail));
        }
        public Boolean existeAdmin()
        {
            DAOPersona dAOPersona = new DAOPersona();

            return(dAOPersona.existeAdmin());
        }
        public int ObtenerIdRolAdministrador()
        {
            DAOPersona dAOPersona = new DAOPersona();

            return(dAOPersona.obtenerIdRolAdministrador());
        }
        public Boolean TraerPorPersonaClave(string var_usu, string var_clave)
        {
            DAOPersona daUsuario = new DAOPersona();

            return(daUsuario.TraerPorPersonaClave(var_usu, var_clave));
        }
        //public int Actualizar(Persona cliente)
        //{
        //    DAOPersona daUsuario = new DAOPersona();
        //    //return daUsuario.Actualizar(cliente);
        //}

        public int Eliminar(int Id)
        {
            DAOPersona daUsuario = new DAOPersona();

            return(daUsuario.Eliminar(Id));
        }
        public int Insertar(Persona cliente)
        {
            DAOPersona daUsuario = new DAOPersona();

            return(daUsuario.Insertar(cliente));
        }
        public Persona TraerPorId(int Id)
        {
            DAOPersona daUsuario = new DAOPersona();

            return(daUsuario.TraerPorId(Id));
        }
        public List <Persona> Listar()
        {
            DAOPersona daUsuario = new DAOPersona();

            return(daUsuario.Listar());
        }
示例#26
0
    protected void btn_ingresar_Click(object sender, EventArgs e)
    {
        EPersona eUser = new EPersona();

        eUser.Username = txt_username.Text;
        eUser.Clave    = txt_contraseña.Text;

        Empleado empleado = new Empleado();

        empleado.Username = txt_username.Text;
        empleado.Clave    = txt_contraseña.Text;

        Administrador administrador = new Administrador();

        administrador.Username = txt_username.Text;
        administrador.Clave    = txt_contraseña.Text;


        eUser         = new DAOPersona().Login_Vasbor(eUser);
        empleado      = new DAOEmpleado().Login_Vasbor(empleado);
        administrador = new DAOAdministrador().Login_Vasbor(administrador);



        if (administrador == null)
        {
            ((Label)lb_error).Text = ("Usuario o clave incorrecta");
        }
        else if (administrador.Id_rol == 1)
        {
            if (CheckBox1.Checked)
            {
                Response.Cookies["usern"].Value = txt_username.Text;
                Response.Cookies["pass"].Value  = txt_contraseña.Text;

                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(15);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(15);
            }
            else
            {
                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(-1);
            }
            Session["validar_sesion_administrador"] = administrador;
            Response.Redirect("SAdministrador.aspx");
            txt_username.Text   = string.Empty;
            txt_contraseña.Text = string.Empty;
        }

        if (empleado == null)
        {
            ((Label)lb_error).Text = ("Usuario o clave incorrecta");
        }
        else if (empleado != null && empleado.Estado_id == 3)
        {
            ((Label)lb_error).Text = ("Empleado Inhabilitado");
        }
        else if (empleado != null && empleado.Estado_id == 2)
        {
            ((Label)lb_error).Text = ("Recuperacion De Contraseña");
        }
        else if (empleado != null && empleado.Id_rol == 2 && empleado.Estado_id == 1)
        {
            if (CheckBox1.Checked)
            {
                Response.Cookies["usern"].Value = txt_username.Text;
                Response.Cookies["pass"].Value  = txt_contraseña.Text;

                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(15);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(15);
            }
            else
            {
                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(-1);
            }
            Session["validar_sesion_empleado"] = empleado;
            Session["id_empleado"]             = empleado.Id;
            Response.Redirect("CatalogoEmpleado.aspx");
            txt_username.Text   = string.Empty;
            txt_contraseña.Text = string.Empty;
        }

        if (eUser == null && empleado == null)
        {
            ((Label)lb_error).Text = ("Usuario o clave incorrecta");
        }
        else if (eUser != null && eUser.Estado_id == 3)
        {
            ((Label)lb_error).Text = ("Usuario Inhabilitado");
        }
        else if (eUser != null && eUser.Estado_id == 2)
        {
            ((Label)lb_error).Text = ("Recuperacion De Contraseña");
        }
        else if (eUser != null && eUser.Id_rol == 3 && eUser.Estado_id == 1)
        {
            if (CheckBox1.Checked)
            {
                Response.Cookies["usern"].Value = txt_username.Text;
                Response.Cookies["pass"].Value  = txt_contraseña.Text;

                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(15);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(15);
            }
            else
            {
                Response.Cookies["usern"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["pass"].Expires  = DateTime.Now.AddDays(-1);
            }
            if (eUser.Estado_id == 2)
            {
                ((Label)lb_error).Text = ("Usted esta en proceso de recuperacion de contraseña");
                return;
            }
            Session["validar_sesion_usuario"] = eUser;
            Session["id_usuario"]             = eUser.Id;
            Response.Redirect("Catalogo.aspx");
            txt_username.Text   = string.Empty;
            txt_contraseña.Text = string.Empty;
        }
    }
示例#27
0
    protected void btn_añadir_Click(object sender, EventArgs e)
    {
        EPersona persona = new EPersona();

        persona.Username       = txt_username.Text;
        persona.Correo         = txt_correo.Text;
        persona.Identificacion = long.Parse(txt_identi.Text);

        persona = new DAOPersona().BuscarUsername(persona);

        if (long.Parse(txt_identi.Text) <= 0)
        {
            lb_mensajeI.ForeColor = Color.Red;
            lb_mensajeI.Text      = "Ingrese numeros mayores a 0";
        }
        else if (long.Parse(txt_telefono.Text) <= 0)
        {
            lb_mensajeI0.ForeColor = Color.Red;
            lb_mensajeI0.Text      = "Ingrese numeros mayores a 0";
        }
        else if (persona == null)
        {
            if (txt_identi.Text != "" && txt_nombre.Text != "" && txt_apellido.Text != "" && txt_telefono.Text != "" && txt_username.Text != "" && txt_clave.Text != "")
            {
                EPersona user = new EPersona();
                user.Identificacion = long.Parse(txt_identi.Text);
                user.Nombre         = txt_nombre.Text;
                user.Apellido       = txt_apellido.Text;
                user.Telefono       = long.Parse(txt_telefono.Text);
                user.Correo         = txt_correo.Text;
                user.Username       = txt_username.Text;
                user.Clave          = txt_clave.Text;
                user.Id_rol         = 2;
                user.Session        = Session.SessionID.ToString();
                user.LastModifify   = DateTime.Now;
                user.Estado_id      = 1;
                new DAOPersona().InsertarUsuario(user);
                GridView1.DataBind();
                lb_mensaje.ForeColor = Color.Green;
                lb_mensaje.Text      = "Registro Exitoso";
            }
            else
            {
                lb_mensaje.ForeColor = Color.Red;
                lb_mensaje.Text      = "Error Campos Vacios";
            }
        }
        else if (persona.Username == txt_username.Text)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Usuario ya registrado";
        }
        else if (persona.Identificacion == long.Parse(txt_identi.Text))
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Codigo ya registrado";
        }
        else if (persona.Correo == txt_correo.Text)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Telefono ya registrado";
        }
        else
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Error campos vacios";
        }
    }
示例#28
0
        public TOPersona consultarPersona(String id)
        {
            DAOPersona dao = new DAOPersona();

            return(dao.consultarPersona(id));
        }
示例#29
0
 public void actualizarPersona(String id)
 {
     DAOPersona dao = new DAOPersona();
 }
    protected void btn_registrar_Click(object sender, EventArgs e)
    {
        EPersona persona = new EPersona();

        persona.Username       = txt_username.Text;
        persona.Correo         = txt_correo.Text;
        persona.Identificacion = long.Parse(txt_identificacion.Text);

        persona = new DAOPersona().BuscarUsername(persona);
        if (long.Parse(txt_telefono.Text) <= 0 || long.Parse(txt_identificacion.Text) <= 0)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Ingrese numeros mayores a 0";
        }
        else if (persona == null)
        {
            if (txt_identificacion.Text != "" && txt_nombre.Text != "" && txt_apellido.Text != "" && txt_correo.Text != "" && txt_telefono.Text != "" && txt_username.Text != "" && txt_contraseña.Text != "" && txt_confirmar.Text != "" && txt_contraseña.Text == txt_confirmar.Text)
            {
                EPersona user = new EPersona();
                user.Identificacion = long.Parse(txt_identificacion.Text);
                user.Nombre         = txt_nombre.Text;
                user.Apellido       = txt_apellido.Text;
                user.Correo         = txt_correo.Text;
                user.Telefono       = long.Parse(txt_telefono.Text);
                user.Username       = txt_username.Text;
                user.Clave          = txt_contraseña.Text;
                user.Id_rol         = 3;
                user.Estado_id      = 1;
                new DAOPersona().InsertarUsuario(user);
                lb_mensaje.ForeColor = Color.Green;
                lb_mensaje.Text      = "Registro Exitoso";
                Response.Redirect("Ingresar.aspx");
            }
            else if (txt_contraseña.Text != txt_confirmar.Text)
            {
                lb_mensaje.ForeColor = Color.Red;
                lb_mensaje.Text      = "Contraseñas no son iguales";
            }
            else
            {
                lb_mensaje.ForeColor = Color.Red;
                lb_mensaje.Text      = "Error Campos Vacios";
            }
        }
        else if (persona.Username == txt_username.Text)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Usuario ya registrado";
        }
        else if (persona.Correo == txt_correo.Text)
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Correo ya registrado";
        }
        else if (persona.Identificacion == long.Parse(txt_identificacion.Text))
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Identificacion ya registrada";
        }
        else
        {
            lb_mensaje.ForeColor = Color.Red;
            lb_mensaje.Text      = "Error campos vacios";
        }
    }