Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Persona.cs
- namespace Clinica
- {
- abstract class Persona
- {
- protected string nombre;
- protected string apellido;
- protected int tipoDocumento;
- protected int documento;
- protected bool sexo;
- private string telefono;
- protected DateTime fechaNacimiento;
- public string pNombre
- {
- get
- {
- return nombre;
- }
- set
- {
- nombre = value;
- }
- }
- public string pApellido
- {
- get
- {
- return apellido;
- }
- set
- {
- apellido = value;
- }
- }
- public int pTipoDocumento
- {
- get
- {
- return tipoDocumento;
- }
- set
- {
- tipoDocumento = value;
- }
- }
- public int pDocumento
- {
- get
- {
- return documento;
- }
- set
- {
- documento = value;
- }
- }
- public bool pSexo
- {
- get
- {
- return sexo;
- }
- set
- {
- sexo = value;
- }
- }
- public string pTelefono
- {
- get
- {
- return telefono;
- }
- set
- {
- telefono = value;
- }
- }
- public DateTime pFechaNacimiento
- {
- get
- {
- return fechaNacimiento;
- }
- set
- {
- fechaNacimiento = value;
- }
- }
- public Persona()
- {
- this.nombre = "";
- this.apellido = "";
- this.tipoDocumento = 0;
- this.documento = 0;
- this.sexo = false;
- this.telefono = "";
- this.fechaNacimiento = DateTime.Today;
- }
- public Persona(string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
- {
- this.nombre = nombre;
- this.apellido = apellido;
- this.tipoDocumento = tipoDocumento;
- this.documento = documento;
- this.sexo = sexo;
- this.telefono = telefono;
- this.fechaNacimiento = fechaNacimiento;
- }
- public string toStringPersona()
- {
- string texto, sex, esp;
- if (sexo)
- sex = "Masculino";
- else
- sex = "Femenino";
- texto = "Nombre: " + pNombre + pApellido
- + "\nTipo de Documento: " + pTipoDocumento + "\nNumero Documento: " +pDocumento
- + "\nSexo: " + pSexo + "\nTeléfono: " + pTelefono + "\nFecha de Nacimiento: " + pFechaNacimiento;
- return texto;
- }
- }
- }
- //Medico.cs
- namespace Clinica
- {
- class Medico : Persona
- {
- protected int matricula;
- protected int idEspecialidad;
- public Medico() : base()
- {
- this.matricula = 0;
- this.idEspecialidad = 0;
- }
- public Medico(int matricula, int idEspecialidad, string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
- : base(nombre, apellido, tipoDocumento, documento, sexo, telefono, fechaNacimiento)
- {
- this.matricula = matricula;
- this.idEspecialidad = idEspecialidad;
- base.pNombre = nombre;
- base.pApellido = apellido;
- base.pTipoDocumento = tipoDocumento;
- base.pDocumento = documento;
- base.pSexo = sexo;
- base.pTelefono = telefono;
- base.pFechaNacimiento = fechaNacimiento;
- }
- public int pMatricula
- {
- get
- {
- return matricula;
- }
- set
- {
- matricula = value;
- }
- }
- public int pIdEspecialidad
- {
- get
- {
- return idEspecialidad;
- }
- set
- {
- idEspecialidad = value;
- }
- }
- public string toStringMedico()
- {
- string texto, esp;
- switch (idEspecialidad)
- {
- case 1:
- esp = "Pediatria";
- break;
- case 2:
- esp = "Clinica";
- break;
- case 3:
- esp = "Traumatologia";
- break;
- case 4:
- esp = "Cardiologia";
- break;
- }
- texto = "MatrĂcula: " + "\nEspecialidad: " + this.idEspecialidad + base.toStringPersona();
- return texto;
- }
- }
- }
- //Paciente.cs
- namespace Clinica
- {
- class Paciente : Persona
- {
- protected int obraSocial;
- public Paciente() : base()
- {
- this.obraSocial = 0;
- }
- public Paciente(int obraSocial, string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
- : base(nombre, apellido, tipoDocumento, documento, sexo, telefono, fechaNacimiento)
- {
- this.obraSocial = obraSocial;
- base.pNombre = nombre;
- base.pApellido = apellido;
- base.pTipoDocumento = tipoDocumento;
- base.pDocumento = documento;
- base.pSexo = sexo;
- base.pTelefono = telefono;
- base.pFechaNacimiento = fechaNacimiento;
- }
- public int pObraSocial
- {
- get
- {
- return obraSocial;
- }
- set
- {
- obraSocial = value;
- }
- }
- public string toStringPaciente()
- {
- string texto;
- texto = "Obra Social: " + this.obraSocial + base.toStringPersona();
- return texto;
- }
- }
- }
- //Consulta.cs
- namespace Clinica
- {
- class Consulta
- {
- private DateTime fechaConsulta;
- private double montoPagado;
- private int tipoConsulta;
- private Medico medico;
- private Paciente paciente;
- public Consulta()
- {
- this.fechaConsulta = DateTime.Today;
- this.montoPagado = 0;
- this.tipoConsulta = 0;
- this.medico = null;
- this.paciente = null;
- }
- public Consulta(DateTime fechaConsulta, double montoPagado, int tipoConsulta, Medico medico, Paciente paciente)
- {
- this.fechaConsulta = fechaConsulta;
- this.montoPagado = montoPagado;
- this.tipoConsulta = tipoConsulta;
- this.medico = medico;
- this.paciente = paciente;
- }
- public DateTime pFechaConsulta
- {
- get
- {
- return fechaConsulta;
- }
- set
- {
- fechaConsulta = value;
- }
- }
- public double pMontoPagado
- {
- get
- {
- return montoPagado;
- }
- set
- {
- montoPagado = value;
- }
- }
- public int pTipoConsulta
- {
- get
- {
- return tipoConsulta;
- }
- set
- {
- tipoConsulta = value;
- }
- }
- internal Medico pMedico
- {
- get
- {
- return medico;
- }
- set
- {
- medico = value;
- }
- }
- internal Paciente pPaciente
- {
- get
- {
- return paciente;
- }
- set
- {
- paciente = value;
- }
- }
- public string toStringConsulta()
- {
- return this.fechaConsulta + " " + this.montoPagado + " " + this.tipoConsulta + " " + this.medico + " " + this.paciente;
- }
- }
- }
- //Form1.cs
- namespace Clinica
- {
- public partial class frmClinica : Form
- {
- int cantidadConsultas;
- int cantidadPacientes;
- public frmClinica()
- {
- InitializeComponent();
- cantidadConsultas = 0;
- cantidadPacientes = 0;
- }
- private void gbInfoPaciente_Enter(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- //Botones
- btnRegistrarConsulta.Enabled = false;
- btnListadoMedicos.Enabled = false;
- btnListadoPacientes.Enabled = false;
- btnEstadisticas.Enabled = false;
- btnVerConsultas.Enabled = false;
- btnNuevaConsulta.Enabled = true;
- btnCancelar.Enabled = true;
- //Combo Boxes
- cbxEspecialidad.Enabled = false;
- cbxObraSocial.Enabled = false;
- cbxTipoDocumento.Enabled = false;
- //Text Boxes
- tbxApellidoMed.Enabled = false;
- tbxApellidoPat.Enabled = false;
- tbxNombreMed.Enabled = false;
- tbxNombrePat.Enabled = false;
- tbxMatricula.Enabled = false;
- tbxCostoObra.Enabled = false;
- tbxCostoFinal.Enabled = false;
- tbxNroDocumento.Enabled = false;
- tbxTelefonoMed.Enabled = false;
- tbxTelefonoPat.Enabled = false;
- //DateTimePickers
- dtpFechaNacimiento.Enabled = false;
- dtpFechaTurno.Enabled = false;
- //Radio Buttons
- rbtMasculino.Enabled = false;
- rbtFemenino.Enabled = false;
- //CheckBoxes
- cbPrimeraVez.Enabled = false;
- }
- private void btnRegistrarConsulta_Click(object sender, EventArgs e)
- {
- Medico m = new Medico();
- m.pIdEspecialidad = cbxEspecialidad.SelectedIndex + 1;
- m.pNombre = Convert.ToString(tbxNombreMed.Text);
- m.pApellido = Convert.ToString(tbxApellidoMed.Text);
- m.pMatricula = Convert.ToInt32(tbxMatricula.Text);
- m.pTelefono = Convert.ToString(tbxTelefonoMed.Text);
- Paciente p = new Paciente();
- p.pObraSocial = cbxObraSocial.SelectedIndex + 1;
- p.pNombre = Convert.ToString(tbxNombrePat.Text);
- p.pApellido = Convert.ToString(tbxApellidoPat.Text);
- p.pTipoDocumento = cbxTipoDocumento.SelectedIndex + 1;
- p.pDocumento = Convert.ToInt32(tbxNroDocumento);
- p.pSexo = rbtMasculino.Checked;
- p.pTelefono = Convert.ToString(tbxTelefonoPat.Text);
- p.pFechaNacimiento = Convert.ToDateTime(dtpFechaNacimiento.Value);
- Consulta c = new Consulta();
- c.pFechaConsulta = Convert.ToDateTime(dtpFechaTurno.Value);
- c.pMontoPagado = Convert.ToDouble(tbxCostoFinal.Text);
- //Contar la cantidad de consultas
- cantidadConsultas++;
- //Contar la cantidad de pacientes
- cantidadPacientes++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment