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(); } } }
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>"); } }
public void insertarPersonal(E_PERSONA persona, E_CONSTANTE constante) { personaloDAO.insertarPersonal(persona, constante); }