protected void btnBuscar_Click(object sender, EventArgs e)
        {
            if (txtDNIBuscar.Text != "")
            {
                N_Persona n_persona = new N_Persona();
                E_PERSONA e_persona = new E_PERSONA();

                e_persona = n_persona.buscarAlumno(Convert.ToInt32(txtDNIBuscar.Text));

                if (e_persona.pE_IDPERSONA != 0)
                {
                    txtDNIBuscar.Text = "";
                    txtId.Text        = e_persona.pE_IDPERSONA + "";
                    txtNombre.Text    = e_persona.pE_NOMBRE;
                    txtApellidos.Text = e_persona.pE_APELLIDOPAT + " " + e_persona.pE_APELLIDOMAT;
                }
                else
                {
                    Response.Write("<script>alert('APODERADO NO ESXISTE, REGISTRE UNO')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('CAMPO VACIO')</script>");
            }
        }
示例#2
0
        public void insertarAlumno(E_PERSONA persona)
        {
            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_INSERTAR_PERSONA_ADM_DOC";
                    comand.Parameters.AddWithValue("@PE_NOMBRE", persona.pE_NOMBRE);
                    comand.Parameters.AddWithValue("@PE_APELLIDOPAT", persona.pE_APELLIDOPAT);
                    comand.Parameters.AddWithValue("@PE_APELLIDOMAT", persona.pE_APELLIDOMAT);
                    comand.Parameters.AddWithValue("@PE_IDENTIFICACION", persona.pE_IDENTIFICACION);
                    comand.Parameters.AddWithValue("@PE_FECHANAC", Convert.ToDateTime(persona.pE_FECHANAC));
                    comand.Parameters.AddWithValue("@PE_TELEFONO", persona.pE_TELEFONO);
                    comand.Parameters.AddWithValue("@PE_DIRECCION", persona.pE_DIRECCION);
                    comand.Parameters.AddWithValue("@PE_SEXO", persona.pE_SEXO);
                    comand.Parameters.AddWithValue("@PE_ESTADO", persona.pE_ESTADO);
                    comand.Parameters.AddWithValue("@IDUSURIO", 2);

                    comand.CommandType = CommandType.StoredProcedure;
                    comand.ExecuteNonQuery();
                }
            }
        }
        private string CreateToken(E_PERSONA pPersona)
        {
            //Set issued at date
            DateTime issuedAt = DateTime.UtcNow;
            //set the time when it expires
            DateTime expires = DateTime.UtcNow.AddDays(Convert.ToInt32(ConfigurationManager.AppSettings["JWT_EXPIRE_DAYS"]));
            //DateTime expires = DateTime.UtcNow.AddMinutes(Convert.ToInt32(ConfigurationManager.AppSettings["JWT_EXPIRE_DAYS"]));

            //http://stackoverflow.com/questions/18223868/how-to-encrypt-jwt-security-token
            var tokenHandler = new JwtSecurityTokenHandler();

            //create a identity and add claims to the user which we want to log in
            ClaimsIdentity claimsIdentity = new ClaimsIdentity(new[]
            {
                new Claim(ClaimTypes.Name, pPersona.Nombre)
            });

            string sec                = ConfigurationManager.AppSettings["JWT_SECRET_KEY"];
            var    now                = DateTime.UtcNow;
            var    securityKey        = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(System.Text.Encoding.Default.GetBytes(sec));
            var    signingCredentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(securityKey, Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature);
            //create the jwt
            var token =
                (JwtSecurityToken)
                tokenHandler.CreateJwtSecurityToken(issuer: ConfigurationManager.AppSettings["JWT_ISSUER_TOKEN"], audience: ConfigurationManager.AppSettings["JWT_AUDIENCE_TOKEN"],
                                                    subject: claimsIdentity, notBefore: issuedAt, expires: expires, signingCredentials: signingCredentials);
            var tokenString = tokenHandler.WriteToken(token);

            return(tokenString);
        }
        /// <summary>
        /// Método para actualizar conductor
        /// <param name="pPersona">Objeto de tipo E_PERSONA con datos a actualizar</param>
        /// <returns> Objeto tipo E_MENSAJE con los datos del movimiento </returns>
        /// </summary>
        public E_MENSAJE Editar(E_PERSONA pPersona)
        {
            try
            {
                using (context = new ViajesEntities())
                {
                    ObjectParameter RET_ID_PERSONA    = new ObjectParameter("RET_ID_PERSONA", typeof(string));
                    ObjectParameter RET_NUMEROERROR   = new ObjectParameter("RET_NUMEROERROR", typeof(string));
                    ObjectParameter RET_MENSAJEERROR  = new ObjectParameter("RET_MENSAJEERROR", typeof(string));
                    ObjectParameter RET_VALORDEVUELTO = new ObjectParameter("RET_VALORDEVUELTO", typeof(string));


                    context.SP_PERSONA(pPersona.IdPersona, pPersona.Nombre, pPersona.Telefono, pPersona.Fotografia,
                                       pPersona.Acceso.Email, pPersona.Acceso.Password, pPersona.Acceso.TipoUsuario, pPersona.Acceso.TokenFirebase, pPersona.Sexo,
                                       pPersona.Conductor.Colonia, pPersona.Conductor.Calle, pPersona.Conductor.NoExt, pPersona.Conductor.NoInt, pPersona.Conductor.NoLicencia, pPersona.Conductor.NoPlacas, pPersona.Conductor.Tipo,
                                       pPersona.Acceso.ClavePassword, "U", pPersona.IdPersonaMod, RET_ID_PERSONA, RET_NUMEROERROR, RET_MENSAJEERROR, RET_VALORDEVUELTO);

                    E_MENSAJE vMensaje = new E_MENSAJE {
                        RET_ID_PERSONA = int.Parse(RET_ID_PERSONA.Value.ToString()), RET_NUMEROERROR = int.Parse(RET_NUMEROERROR.Value.ToString()), RET_MENSAJEERROR = RET_MENSAJEERROR.Value.ToString(), RET_VALORDEVUELTO = RET_VALORDEVUELTO.Value.ToString()
                    };
                    return(vMensaje);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public List <E_PERSONA> ListarPersona()
        {
            List <E_PERSONA> listaPersona = new List <E_PERSONA>();

            using (SqlCommand cmd = conx.CreateCommand())
            {
                cmd.CommandText = "PLANILLA.LISTAR_PERSONA";
                cmd.CommandType = CommandType.StoredProcedure;
                conx.Open();
                E_PERSONA persona = new E_PERSONA();;
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        persona.id_persona     = reader.GetString(reader.GetOrdinal("id_persona"));
                        persona.nombre         = reader.GetString(reader.GetOrdinal("nombre"));
                        persona.ape_paterno    = reader.GetString(reader.GetOrdinal("ape_paterno"));
                        persona.ape_materno    = reader.GetString(reader.GetOrdinal("ape_materno"));
                        persona.dni            = reader.GetString(reader.GetOrdinal("dni"));
                        persona.Fecha_Registro = reader.GetDateTime(reader.GetOrdinal("fecha_registro"));
                        persona.id_rol         = reader.GetString(reader.GetOrdinal("id_rol"));
                        listaPersona.Add(persona);
                    }
                }
                conx.Close();
            }
            return(listaPersona);
        }
        public List <E_PERSONA> listarDocentes()
        {
            List <E_PERSONA> Lista = new List <E_PERSONA>();

            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_MOSTRAR_DOCENTE";
                    comand.CommandType = CommandType.StoredProcedure;

                    using (SqlDataReader dr = comand.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            E_PERSONA alumno = new E_PERSONA();
                            alumno.pE_IDPERSONA      = Convert.ToInt32(dr["ID"]);
                            alumno.pE_NOMBRE         = dr["NOMBRE"].ToString();
                            alumno.pE_APELLIDOPAT    = dr["APELLIDO PAT"].ToString();
                            alumno.pE_APELLIDOMAT    = dr["APELLIDO MAT"].ToString();
                            alumno.pE_IDENTIFICACION = dr["IDENTIFICACION"].ToString();

                            Lista.Add(alumno);
                        }
                    }
                }
            }
            return(Lista);
        }
        public void actualizarDocente(E_PERSONA persona)
        {
            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_EDITAR_PERSONA";
                    comand.Parameters.AddWithValue("@PE_IDPERSONA", persona.pE_IDPERSONA);
                    comand.Parameters.AddWithValue("@PE_NOMBRE", persona.pE_NOMBRE);
                    comand.Parameters.AddWithValue("@PE_APELLIDOPAT", persona.pE_APELLIDOPAT);
                    comand.Parameters.AddWithValue("@PE_APELLIDOMAT", persona.pE_APELLIDOMAT);
                    comand.Parameters.AddWithValue("@PE_IDENTIFICACION", persona.pE_IDENTIFICACION);
                    comand.Parameters.AddWithValue("@PE_FECHANAC", Convert.ToDateTime(persona.pE_FECHANAC));
                    comand.Parameters.AddWithValue("@PE_TELEFONO", persona.pE_TELEFONO);
                    comand.Parameters.AddWithValue("@PE_DIRECCION", persona.pE_DIRECCION);
                    comand.Parameters.AddWithValue("@PE_ESTADO", persona.pE_ESTADO);



                    comand.CommandType = CommandType.StoredProcedure;
                    comand.ExecuteNonQuery();
                }
            }
        }
