Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.67 KB | None | 0 0
  1. //Persona.cs
  2. namespace Clinica
  3. {
  4.     abstract class Persona
  5.     {
  6.         protected string nombre;
  7.         protected string apellido;
  8.         protected int tipoDocumento;
  9.         protected int documento;
  10.         protected bool sexo;
  11.         private string telefono;
  12.         protected DateTime fechaNacimiento;
  13.  
  14.         public string pNombre
  15.         {
  16.             get
  17.             {
  18.                 return nombre;
  19.             }
  20.  
  21.             set
  22.             {
  23.                 nombre = value;
  24.             }
  25.         }
  26.  
  27.         public string pApellido
  28.         {
  29.             get
  30.             {
  31.                 return apellido;
  32.             }
  33.  
  34.             set
  35.             {
  36.                 apellido = value;
  37.             }
  38.         }
  39.  
  40.         public int pTipoDocumento
  41.         {
  42.             get
  43.             {
  44.                 return tipoDocumento;
  45.             }
  46.  
  47.             set
  48.             {
  49.                 tipoDocumento = value;
  50.             }
  51.         }
  52.  
  53.         public int pDocumento
  54.         {
  55.             get
  56.             {
  57.                 return documento;
  58.             }
  59.  
  60.             set
  61.             {
  62.                 documento = value;
  63.             }
  64.         }
  65.  
  66.         public bool pSexo
  67.         {
  68.             get
  69.             {
  70.                 return sexo;
  71.             }
  72.  
  73.             set
  74.             {
  75.                 sexo = value;
  76.             }
  77.         }
  78.  
  79.         public string pTelefono
  80.         {
  81.             get
  82.             {
  83.                 return telefono;
  84.             }
  85.  
  86.             set
  87.             {
  88.                 telefono = value;
  89.             }
  90.         }
  91.  
  92.         public DateTime pFechaNacimiento
  93.         {
  94.             get
  95.             {
  96.                 return fechaNacimiento;
  97.             }
  98.  
  99.             set
  100.             {
  101.                 fechaNacimiento = value;
  102.             }
  103.         }
  104.  
  105.         public Persona()
  106.         {
  107.             this.nombre = "";
  108.             this.apellido = "";
  109.             this.tipoDocumento = 0;
  110.             this.documento = 0;
  111.             this.sexo = false;
  112.             this.telefono = "";
  113.             this.fechaNacimiento = DateTime.Today;
  114.         }
  115.  
  116.         public Persona(string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
  117.         {
  118.             this.nombre = nombre;
  119.             this.apellido = apellido;
  120.             this.tipoDocumento = tipoDocumento;
  121.             this.documento = documento;
  122.             this.sexo = sexo;
  123.             this.telefono = telefono;
  124.             this.fechaNacimiento = fechaNacimiento;
  125.         }
  126.  
  127.  
  128.         public string toStringPersona()
  129.         {
  130.             string texto, sex, esp;
  131.             if (sexo)
  132.                sex = "Masculino";
  133.             else
  134.                sex = "Femenino";
  135.             texto = "Nombre: " + pNombre + pApellido      
  136.             + "\nTipo de Documento: " + pTipoDocumento + "\nNumero Documento: " +pDocumento
  137.             + "\nSexo: " + pSexo + "\nTeléfono: " + pTelefono + "\nFecha de Nacimiento: " + pFechaNacimiento;
  138.             return texto;
  139.         }
  140.     }
  141. }
  142.  
  143. //Medico.cs
  144. namespace Clinica
  145. {
  146.     class Medico : Persona
  147.     {
  148.         protected int matricula;
  149.         protected int idEspecialidad;
  150.  
  151.         public Medico() : base()
  152.         {
  153.             this.matricula = 0;
  154.             this.idEspecialidad = 0;
  155.         }
  156.  
  157.         public Medico(int matricula, int idEspecialidad, string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
  158.             : base(nombre, apellido, tipoDocumento, documento, sexo, telefono, fechaNacimiento)
  159.         {
  160.             this.matricula = matricula;
  161.             this.idEspecialidad = idEspecialidad;
  162.             base.pNombre = nombre;
  163.             base.pApellido = apellido;
  164.             base.pTipoDocumento = tipoDocumento;
  165.             base.pDocumento = documento;
  166.             base.pSexo = sexo;
  167.             base.pTelefono = telefono;
  168.             base.pFechaNacimiento = fechaNacimiento;
  169.         }
  170.  
  171.  
  172.         public int pMatricula
  173.         {
  174.             get
  175.             {
  176.                 return matricula;
  177.             }
  178.  
  179.             set
  180.             {
  181.                 matricula = value;
  182.             }
  183.         }
  184.  
  185.         public int pIdEspecialidad
  186.         {
  187.             get
  188.             {
  189.                 return idEspecialidad;
  190.             }
  191.  
  192.             set
  193.             {
  194.                 idEspecialidad = value;
  195.             }
  196.         }
  197.  
  198.         public string toStringMedico()
  199.         {
  200.             string texto, esp;
  201.             switch (idEspecialidad)
  202.             {
  203.                 case 1:
  204.                     esp = "Pediatria";
  205.                     break;
  206.                 case 2:
  207.                     esp = "Clinica";
  208.                     break;
  209.                 case 3:
  210.                     esp = "Traumatologia";
  211.                     break;
  212.                 case 4:
  213.                     esp = "Cardiologia";
  214.                     break;
  215.             }
  216.             texto = "Matrícula: " + "\nEspecialidad: " + this.idEspecialidad + base.toStringPersona();          
  217.             return texto;
  218.         }
  219.     }
  220. }
  221.  
  222. //Paciente.cs
  223. namespace Clinica
  224. {
  225.     class Paciente : Persona
  226.     {
  227.         protected int obraSocial;
  228.        
  229.         public Paciente() : base()
  230.         {
  231.             this.obraSocial = 0;
  232.         }
  233.  
  234.         public Paciente(int obraSocial, string nombre, string apellido, int tipoDocumento, int documento, bool sexo, string telefono, DateTime fechaNacimiento)
  235.             : base(nombre, apellido, tipoDocumento, documento, sexo, telefono, fechaNacimiento)
  236.         {
  237.             this.obraSocial = obraSocial;
  238.             base.pNombre = nombre;
  239.             base.pApellido = apellido;
  240.             base.pTipoDocumento = tipoDocumento;
  241.             base.pDocumento = documento;
  242.             base.pSexo = sexo;
  243.             base.pTelefono = telefono;
  244.             base.pFechaNacimiento = fechaNacimiento;
  245.         }
  246.  
  247.  
  248.         public int pObraSocial
  249.         {
  250.             get
  251.             {
  252.                 return obraSocial;
  253.             }
  254.  
  255.             set
  256.             {
  257.                 obraSocial = value;
  258.             }
  259.         }
  260.  
  261.         public string toStringPaciente()
  262.         {
  263.             string texto;
  264.             texto = "Obra Social: " + this.obraSocial + base.toStringPersona();
  265.             return texto;
  266.         }
  267.     }
  268. }
  269.  
  270. //Consulta.cs
  271. namespace Clinica
  272. {
  273.     class Consulta
  274.     {
  275.         private DateTime fechaConsulta;
  276.         private double montoPagado;
  277.         private int tipoConsulta;
  278.         private Medico medico;
  279.         private Paciente paciente;
  280.  
  281.         public Consulta()
  282.         {
  283.             this.fechaConsulta = DateTime.Today;
  284.             this.montoPagado = 0;
  285.             this.tipoConsulta = 0;
  286.             this.medico = null;
  287.             this.paciente = null;
  288.         }
  289.  
  290.         public Consulta(DateTime fechaConsulta, double montoPagado, int tipoConsulta, Medico medico, Paciente paciente)
  291.            
  292.         {
  293.             this.fechaConsulta = fechaConsulta;
  294.             this.montoPagado = montoPagado;
  295.             this.tipoConsulta = tipoConsulta;
  296.             this.medico = medico;
  297.             this.paciente = paciente;      
  298.         }
  299.  
  300.  
  301.         public DateTime pFechaConsulta
  302.         {
  303.             get
  304.             {
  305.                 return fechaConsulta;
  306.             }
  307.  
  308.             set
  309.             {
  310.                 fechaConsulta = value;
  311.             }
  312.         }
  313.  
  314.         public double pMontoPagado
  315.         {
  316.             get
  317.             {
  318.                 return montoPagado;
  319.             }
  320.  
  321.             set
  322.             {
  323.                 montoPagado = value;
  324.             }
  325.         }
  326.  
  327.         public int pTipoConsulta
  328.         {
  329.             get
  330.             {
  331.                 return tipoConsulta;
  332.             }
  333.  
  334.             set
  335.             {
  336.                 tipoConsulta = value;
  337.             }
  338.         }
  339.  
  340.         internal Medico pMedico
  341.         {
  342.             get
  343.             {
  344.                 return medico;
  345.             }
  346.  
  347.             set
  348.             {
  349.                 medico = value;
  350.             }
  351.         }
  352.  
  353.         internal Paciente pPaciente
  354.         {
  355.             get
  356.             {
  357.                 return paciente;
  358.             }
  359.  
  360.             set
  361.             {
  362.                 paciente = value;
  363.             }
  364.         }
  365.  
  366.         public string toStringConsulta()
  367.         {
  368.             return this.fechaConsulta + " " + this.montoPagado + " " + this.tipoConsulta + " " + this.medico + " " + this.paciente;
  369.         }
  370.     }
  371. }
  372.  
  373. //Form1.cs
  374. namespace Clinica
  375. {
  376.     public partial class frmClinica : Form
  377.     {
  378.         int cantidadConsultas;
  379.         int cantidadPacientes;
  380.  
  381.  
  382.         public frmClinica()
  383.         {
  384.             InitializeComponent();
  385.             cantidadConsultas = 0;
  386.             cantidadPacientes = 0;
  387.         }
  388.  
  389.         private void gbInfoPaciente_Enter(object sender, EventArgs e)
  390.         {
  391.  
  392.         }
  393.  
  394.         private void Form1_Load(object sender, EventArgs e)
  395.         {
  396.             //Botones
  397.             btnRegistrarConsulta.Enabled = false;
  398.             btnListadoMedicos.Enabled = false;
  399.             btnListadoPacientes.Enabled = false;
  400.             btnEstadisticas.Enabled = false;
  401.             btnVerConsultas.Enabled = false;
  402.             btnNuevaConsulta.Enabled = true;
  403.             btnCancelar.Enabled = true;
  404.             //Combo Boxes
  405.             cbxEspecialidad.Enabled = false;
  406.             cbxObraSocial.Enabled = false;
  407.             cbxTipoDocumento.Enabled = false;
  408.             //Text Boxes
  409.             tbxApellidoMed.Enabled = false;
  410.             tbxApellidoPat.Enabled = false;
  411.             tbxNombreMed.Enabled = false;
  412.             tbxNombrePat.Enabled = false;
  413.             tbxMatricula.Enabled = false;
  414.             tbxCostoObra.Enabled = false;
  415.             tbxCostoFinal.Enabled = false;
  416.             tbxNroDocumento.Enabled = false;
  417.             tbxTelefonoMed.Enabled = false;
  418.             tbxTelefonoPat.Enabled = false;
  419.             //DateTimePickers
  420.             dtpFechaNacimiento.Enabled = false;
  421.             dtpFechaTurno.Enabled = false;
  422.             //Radio Buttons
  423.             rbtMasculino.Enabled = false;
  424.             rbtFemenino.Enabled = false;
  425.             //CheckBoxes
  426.             cbPrimeraVez.Enabled = false;
  427.         }
  428.  
  429.         private void btnRegistrarConsulta_Click(object sender, EventArgs e)
  430.         {
  431.             Medico m = new Medico();
  432.             m.pIdEspecialidad = cbxEspecialidad.SelectedIndex + 1;
  433.             m.pNombre = Convert.ToString(tbxNombreMed.Text);
  434.             m.pApellido = Convert.ToString(tbxApellidoMed.Text);
  435.             m.pMatricula = Convert.ToInt32(tbxMatricula.Text);
  436.             m.pTelefono = Convert.ToString(tbxTelefonoMed.Text);
  437.            
  438.             Paciente p = new Paciente();
  439.             p.pObraSocial = cbxObraSocial.SelectedIndex + 1;
  440.             p.pNombre = Convert.ToString(tbxNombrePat.Text);
  441.             p.pApellido = Convert.ToString(tbxApellidoPat.Text);
  442.             p.pTipoDocumento = cbxTipoDocumento.SelectedIndex + 1;
  443.             p.pDocumento = Convert.ToInt32(tbxNroDocumento);
  444.             p.pSexo = rbtMasculino.Checked;
  445.             p.pTelefono = Convert.ToString(tbxTelefonoPat.Text);
  446.             p.pFechaNacimiento = Convert.ToDateTime(dtpFechaNacimiento.Value);
  447.  
  448.             Consulta c = new Consulta();
  449.             c.pFechaConsulta = Convert.ToDateTime(dtpFechaTurno.Value);
  450.             c.pMontoPagado = Convert.ToDouble(tbxCostoFinal.Text);
  451.  
  452.             //Contar la cantidad de consultas
  453.             cantidadConsultas++;
  454.  
  455.             //Contar la cantidad de pacientes
  456.             cantidadPacientes++;
  457.        }
  458.     }
  459. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement