Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (validarDatos())
     {
         try
         {
             String auxID;
             if (txId.Text.Trim() == "")
             {
                 auxID = "-1";
             }
             else
             {
                 auxID = txId.Text.Trim();
             }
             this.dataGridView1.DataSource             = AfiliadoManager.BuscarAfiliados(txNombre.Text.Trim(), txApellido.Text.Trim(), Convert.ToInt32(auxID));
             dataGridView1.Columns["servicio"].Visible = false;
         }
         catch (FormatException fx)
         {
             MessageBox.Show(fx.Message);
         }
     }
     else
     {
         MessageBox.Show("Ingrese al menos un id");
     }
 }
Пример #2
0
 private void buttonAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Validacion.estaVacio(txtMotivo, "Motivo"))
         {
             if (afiliado.servicio == 0)
             {
                 afiliado.servicio = AfiliadoManager.idPlanMedico(cBplanMedico.Text);
                 AfiliadoManager.cambioPlan(afiliado.id, cBplanMedico.Text, txtMotivo.Text.Trim());
                 this.Close();
             }
             else if (String.Compare(AfiliadoManager.planMedico(afiliado.servicio), cBplanMedico.Text) != 0)
             {
                 afiliado.servicio = AfiliadoManager.idPlanMedico(cBplanMedico.Text);
                 AfiliadoManager.cambioPlan(afiliado.id, cBplanMedico.Text, txtMotivo.Text.Trim());
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Ya posee ese plan");
             }
         }
     }
     catch (SqlException ex) {
         MessageBox.Show(ex.Message);
         this.Close();
     }
 }
Пример #3
0
        public static List <Modificacion> BuscarModificaciones(String nombre, String apellido, int idPaciente, String plan)
        {
            List <Modificacion> modificaciones = new List <Modificacion>();
            string query;
            int    parametros = 0;

            Server server = Server.getInstance();

            AfiliadoManager.validarDato(apellido);
            query = "select * from GESTIONAME_LAS_VACACIONES.Modificaciones m join GESTIONAME_LAS_VACACIONES.Pacientes p ON (p.id = m.idPaciente) join GESTIONAME_LAS_VACACIONES.Planes pl ON (m.idPlan = pl.id) where ";

            if (nombre != "")
            {
                parametros++;
                query += " p.nombre like '" + nombre + "'";
            }
            if (apellido != "")
            {
                if (parametros > 0)
                {
                    query += " and ";
                }
                parametros++;
                query += "p.apellido like '" + apellido + "'";
            }
            if (idPaciente != -1)
            {
                if (parametros > 0)
                {
                    query += " and ";
                }
                parametros++;
                query += " m.idPaciente = " + idPaciente;
            }
            if (plan != "")
            {
                if (parametros > 0)
                {
                    query += " and ";
                }
                parametros++;
                query += " pl.descripcion = '" + plan + "'";
            }

            SqlDataReader reader = server.query(query);

            while (reader.Read())
            {
                Modificacion modif = new Modificacion();
                modif.id         = Convert.ToInt32(reader["id"]);
                modif.idPaciente = Convert.ToInt32(reader["idPaciente"]);
                modif.idPlan     = Convert.ToInt32(reader["idPlan"]);
                modif.motivo     = reader["motivo"].ToString();
                modif.fecha      = Convert.ToDateTime(reader["fecha"]);
                modificaciones.Add(modif);
            }
            reader.Close();
            return(modificaciones);
        }
Пример #4
0
        public static void cambioPlan(int id, string planMedico, string motivo)
        {
            int    plan   = AfiliadoManager.idPlanMedico(planMedico);
            Server server = Server.getInstance();
            String query  = "EXEC GESTIONAME_LAS_VACACIONES.cambioPlan " + id +
                            "," + plan + ",'" + motivo + "','" + Program.horarioSistema + "'";
            SqlDataReader reader = server.query(query);

            reader.Close();
        }
Пример #5
0
 private void btBorrar_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         AfiliadoManager.borrarAfiliado(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value));
         MessageBox.Show("Se dio de baja al afiliado");
     }
     else
     {
         MessageBox.Show("Seleccione una unica fila");
     }
 }
Пример #6
0
        private void btCambiarPlan_Click_1(object sender, EventArgs e)
        {
            cambiarPlan form = new cambiarPlan();

            form.afiliado = afiliado;
            this.Hide();
            form.ShowDialog();
            btCambiarPlan.Hide();
            txPlanMedico.Show();
            this.Show();
            if (afiliado.servicio != 0)
            {
                txPlanMedico.Text = AfiliadoManager.planMedico(afiliado.servicio);
            }
        }