示例#8
0
        public E_PERSONA buscarAlumno(int documento)
        {
            E_PERSONA persona = new E_PERSONA();

            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_BUSCAR_ALUMNO";
                    comand.Parameters.AddWithValue("@PE_IDENTIFICACION", documento);
                    comand.CommandType = CommandType.StoredProcedure;

                    SqlDataReader reader = comand.ExecuteReader();

                    while (reader.Read())
                    {
                        persona.pE_IDPERSONA   = reader.GetInt32(0);
                        persona.pE_NOMBRE      = reader.GetString(1);
                        persona.pE_APELLIDOPAT = reader.GetString(2);
                        persona.pE_APELLIDOMAT = reader.GetString(3);
                    }
                    return(persona);
                }
            }
        }
示例#9
0
        public E_PERSONA perfilPersona()
        {
            E_PERSONA persona = new E_PERSONA();

            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_MOSTRAR_PERSONA";
                    comand.Parameters.AddWithValue("@PE_IDPERSONA", UsuarioLoginCache.PE_IDPERSONA);
                    comand.CommandType = CommandType.StoredProcedure;

                    SqlDataReader reader = comand.ExecuteReader();

                    while (reader.Read())
                    {
                        persona.pE_NOMBRE         = reader.GetString(0);
                        persona.pE_APELLIDOPAT    = reader.GetString(1);
                        persona.pE_APELLIDOMAT    = reader.GetString(2);
                        persona.pE_IDENTIFICACION = reader.GetString(3);
                        persona.pE_FECHANAC       = reader.GetDateTime(4) + "";
                        persona.pE_TELEFONO       = reader.GetString(5);
                        persona.pE_DIRECCION      = reader.GetString(6);
                    }
                    return(persona);
                }
            }
        }
        public void insertarPersonal(E_PERSONA persona, E_CONSTANTE constante)
        {
            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_INSERTAR_PERSONA_PERSONAL";
                    comand.Parameters.AddWithValue("@PE_NOMBRE", persona.pE_NOMBRE);
                    comand.Parameters.AddWithValue("@PE_APELLIDOPAT", persona.pE_APELLIDOPAT);
                    comand.Parameters.AddWithValue("@PE_APELLIDOMAT", persona.pE_APELLIDOMAT);
                    comand.Parameters.AddWithValue("@PE_IDENTIFICACION", persona.pE_IDENTIFICACION);
                    comand.Parameters.AddWithValue("@PE_FECHANAC", Convert.ToDateTime(persona.pE_FECHANAC));
                    comand.Parameters.AddWithValue("@PE_TELEFONO", persona.pE_TELEFONO);
                    comand.Parameters.AddWithValue("@PE_DIRECCION", persona.pE_DIRECCION);
                    comand.Parameters.AddWithValue("@PE_SEXO", persona.pE_SEXO);
                    comand.Parameters.AddWithValue("@PE_ESTADO", persona.pE_ESTADO);
                    comand.Parameters.AddWithValue("@CN_IDTIPOPERSONA", constante.cN_IDCONSTANTE);
                    comand.Parameters.AddWithValue("@US_IDUSUARIO", UsuarioLoginCache.US_IDUSUARIO);

                    comand.CommandType = CommandType.StoredProcedure;
                    comand.ExecuteNonQuery();
                }
            }
        }
