protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ddlSexo.Items.Add(new ListItem("Seleccione", "0")); ddlSexo.Items.Add(new ListItem("Masculino", "M")); ddlSexo.Items.Add(new ListItem("Femenino", "F")); if (Request.QueryString["IdUsuario"] != null) { hdfId.Value = Request.QueryString["IdUsuario"]; svrPersona.IsvcPersonaClient client = new svrPersona.IsvcPersonaClient(); PersonaBO objPersona = client.Consultar(int.Parse(hdfId.Value)).First(); txtNombre.Text = objPersona.Nombre; cldFechaNacimiento.SelectedDate = objPersona.FechaNacimiento; ddlSexo.SelectedValue = objPersona.Sexo.ToString(); btnRegistrar.Text = "Actualizar"; } else { btnRegistrar.Text = "Insertar"; } } }
public FrmUsuario(Form parent) { InitializeComponent(); this.parent = parent; ubo = new UsuarioBO(); pbo = new PersonaBO(); validar = new ValidaDatos(); tabla.Columns[0].ValueType = typeof(object); }
private IPersonaBO CrearSession() { if (Session["PersonaBO"] == null) { Session["PersonaBO"] = new PersonaBO(); } IPersonaBO personaSession = Session["PersonaBO"] as PersonaBO; return(personaSession); }
public MantenimientoPersona(Form parent, bool esadmin, string u) { InitializeComponent(); this.parent = parent; adminPermisos(esadmin); usu = u; log = new PersonaBO(); lista = new List <Persona>(); elimina = new Elimina(); }
public Login() { InitializeComponent(); log = new AdminBO(); logU = new UsuarioBO(); ubo = new UsuarioBO(); pbo = new PersonaBO(); encripta = new Encripta(); txtUsuAdmin.Text = "Admin"; txtPassAdmin.Text = "Admin123*"; }
public Elimina() { usuario = new UsuarioBO(); listaUsuarios = new List <Usuario>(); materia = new MateriaBO(); listaMaterias = new List <Materias>(); matricula = new MatriculaEstudianteBO(); listaMatricula = new List <MatriculaEstudiante>(); persona = new PersonaBO(); listaPersona = new List <Persona>(); }
public EditaPersona(Form parent, string u, string idB) { InitializeComponent(); this.parent = parent; lblTitulo.Text = "Persona - Editar"; log = new PersonaBO(); validar = new ValidaDatos(); lista = new List <Persona>(); txtIdPersona.Enabled = false; txtUsuarioRegistro.Enabled = false; chkEstado.Visible = true; llenarEdita(idB); }
/// <summary> /// Inicializa la ventana para editar un usuario existente /// </summary> /// <param name="u"> /// Instancia de la clase Usuario /// </param> public FrmEdicionUsuario(Usuario u) { InitializeComponent(); txtContrasena.Enabled = false; txtConfirmarContrasena.Enabled = false; chkActivo.Enabled = true; this.u = u; ubo = new UsuarioBO(); pbo = new PersonaBO(); validar = new ValidaDatos(); idPersona = u.idPersona; cargarDatos(); cmbExpiraContrasena.SelectedIndex = 0; }
public AsignacionMateria(Form parent, int idP) { InitializeComponent(); this.parent = parent; txtId.Enabled = false; log = new AsignacionBO(); logU = new PersonaBO(); logM = new MateriaBO(); lista = new List <Asignacion>(); listaU = new List <Persona>(); listaM = new List <Materias>(); llenarComboProfesor(); llenarComboMateria(); buscar(idP); }
public ListaEstudiante(Form parent, string id) { InitializeComponent(); this.parent = parent; lista = new List <Asignacion>(); log = new AsignacionBO(); logMatricula = new MatriculaEstudianteBO(); logPersona = new PersonaBO(); listMatricula = new List <MatriculaEstudiante>(); listaPersona = new List <Persona>(); logNota = new RegistroNotaBO(); listaNota = new List <RegistroNota>(); txtIdProf.Text = id; cargarComboIdMaterias(); }
protected void Page_Load(object sender, EventArgs e) { if (SessionHelper.PersonaAutenticada != null) { personaBo = new PersonaBO(); persona = SessionHelper.PersonaAutenticada; if (!IsPostBack) { loadDataPersona(); } } else { Response.Redirect("/site-web/login/loginform.aspx"); } }
public EditaPersona(Form parent, string u) { InitializeComponent(); this.parent = parent; txtUsuarioRegistro.Text = u; lblTitulo.Text = "Persona - Agregar"; log = new PersonaBO(); validar = new ValidaDatos(); lista = new List <Persona>(); cmbTipoPersona.SelectedIndex = 0; cmbSexo.SelectedIndex = 0; cmbNivelAcademico.SelectedIndex = 0; cmbNacionalidad.SelectedIndex = 0; txtIdPersona.Enabled = false; txtUsuarioRegistro.Enabled = false; chkEstado.Visible = false; chkEstado.Checked = true; asignarId(); }
public RealizaMatricula(Form parent, string idPersona) { InitializeComponent(); this.parent = parent; log = new MatriculaEstudianteBO(); lista = new List <MatriculaEstudiante>(); logA = new AsignacionBO(); listaA = new List <Asignacion>(); logP = new PersonaBO(); listaP = new List <Persona>(); txtIdFactura.Enabled = false; txtIdPersona.Enabled = false; txtComprobante.Enabled = false; txtProfesor.Enabled = false; txtIdPersona.Text = idPersona; asignarIdFactura(); asignarComprobante(); cargarComboProf(); cmbPeriodo.SelectedIndex = 0; }
public void Insertar(PersonaBO pPersona) { using (SqlConnection con = AbrirConexion()) { try { SqlCommand command = new SqlCommand(); command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "proPersonaInsertar"; command.Parameters.AddWithValue("Nombre", pPersona.Nombre); command.Parameters.AddWithValue("FechaNacimiento", pPersona.FechaNacimiento); command.Parameters.AddWithValue("Sexo", pPersona.Sexo); command.Connection = con; command.ExecuteNonQuery(); } catch { throw new Exception("No se ha podido insertar"); } } }
public List <PersonaBO> Consultar(int?pIdPersona = null) { using (SqlConnection con = AbrirConexion()) { try { SqlCommand command = new SqlCommand(); command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "proPersonaSeleccionar"; if (pIdPersona.HasValue) { command.Parameters.AddWithValue("IdPersona", pIdPersona.Value); } command.Connection = con; command.ExecuteNonQuery(); SqlDataReader reader = command.ExecuteReader(); List <PersonaBO> lsPersonas = new List <PersonaBO>(); if (reader.HasRows) { while (reader.Read()) { PersonaBO objPersona = new PersonaBO(); objPersona.IdPersona = reader.GetInt32(0); objPersona.Nombre = reader.GetString(1); objPersona.FechaNacimiento = reader.GetDateTime(2); objPersona.Sexo = Convert.ToChar(reader.GetString(3)); lsPersonas.Add(objPersona); } } return(lsPersonas); } catch { throw new Exception("No se ha podido Consultar"); } } }
protected void btnRegistrar_Click(object sender, EventArgs e) { svrPersona.IsvcPersonaClient client = new svrPersona.IsvcPersonaClient(); PersonaBO objPersona = new PersonaBO(); if (hdfId.Value == "") { objPersona.Nombre = txtNombre.Text; objPersona.FechaNacimiento = cldFechaNacimiento.SelectedDate; objPersona.Sexo = char.Parse(ddlSexo.SelectedValue); client.Insertar(objPersona); ScriptManager.RegisterStartupScript(Page, typeof(Page), "MensajeExitoso", "alert('Se ha registrado correctamente')", true); Limpiar(); } else { objPersona.IdPersona = int.Parse(hdfId.Value); objPersona.Nombre = txtNombre.Text; objPersona.FechaNacimiento = cldFechaNacimiento.SelectedDate; objPersona.Sexo = char.Parse(ddlSexo.SelectedValue); client.Actualizar(objPersona); ScriptManager.RegisterStartupScript(Page, typeof(Page), "MensajeExitoso", "alert('Se ha actualizado correctamente')", true); } }
protected void BtnGuardar_Click(object sender, EventArgs e) { #region Validacion de obligatorios if (string.IsNullOrEmpty(TxtRut.Text) || string.IsNullOrWhiteSpace(TxtRut.Text)) { MostrarMensaje("Debe ingresar un rut"); } else if (string.IsNullOrEmpty(TxtNombres.Text) || string.IsNullOrWhiteSpace(TxtNombres.Text)) { MostrarMensaje("Debe ingresar nombres"); } else if (string.IsNullOrEmpty(TxtApPaterno.Text) || string.IsNullOrWhiteSpace(TxtApPaterno.Text)) { MostrarMensaje("Debe ingresar apellido paterno"); } #endregion else { #region Session if (Session["PersonaBO"] == null) { Session["PersonaBO"] = new PersonaBO(); } IPersonaBO personaSession = Session["PersonaBO"] as PersonaBO; #endregion #region si existe if (personaSession.VerificarPersona(TxtRut.Text)) { MostrarMensaje("El rut ya esta registrado"); } #endregion else { #region Variables string Rut = TxtRut.Text; string Nombres = TxtNombres.Text; string ApPaterno = TxtApPaterno.Text; string ApMaterno = TxtApMaterno.Text; DateTime?FechaNacimiento = null; string Telefono = TxtTelefono.Text; string Email = TxtEmail.Text; int Sexo = 0; string Direccion = TxtDireccion.Text; int PaisId = 0; int RegionId = 0; int ComunaId = 0; Int32.TryParse(DdlSexo.SelectedItem.Value, out Sexo); Int32.TryParse(DdlPais.SelectedItem.Value, out PaisId); Int32.TryParse(DdlRegion.SelectedItem.Value, out RegionId); Int32.TryParse(DdlComuna.SelectedItem.Value, out ComunaId); if (!string.IsNullOrEmpty(TxtFechaNacimiento.Text) && !string.IsNullOrWhiteSpace(TxtFechaNacimiento.Text)) { FechaNacimiento = Convert.ToDateTime(TxtFechaNacimiento.Text); } #endregion #region Guardar bool result = personaSession.AgregarPersona(Rut, Nombres, ApPaterno, ApMaterno, FechaNacimiento, Sexo, Direccion, ComunaId, RegionId, PaisId, Telefono, Email); #endregion #region Mensajes if (result) { MostrarMensaje("Persona fue agregada con éxito!"); #region Limpieza TxtRut.Text = TxtNombres.Text = TxtApPaterno.Text = TxtApMaterno.Text = TxtDireccion.Text = TxtEmail.Text = TxtFechaNacimiento.Text = TxtTelefono.Text = string.Empty; #endregion } else { MostrarMensaje("Ocurrió un error. La persona no fue agregada."); } #endregion } } }