Пример #7
0
        public static void altaAfiliado(string nombre, string apellido, int documento, string direccion, String telefono,
                                        string mail, DateTime nacimiento, string sexo, string civil, int familiares, string descPlanMedico, int idFamiliar, String tipoDocumento)
        {
            Server server = Server.getInstance();
            string query  = "'" + nombre + "', '" + apellido + "'," + documento + ",'" + direccion + "','" + telefono +
                            "','" + mail + "','" + nacimiento + "','" + genero(sexo) + "','" + civil + "'," + familiares +
                            ", " + AfiliadoManager.idPlanMedico(descPlanMedico) + ", '" + tipoDocumento + "'";

            if (idFamiliar == 0)
            {
                server.realizarQuery("EXEC GESTIONAME_LAS_VACACIONES.altaPaciente " + query);
            }
            else
            {
                server.realizarQuery("EXEC GESTIONAME_LAS_VACACIONES.altaFamiliar " + idFamiliar + "," + query);
            }
        }
Пример #8
0
        public modificarAfiliado()
        {
            InitializeComponent();
            BuscarAfiliados form = new BuscarAfiliados();

            form.ShowDialog();
            afiliado = form.afiliadoBuscado;
            if (afiliado.id != -1)
            {
                txApellido.Text         = afiliado.apellido;
                txNombre.Text           = afiliado.nombre;
                txDireccion.Text        = afiliado.direccion;
                txDocumento.Text        = Convert.ToString(afiliado.documento);
                txFamiliaresACargo.Text = Convert.ToString(afiliado.cantFamiliares);
                txMail.Text             = afiliado.email;
                txTelefono.Text         = afiliado.telefono;
                cBestadoCivil.Text      = afiliado.estadoCivil;
                cBsexo.Text             = sexo(afiliado.sexo);
                cBtipoDocumento.Text    = afiliado.tipoDocumento;
                dateTimePicker1.Value   = afiliado.fechaNacimiento;
                if (afiliado.servicio != 0)
                {
                    txPlanMedico.Text = AfiliadoManager.planMedico(afiliado.servicio);
                    btAgregar.Show();
                    btAceptar.Show();
                    btCambiarPlan.Show();
                }
                else
                {
                    MessageBox.Show("No posee plan medico vigente a la fecha");
                    txPlanMedico.Hide();
                    btAgregar.Show();
                    btAceptar.Show();
                    btCambiarPlan.Show();
                }
            }
            else
            {
                this.Close();
            }
            //   btAceptar.Hide();
            //   btCambiarPlan.Hide();
            //   afiliado.id = -1;
            //   btAgregar.Hide();
        }
Пример #9
0
 private void btAceptar_Click(object sender, EventArgs e)
 {
     if (validarDatos())
     {
         try{
             AfiliadoManager.ModificarAfiliado(afiliado.id, txDireccion.Text.Trim(), txTelefono.Text.Trim(), txMail.Text.Trim(),
                                               cBsexo.Text.Trim(), cBestadoCivil.Text.Trim(), Convert.ToInt32(txFamiliaresACargo.Text.Trim()));
             this.Close();
         }
         catch (FormatException fx)
         {
             MessageBox.Show(fx.Message);
         }
     }
     else
     {
         MessageBox.Show("Falta algun dato");
     }
 }
Пример #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (validarDatos())
     {
         String idAux = "";
         if (txId.Text.Trim() == "")
         {
             idAux = "-1";
         }
         else
         {
             idAux = txId.Text.Trim();
         }
         this.dataGridView1.DataSource = AfiliadoManager.BuscarAfiliados(txNombre.Text.Trim(), txApellido.Text.Trim(), Convert.ToInt32(idAux));
     }
     else
     {
         MessageBox.Show("Ingrese al menos un id");
     }
 }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txApellido.Text.Trim() != "" || txId.Text.Trim() != "" || txNombre.Text.Trim() != "" || cbIdPlan.SelectedItem.ToString().Trim() != "")
            {
                String plan;
                String idPaciente = txId.Text.Trim();
                if (!(Validacion.soloNumeros(txId, "idPaciente")))
                {
                    MessageBox.Show("Solo pueden ingresar numeros en los id");
                }
                if (idPaciente == "")
                {
                    idPaciente = "-1";
                }
                if (cbIdPlan.SelectedItem.ToString().Trim() == "")
                {
                    plan = "";
                }
                else
                {
                    plan = cbIdPlan.SelectedItem.ToString().Trim();
                }

                try
                {
                    dataGridView1.DataSource = AfiliadoManager.BuscarModificaciones(txNombre.Text.Trim(), txApellido.Text.Trim(), Convert.ToInt32(idPaciente), plan);
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (FormatException fx) {
                    MessageBox.Show(fx.Message);
                }
            }
            else
            {
                MessageBox.Show("Ingrese algun valor");
            }
        }