示例#11
0
        /// <summary>
        /// Método para realizar crear una persona
        /// <param name="pPersona">Objeto de tipo E_PERSONA con datos de la persona a insertar</param>
        /// /// <param name="pAcceso">Objeto de tipo E_ACCESO_PERSONA con datos para inicio de sesión</param>
        /// <returns> Objeto tipo E_MENSAJE con los datos del movimiento </returns>
        /// </summary>
        public E_MENSAJE CreaPersona(E_PERSONA pPersona, E_ACCESO_PERSONA pAcceso)
        {
            try
            {
                using (context = new ViajesEntities())
                {
                    ObjectParameter RET_ID_PERSONA    = new ObjectParameter("RET_ID_PERSONA", typeof(string));
                    ObjectParameter RET_NUMEROERROR   = new ObjectParameter("RET_NUMEROERROR", typeof(string));
                    ObjectParameter RET_MENSAJEERROR  = new ObjectParameter("RET_MENSAJEERROR", typeof(string));
                    ObjectParameter RET_VALORDEVUELTO = new ObjectParameter("RET_VALORDEVUELTO", typeof(string));


                    context.SP_PERSONA(pPersona.IdPersona, pPersona.Nombre, pPersona.Telefono, pPersona.Fotografia,
                                       pAcceso.Email, pAcceso.Password, pAcceso.TipoUsuario, pAcceso.TokenFirebase, "U",
                                       null, null, null, null, null, null, null, pAcceso.ClavePassword, "I", pPersona.IdPersonaMod,
                                       RET_ID_PERSONA, RET_NUMEROERROR, RET_MENSAJEERROR, RET_VALORDEVUELTO);

                    E_MENSAJE vMensaje = new E_MENSAJE {
                        RET_ID_PERSONA = int.Parse(RET_ID_PERSONA.Value.ToString()), RET_NUMEROERROR = int.Parse(RET_NUMEROERROR.Value.ToString()), RET_MENSAJEERROR = RET_MENSAJEERROR.Value.ToString(), RET_VALORDEVUELTO = RET_VALORDEVUELTO.Value.ToString()
                    };
                    return(vMensaje);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#12
0
        /// <summary>
        /// Método para insertar personas
        /// <param name="pPersona">Objeto de tipo E_PERSONA con datos a insertar</param>
        /// <returns> Objeto tipo E_MENSAJE con los datos del movimiento </returns>
        /// </summary>
        public E_MENSAJE Agregar(E_PERSONA pPersona)
        {
            try
            {
                using (context = new ViajesEntities())
                {
                    ObjectParameter RET_NUMEROERROR   = new ObjectParameter("RET_NUMEROERROR", typeof(string));
                    ObjectParameter RET_MENSAJEERROR  = new ObjectParameter("RET_MENSAJEERROR", typeof(string));
                    ObjectParameter RET_VALORDEVUELTO = new ObjectParameter("RET_VALORDEVUELTO", typeof(string));


                    /*context.SP_PRODUCTO(pProducto.IdProducto, pProducto.Nombre, pProducto.Descripcion, pProducto.Precio,
                     *                   pProducto.Fotografia, pProducto.IdLocal, pProducto.IdPersonaAlta, pProducto.Estatus, "I",
                     *                   RET_NUMEROERROR, RET_MENSAJEERROR, RET_VALORDEVUELTO);*/

                    E_MENSAJE vMensaje = new E_MENSAJE {
                        RET_NUMEROERROR = int.Parse(RET_NUMEROERROR.Value.ToString()), RET_MENSAJEERROR = RET_MENSAJEERROR.Value.ToString(), RET_VALORDEVUELTO = RET_VALORDEVUELTO.Value.ToString()
                    };
                    return(vMensaje);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void insertarDocente(E_PERSONA persona, E_NIVEL nivel)
        {
            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_INSERTAR_PERSONA_DOCENTE";
                    comand.Parameters.AddWithValue("@PE_NOMBRE", persona.pE_NOMBRE);
                    comand.Parameters.AddWithValue("@PE_APELLIDOPAT", persona.pE_APELLIDOPAT);
                    comand.Parameters.AddWithValue("@PE_APELLIDOMAT", persona.pE_APELLIDOMAT);
                    comand.Parameters.AddWithValue("@PE_IDENTIFICACION", persona.pE_IDENTIFICACION);
                    comand.Parameters.AddWithValue("@PE_FECHANAC", Convert.ToDateTime(persona.pE_FECHANAC));
                    comand.Parameters.AddWithValue("@PE_TELEFONO", persona.pE_TELEFONO);
                    comand.Parameters.AddWithValue("@PE_DIRECCION", persona.pE_DIRECCION);
                    comand.Parameters.AddWithValue("@PE_SEXO", persona.pE_SEXO);
                    comand.Parameters.AddWithValue("@PE_ESTADO", persona.pE_ESTADO);
                    comand.Parameters.AddWithValue("@NI_IDNIVEL", nivel.nI_IDNIVEL);
                    comand.Parameters.AddWithValue("@US_IDUSUARIO", UsuarioLoginCache.US_IDUSUARIO);

                    comand.CommandType = CommandType.StoredProcedure;

                    comand.ExecuteNonQuery();
                }
            }
        }
        public static void ActualizarAlumno(String id, String nom, String pat, String mat, String dni, String fecha, String tel, String direccion)
        {
            N_Docente n_alumno = new N_Docente();

            E_PERSONA e_persona = new E_PERSONA(Convert.ToInt32(id), nom, pat, mat, dni, fecha, tel, direccion, "A");

            n_alumno.actualizarAlumno(e_persona);
        }
        public static void EliminarAlumno(String id)
        {
            N_Docente n_alumno = new N_Docente();

            E_PERSONA e_persona = new E_PERSONA(Convert.ToInt32(id));

            n_alumno.eliminarAlumno(e_persona);
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            N_Persona n_persona = new N_Persona();

            E_PERSONA e_persona = new E_PERSONA(txtNombre.Text, txtApellidoPat.Text, txtApellidoMat.Text, txtdni.Text, txtFecha.Text, txtTelefono.Text, txtDireccion.Text, txtSexo.Text, "A");


            n_persona.insertarPersona(e_persona);
        }
示例#17
0
 /// <summary>
 /// Método para editar persona
 /// <param name="Entidad">Datosa editar</param>
 /// <returns> Objeto tipo E_MENSAJE con el resultado de la operación </returns>
 /// </summary>
 public E_MENSAJE Editar(E_PERSONA Entidad)
 {
     try
     {
         PersonaOperaciones pDatos = new PersonaOperaciones();
         return(pDatos.Editar(Entidad));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#18
0
 /// <summary>
 /// Método para realizar crear una persona
 /// <param name="pPersona">Objeto de tipo E_PERSONA con datos de la persona a insertar</param>
 /// /// <param name="pAcceso">Objeto de tipo E_ACCESO_PERSONA con datos para inicio de sesión</param>
 /// <returns> Objeto tipo E_MENSAJE con los datos del movimiento </returns>
 /// </summary>
 public E_MENSAJE ActualizarPersona(E_PERSONA pPersona, E_ACCESO_PERSONA pAcceso)
 {
     try
     {
         LoginOperaciones pDatos = new LoginOperaciones();
         return(pDatos.CreaPersona(pPersona, pAcceso));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#19
0
        public void cargarDatos()
        {
            N_Persona n_persona = new N_Persona();
            E_PERSONA e_persona = new E_PERSONA();

            e_persona = n_persona.perfilPersona();

            txtNombres.Text   = e_persona.pE_NOMBRE;
            txtApellidos.Text = e_persona.pE_APELLIDOPAT + " " + e_persona.pE_APELLIDOMAT;
            txtNumDoc.Text    = e_persona.pE_IDENTIFICACION + "";
            txtFechaNaci.Text = e_persona.pE_FECHANAC + "";
            txtTelefono.Text  = e_persona.pE_TELEFONO + "";
            txtDireccion.Text = e_persona.pE_DIRECCION;
        }
示例#20
0
        protected void btnRegistrarDocente_Click1(object sender, EventArgs e)
        {
            if (txtNombre.Text != "" || txtApePa.Text != "" || txtApeMa.Text != "" || txtNumDoc.Text != "" ||
                txtNaci.Text != "" || txtTelefono.Text != "" || txtDireccion.Text != "" || Nivel.Text != "")
            {
                N_Docente n_docente = new N_Docente();

                E_PERSONA e_persona = new E_PERSONA(txtNombre.Text, txtApePa.Text, txtApeMa.Text, txtNumDoc.Text, txtNaci.Text, txtTelefono.Text, txtDireccion.Text, Nivel.Text, "A");
                E_NIVEL   e_nivel   = new E_NIVEL(Convert.ToInt32(Nivel.Text));
                n_docente.insertarDocente(e_persona, e_nivel);
            }
            else
            {
                Response.Write("<script>alert('INGRESE TODOS LOS CAMPOS')</script>");
            }
        }
示例#21
0
        public void eliminarAlumno(E_PERSONA persona)
        {
            using (var conexion = GetConnection())
            {
                conexion.Open();
                using (var comand = new SqlCommand())
                {
                    comand.Connection  = conexion;
                    comand.CommandText = "SP_ELIMINAR_PERSONA";
                    comand.Parameters.AddWithValue("@PE_IDPERSONA", persona.pE_IDPERSONA);

                    comand.CommandType = CommandType.StoredProcedure;
                    comand.ExecuteNonQuery();
                }
            }
        }
        protected void btnRegistrarAlumno_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "" || txtApePa.Text != "" || txtApeMa.Text != "" || txtNumDoc.Text != "" ||
                txtNaci.Text != "" || txtTelefono.Text != "" || txtDireccion.Text != "")
            {
                N_Docente n_alumno = new N_Docente();

                E_PERSONA e_persona = new E_PERSONA(txtNombre.Text, txtApePa.Text, txtApeMa.Text, txtNumDoc.Text, txtNaci.Text, txtTelefono.Text, txtDireccion.Text, txtSexo.Text, "A");

                n_alumno.insertarAlumno(e_persona);

                limpiarCampos();
            }
            else
            {
                Response.Write("<script>alert('INGRESE TODOS LOS CAMPOS')</script>");
            }
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text != "" || txtApellidoPat.Text != "" || txtApellidoMat.Text != "" || txtNroDocumento.Text != "" ||
                txtFecha.Text != "" || txtTelefono.Text != "" || txtDireccion.Text != "")
            {
                N_Personal n_peronal = new N_Personal();

                E_PERSONA   e_persona   = new E_PERSONA(txtNombres.Text, txtApellidoPat.Text, txtApellidoMat.Text, txtNroDocumento.Text, txtFecha.Text, txtTelefono.Text, txtDireccion.Text, ddlSexo.Text, "A");
                E_CONSTANTE e_constante = new E_CONSTANTE(Convert.ToInt32(ddlTipoPersona.Text));

                n_peronal.insertarPersonal(e_persona, e_constante);

                Response.Write("<script>alert('AUTORIDAD REGISTRADA CON EXITO')</script>");

                limpiarCampos();
            }
            else
            {
                Response.Write("<script>alert('INGRESE TODOS LOS CAMPOS')</script>");
            }
        }
示例#24
0
 public void insertarDocente(E_PERSONA persona, E_NIVEL nivel)
 {
     docenteDao.insertarDocente(persona, nivel);
 }
 public void insertarPersona(E_PERSONA persona)
 {
     personaDAO.insertarPersonal(persona);
 }
示例#26
0
 public void actualizarDocente(E_PERSONA persona)
 {
     docenteDao.actualizarDocente(persona);
 }
示例#27
0
 public void insertarAlumno(E_PERSONA persona)
 {
     alumnoDAO.insertarAlumno(persona);
 }
示例#28
0
 public void actualizarAlumno(E_PERSONA persona)
 {
     alumnoDAO.actualizarAlumno(persona);
 }
示例#29
0
 public void eliminarAlumno(E_PERSONA persona)
 {
     alumnoDAO.eliminarAlumno(persona);
 }
        public async Task <HttpResponseMessage> Registrar([FromBody] InsertaPersonaRequest pInsertaPersonaRequest)
        {
            var respuesta    = new InsertaPersonaResponse {
            };
            var    strMetodo = "WSViajes - Registrar ";
            string sid       = Guid.NewGuid().ToString();

            try
            {
                if (pInsertaPersonaRequest == null)
                {
                    respuesta.Mensaje = "No se recibió usuario.";
                }
                else if (String.IsNullOrEmpty(pInsertaPersonaRequest.Nombre))
                {
                    respuesta.Mensaje = "El elemento  <<Nombre>> no puede estar vacío.";
                }

                /*else if (String.IsNullOrEmpty(pInsertaPersonaRequest.ApePaterno))
                 *  respuesta.Mensaje = "El elemento  <<ApePaterno>> no puede estar vacío.";*/
                else if (String.IsNullOrEmpty(pInsertaPersonaRequest.Telefono))
                {
                    respuesta.Mensaje = "El elemento  <<Telefono>> no puede estar vacío.";
                }

                /*else if (String.IsNullOrEmpty(pInsertaPersonaRequest.Fotografia))
                 *  respuesta.Mensaje = "El elemento  <<Fotografia>> no puede estar vacío.";*/
                else if (String.IsNullOrEmpty(pInsertaPersonaRequest.Email))
                {
                    respuesta.Mensaje = "El elemento  <<Email>> no puede estar vacío.";
                }
                else if (String.IsNullOrEmpty(pInsertaPersonaRequest.Password))
                {
                    respuesta.Mensaje = "Debe especificar el <<Password>> no puede estar vacío.";
                }
                else if (pInsertaPersonaRequest.TipoUsuario <= 0)
                {
                    respuesta.Mensaje = "Debe especificar el <<TipoUsuario>> no puede estar vacío y debe ser mayor a 0.";
                }
                else
                {
                    var objAcceso = new E_ACCESO_PERSONA {
                        Email = pInsertaPersonaRequest.Email, Password = pInsertaPersonaRequest.Password, TipoUsuario = pInsertaPersonaRequest.TipoUsuario, TokenFirebase = pInsertaPersonaRequest.TokenFirebase
                    };
                    var objPersona = new E_PERSONA {
                        Nombre = pInsertaPersonaRequest.Nombre, Telefono = pInsertaPersonaRequest.Telefono, Fotografia = pInsertaPersonaRequest.Fotografia
                    };
                    var pNegocio = new LoginNegocio();
                    var respuestaCrearPersona = pNegocio.CreaPersona(objPersona, objAcceso);

                    if (respuestaCrearPersona.RET_NUMEROERROR >= 0)
                    {
                        var creaClienteOpen     = new OpenPayFunctions().CreateCustomer(pInsertaPersonaRequest.Nombre, "", pInsertaPersonaRequest.Email);
                        var personaRecienCreada = await new AccesoNegocio().ConsultaPorCorreo(pInsertaPersonaRequest.Email.Trim());
                        new PersonaNegocio().AgregarClienteOpenPay(personaRecienCreada.IdPersona, creaClienteOpen.Id);
                        new Mailer().Send(pInsertaPersonaRequest.Email, "Bienvenido a nuestra plataforma FASTRUN", "Te damos la bienvenida a nuestra plataforma de pedidos y compras a través de tu aplicación. <br/> <b>¡¡Ha empezar a ordenar!!</b><br/><br/><p>Saludos del equipo FastRun.</p>", pInsertaPersonaRequest.Nombre);
                    }

                    respuesta.Exito   = respuestaCrearPersona.RET_NUMEROERROR >= 0;
                    respuesta.Mensaje = respuestaCrearPersona.RET_VALORDEVUELTO;
                }
            }
            catch (ServiceException Ex)
            {
                respuesta.Exito       = false;
                respuesta.CodigoError = Ex.Codigo;
                respuesta.Mensaje     = Ex.Message;
            }
            catch (Exception Ex)
            {
                string strErrGUI  = Guid.NewGuid().ToString();
                string strMensaje = "Error Interno del Servicio [GUID: " + strErrGUI + "].";
                Log.Error(Ex, "[" + strMetodo + "]" + "[SID:" + sid + "]" + strMensaje);

                respuesta.Exito       = false;
                respuesta.CodigoError = 10001;
                respuesta.Mensaje     = "ERROR INTERNO DEL SERVICIO [" + strErrGUI + "]";
            }

            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, respuesta));
        }