private void frmAbmPaciente_Load(object sender, EventArgs e) { id = Convert.ToInt32(Usuario.TipoUser.pacientes); if (id == 2) { this.btnAgregar.Enabled = true; } else { this.btnAgregar.Enabled = false; } this.btnModificar.Enabled = false; this.btnAceptar.Visible = false; this.btnCancelar.Visible = false; this.txbLeyenda.Text = " "; Deshabilitar_Campos(); txbLeyenda.Visible = false; ObraSocialNegocio obraN = new ObraSocialNegocio(); // cbxObraSocial.DataSource = obraN.Leer(); cbxObraSocial.DataSource = null; //if (cbxObraSocial.Items.Count > 0) cbxObraSocial.SelectedIndex = 0; }
private void cbxObraSocial_SelectedIndexChanged(object sender, EventArgs e) { this.txbLeyenda.Visible = false; this.txbLeyenda.Enabled = false; if (cbxObraSocial.DataSource == null) { cbxPlan.DataSource = null; } else { this.obrasocial = (ObraSocial)cbxObraSocial.SelectedItem; ObraSocialNegocio obraN = new ObraSocialNegocio(); cbxPlan.DataSource = obraN.PlanObra(this.obrasocial.id); if (cbxPlan.Items.Count > 0) { cbxPlan.SelectedIndex = 0; } ObraSocial aux = (ObraSocial)this.cbxObraSocial.SelectedItem; if (aux.suspendido == true) { this.txbLeyenda.Visible = true; this.txbLeyenda.Text = "Obra Social Suspendida"; } if (aux.estado == 0) { this.txbLeyenda.Visible = true; this.txbLeyenda.Text = "Obra Social con Baja Definitiva"; } } }
private void frmAbmObrasSociales_Load(object sender, EventArgs e) { this.btnAceptar.Visible = false; this.btnCancelar.Visible = false; ObraSocialNegocio obraN = new ObraSocialNegocio(); this.cbxNombre.DataSource = obraN.Leer(); if (this.cbxNombre.Items.Count > 0) { this.cbxNombre.SelectedIndex = 0; } Control_Usuario(); /* int id = Convert.ToInt32(Usuario.TipoUser.osociales); * if (id == 1) * { * this.btnAgregar.Enabled = false; * this.btnModificar.Enabled = false; * * this.btnEliminar.Enabled = false; * this.llbAgregarPlan.Enabled = false; * this.llbEliminarPlan.Enabled = false; * this.linkLabel1.Enabled = false; * * }*/ }
public void Agregar(ObraSocial nueva) { for (int i = 0; i < cbxNombre.Items.Count; i++) { ObraSocial aux = (ObraSocial)cbxNombre.Items[i]; if (aux.nombre.CompareTo(nueva.nombre.Trim()) == 0) { MessageBox.Show("La obra social ya existe"); return; } } ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.Agregar(nueva) == false) { MessageBox.Show("Error al agregar"); return; } this.cbxPlanes.DataSource = null; this.cbxPlanes.Text = ""; this.cbxNombre.DataSource = obraN.Leer(); for (int i = 0; i < cbxNombre.Items.Count; i++) { ObraSocial aux = (ObraSocial)cbxNombre.Items[i]; if (aux.nombre.CompareTo(nueva.nombre.Trim()) == 0) { cbxNombre.SelectedIndex = i; break; } } }
private void cbxNombre_SelectedIndexChanged(object sender, EventArgs e) { Habilitar_Campos_OS(); Habilitar_Campos_PL(); this.cbxPlanes.DataSource = null; this.tbxCoseguro.Text = "0"; this.cbxPlanes.Text = ""; this.Obra = (ObraSocial)this.cbxNombre.SelectedItem; ObraSocialNegocio obraN = new ObraSocialNegocio(); this.cbxPlanes.DataSource = obraN.PlanObra(this.Obra.id); if (this.cbxPlanes.Items.Count > 0) { this.cbxPlanes.SelectedIndex = 0; } else { this.tbxCoseguro.Text = "0"; this.cbxPlanes.Text = ""; this.EscribirControles(); } Deshabilitar_Campos_OS(); Deshabilitar_Campos_PL(); }
public void ModificarPlan(Plan nuevo) { ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.AgregarPlan(this.Obra.id, nuevo.id, nuevo.coseguro.ToString()) == false) { MessageBox.Show("Error al agregar"); return; } this.ObtenerPlanes(); }
protected void btnLogIn_Click(object sender, EventArgs e) { logInPacienteNegocio = new LogInPacienteNegocio(); logInPaciente = logInPacienteNegocio.BuscarUsuario(this.tbxUsuario.Text.Trim()); this.tbxClave.CssClass = "campo"; this.tbxUsuario.CssClass = "campo"; this.lblMensaje.Text = ""; if (logInPaciente != null) { if (logInPaciente.clave == this.tbxClave.Text.Trim()) { pacienteNegocio = new PacienteNegocio(); paciente = new Paciente(); obraSocial = new ObraSocialNegocio(); planNegocio = new PlanNegocio(); pacienteNegocio.LeerDni(logInPaciente.id, ref paciente); lista = obraSocial.Leer_Una(paciente); if (lista != null) { paciente.obra_social = lista.ElementAt(0); } listaPlan = planNegocio.Leer_uno(paciente); if (listaPlan != null) { paciente.plan = listaPlan.ElementAt(0); } Session.Add("paciente", paciente); Response.Redirect("~/default.aspx"); } else { this.tbxClave.CssClass = "campo_erroneo"; this.lblMensaje.Text = "La clave ingresada es inválida"; } } else { this.tbxUsuario.CssClass = "campo_erroneo"; this.tbxClave.CssClass = "campo_erroneo"; this.lblMensaje.Text = "El usuario no exite"; } }
private void ObtenerPlanes() { this.cbxPlanes.DataSource = null; this.tbxCoseguro.Text = "0"; this.cbxPlanes.Text = ""; ObraSocialNegocio obraN = new ObraSocialNegocio(); this.cbxPlanes.DataSource = obraN.PlanObra(this.Obra.id); if (this.cbxPlanes.Items.Count > 0) { this.cbxPlanes.SelectedIndex = 0; } else { this.EscribirControles(); } }
private bool CargarObraSocial(Paciente paciente) { bool cargar = false; ObraSocialNegocio obraN = new ObraSocialNegocio(); // cbxObraSocial.DataSource = obraN.Leer_Una(paciente); // if (cbxObraSocial.Items.Count > 0) cbxObraSocial.SelectedIndex = 0; cbxObraSocial.DataSource = obraN.Leer(); // cbxObraSocial.DataSource = null; if (operacion == 3) { if (cbxObraSocial.Items.Count > 0) { cbxObraSocial.SelectedIndex = 0; } } else { for (int i = 0; i < this.cbxObraSocial.Items.Count; i++) { ObraSocial aux = (ObraSocial)this.cbxObraSocial.Items[i]; if (aux.id == paciente.obra_social.id) { this.cbxObraSocial.SelectedIndex = i; this.paciente.obra_social.nombre = aux.nombre; this.paciente.obra_social.telefono = aux.telefono; this.paciente.obra_social.mail = aux.mail; this.paciente.obra_social.suspendido = aux.suspendido; this.paciente.obra_social.estado = aux.estado; cargar = true; break; } } } return(cargar); }
private void Verificar_Operacion() { if (Operacion == 2) // Modificación de Obra Social { this.LeerControles(); byte id = this.Obra.id; ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.Escribir(this.Obra) == false) { MessageBox.Show("Error al Modificar"); return; } this.cbxNombre.DataSource = obraN.Leer(); for (int i = 0; i < cbxNombre.Items.Count; i++) { ObraSocial aux = (ObraSocial)cbxNombre.Items[i]; if (aux.id == id) { cbxNombre.SelectedIndex = i; break; } } } if (Operacion == 3) // Baja de Obra Social { if (cbxNombre.Items.Count < 1) { return; } ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.Eliminar(this.Obra) == false) { MessageBox.Show("Error al eliminar"); return; } this.cbxNombre.DataSource = obraN.Leer(); if (this.cbxNombre.Items.Count > 0) { this.cbxNombre.SelectedIndex = 0; } } if (Operacion == 4) //Modifico el plan { float c = 0; if (tbxCoseguro.Text.Length > 0) { c = float.Parse(tbxCoseguro.Text); } if (c < 0) { MessageBox.Show("Ingrese un coseguro válido"); return; } this.PlanObra.coseguro = c; ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.ModificarPlan(this.Obra.id, this.PlanObra.id, this.PlanObra.coseguro) == false) { MessageBox.Show("Error al modificar"); return; } if (chbBaja.Checked == false) { this.PlanObra.estado = 1; } else { this.PlanObra.estado = 0; } if (obraN.ModificarEstadoPlan(this.PlanObra.id, this.PlanObra.estado) == false) { MessageBox.Show("Error al modificar Estado del Plan"); return; } this.ObtenerPlanes(); } if (Operacion == 5) { if (cbxNombre.Items.Count < 1) { return; } if (cbxPlanes.Items.Count < 1) { MessageBox.Show("No hay plan para eliminar"); return; } ObraSocialNegocio obraN = new ObraSocialNegocio(); if (obraN.EliminarPlan(this.Obra.id, this.PlanObra.id) == false) { MessageBox.Show("Error al eliminar"); return; } this.ObtenerPlanes(); } Operacion = 0; Deshabilitar_Campos_OS(); this.btnAgregar.Enabled = true; this.btnEliminar.Enabled = true; this.btnModificar.Enabled = true; this.llbAgregarPlan.Enabled = true; this.linkLabel1.Enabled = true; this.llbEliminarPlan.Enabled = true; this.btnAceptar.Visible = false; this.btnCancelar.Visible = false; this.cbxPlanes.Enabled = true; this.chbBaja.Enabled = false; this.tbxCoseguro.Enabled = false; }