Пример #12
0
        private void btAceptar_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                afiliadoBuscado.id              = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
                afiliadoBuscado.nombre          = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
                afiliadoBuscado.apellido        = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value);
                afiliadoBuscado.documento       = Convert.ToInt32(dataGridView1.CurrentRow.Cells[3].Value);
                afiliadoBuscado.tipoDocumento   = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value);
                afiliadoBuscado.direccion       = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value);
                afiliadoBuscado.telefono        = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value);
                afiliadoBuscado.email           = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value);
                afiliadoBuscado.fechaNacimiento = Convert.ToDateTime(dataGridView1.CurrentRow.Cells[8].Value);
                afiliadoBuscado.sexo            = Convert.ToString(dataGridView1.CurrentRow.Cells[9].Value);
                afiliadoBuscado.estadoCivil     = Convert.ToString(dataGridView1.CurrentRow.Cells[10].Value);
                afiliadoBuscado.cantFamiliares  = Convert.ToInt32(dataGridView1.CurrentRow.Cells[11].Value);
                afiliadoBuscado.cantConsultas   = Convert.ToInt32(dataGridView1.CurrentRow.Cells[12].Value);
                afiliadoBuscado.servicio        = Convert.ToInt32(dataGridView1.CurrentRow.Cells[13].Value);
                if (abrirCancelacion == 1)
                {
                    if (AfiliadoManager.noTieneTurnosSinCancelar(afiliadoBuscado.id))
                    {
                        MessageBox.Show("El Afiliado no tiene turnos para cancelar");
                        return;
                    }
                    Cancelar_Atencion.CancelacionAfiliado cancelacion = new Cancelar_Atencion.CancelacionAfiliado(afiliadoBuscado.id);
                    cancelacion.ShowDialog();
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("Seleccione una unica fila");
            }
        }
Пример #13
0
        private void btAgregar_Click(object sender, EventArgs e)
        {
            if (dateTimePicker1.Value.CompareTo(DateTime.ParseExact(Program.horarioSistema.ToString(), "yyyy-dd-MM HH:mm:ss.fff", null)) > 0)
            {
                MessageBox.Show("El paciente aun no nacio");
                return;
            }


            if (validarDatos())
            {
                try
                {
                    AfiliadoManager.altaAfiliado(txNombre.Text.Trim(), txApellido.Text.Trim(),
                                                 Convert.ToInt32(txDocumento.Text.Trim()), txDireccion.Text.Trim(), txTelefono.Text.Trim(),
                                                 txMail.Text.Trim(), Convert.ToDateTime(dateTimePicker1.Value), cBsexo.Text.Trim(),
                                                 cBestadoCivil.Text.Trim(), Convert.ToInt32(txFamiliaresACargo.Text.Trim()), cBplanMedico.Text.Trim(), this.afiliadoFamiliar.id, cBtipoDocumento.Text.Trim());
                    btAgregar.Hide();
                    if (cBestadoCivil.Text.Trim() == "Casado" || cBestadoCivil.Text.Trim() == "Concubinato" || Convert.ToInt32(txFamiliaresACargo.Text.Trim()) > 0)
                    {
                        btAgregarFam.Show();
                        this.afiliadoFamiliar.nombre   = txNombre.Text.Trim();
                        this.afiliadoFamiliar.apellido = txApellido.Text.Trim();
                        this.afiliadoFamiliar.id       = AfiliadoManager.id(txDocumento.Text.Trim());
                    }
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (FormatException fx)
                {
                    MessageBox.Show(fx.Message);
                }
            }
        }
Пример #14
0
        public static void ModificarAfiliado(int id, String direccion, String telefono, String mail,
                                             string sexo, String estadoCivil, int CantidadFamiliares)
        {
            Server server = Server.getInstance();
            string q      = "EXEC GESTIONAME_LAS_VACACIONES.modificarPaciente " + id +
                            ",'" + direccion + "','" + telefono + "','" + mail + "'," + AfiliadoManager.genero(sexo) +
                            ",'" + estadoCivil + "'," + CantidadFamiliares;
            SqlDataReader reader = server.query(q);

            reader.Close();
        }