Ejemplo n.º 1
0
        private void FrmEstadisticas_Load(object sender, EventArgs e)
        {
            Semestre semestre = ObtenerSemestre();

            lblSemestre.Text    = semestre.ToString();
            this.dtpFecha.Value = FechaHelper.Ahora();

            try
            {
                IResultado <IList <Estadistica> > resultadoObtenerNombres = _domain.ObtenerTodos();
                if (!resultadoObtenerNombres.Correcto)
                {
                    throw new ResultadoIncorrectoException <IList <Estadistica> >(resultadoObtenerNombres);
                }

                IList <Estadistica> vistas = resultadoObtenerNombres.Retorno;
                cbVista.DataSource    = vistas;
                cbVista.DisplayMember = "NombreEstadistica";
                cbVista.ValueMember   = "IdEstadistica";
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(this, ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void FrmAfiliadoAlta_Load(object sender, EventArgs e)
        {
            this.AgregarValidacion(new ValidadorString(tbNombre, 1, 255));
            this.AgregarValidacion(new ValidadorString(tbApellido, 1, 255));
            this.AgregarValidacion(new ValidadorCombobox(cbTipoDocumento));
            this.AgregarValidacion(new ValidadorNumerico(tbNroDocumento));
            this.AgregarValidacion(new ValidadorDateTimeUntil(dpFechaNacimiento, FechaHelper.Ahora()));
            this.AgregarValidacion(new ValidadorString(tbDireccion, 1, 255));
            this.AgregarValidacion(new ValidadorNumerico(tbTelefono));
            this.AgregarValidacion(new ValidadorString(tbMail, 1, 255));
            this.AgregarValidacion(new ValidadorMail(tbMail));
            this.AgregarValidacion(new ValidadorString(tbPlanMedico, 1, 255));
            this.dpFechaNacimiento.Value = FechaHelper.Ahora();
            this.CargarCombos();

            if (_afiliadoAnterior != null)
            {
                tbApellido.Text     = _afiliadoAnterior.Apellido;
                tbApellido.ReadOnly = true;

                tbDireccion.Text = _afiliadoAnterior.Direccion;
                tbTelefono.Text  = _afiliadoAnterior.Telefono.ToString();

                cbEstadoCivil.SelectedItem = (!EsHijo) ? _afiliadoAnterior.EstadoCivil : new Soltero();
                cbEstadoCivil.Enabled      = EsHijo;

                ndCantHijos.Enabled = false;
                ndCantHijos.Value   = (!EsHijo) ? _afiliadoAnterior.CantidadHijos : 0;

                this.CargarPlan(_planAnterior);
            }
        }
Ejemplo n.º 3
0
        static void Main()
        {
            string path     = AppConfigReader.Get("log_path");
            string filename = Path.Combine(path, string.Format("{0}.log", DateTime.Now.ToString("yyyyMMddhhmmss")));

            ContextoActual = new Contexto(filename, FechaHelper.Ahora());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                ContextoActual.Logger.Iniciar();
                Application.Run(new FrmPrincipal());
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError("Ha ocurrido un error fatal. Revise el archivo de log para obtener más información al respecto.");
                ContextoActual.Logger.Log(ex);
            }
            finally
            {
                ContextoActual.Logger.Finalizar();
            }
        }
Ejemplo n.º 4
0
        private bool validacionFechas(DateTimePicker dpFechaDesde, DateTimePicker dpFechaHasta)
        {
            bool resultado = new ValidadorDateTimeFrom(dpFechaDesde, FechaHelper.Ahora()).Validar()
                             & new ValidadorDateTimeUntil(dpFechaHasta, dpFechaDesde.Value.AddDays(120)).Validar()
                             & new ValidadorDateTimeFrom(dpFechaHasta, dpFechaDesde.Value).Validar();

            return(resultado);
        }
 private void FrmRegistroDeResultado_Load(object sender, EventArgs e)
 {
     dpFecha.Value        = FechaHelper.Ahora();
     dpFecha.Format       = DateTimePickerFormat.Custom;
     dpFecha.CustomFormat = "dd/MM/yyyy, hh:mm";
     this.AgregarValidacion(new ValidadorString(tbDiagnostico, 1, 255));
     this.AgregarValidacion(new ValidadorString(tbSintomas, 1, 255));
     this.btnConfirmarHorario.Enabled = false;
     this.button1.Enabled             = false;
 }
Ejemplo n.º 6
0
        protected override IList <SqlParameter> GenerarParametrosBorrar(decimal id)
        {
            IList <SqlParameter> parameters = base.GenerarParametrosBorrar(id);

            SqlParameter fechaBaja = new SqlParameter("@p_fecha_baja", System.Data.SqlDbType.DateTime, 8, "p_fecha_baja");

            fechaBaja.Value = FechaHelper.Ahora();
            parameters.Add(fechaBaja);

            return(parameters);
        }
Ejemplo n.º 7
0
        protected override void AccionLimpiar()
        {
            tbApellido.Text             = string.Empty;
            tbDireccion.Text            = string.Empty;
            tbMail.Text                 = string.Empty;
            tbMatriculaProfesional.Text = string.Empty;
            tbNombre.Text               = string.Empty;
            tbNroDocumento.Text         = string.Empty;
            tbTelefono.Text             = string.Empty;

            dpFechaNacimiento.Value = FechaHelper.Ahora();
        }
 private void btnRegistrar_Click(object sender, EventArgs e)
 {
     DateTime ahora = FechaHelper.Ahora();
     if (_turno.HoraInicio.Subtract(ahora).TotalMinutes < 0 )
     {
         this.Registrar();
     }
     else
     {
         MensajePorPantalla.MensajeError(this, "Debería haberse presentado por lo menos 15 minutos antes del comienzo del turno");
     }
 }
Ejemplo n.º 9
0
 private void FrmAfiliadoModificar_Load(object sender, EventArgs e)
 {
     this.AgregarValidacion(new ValidadorString(tbNombre, 1, 255));
     this.AgregarValidacion(new ValidadorString(tbApellido, 1, 255));
     this.AgregarValidacion(new ValidadorCombobox(cbTipoDocumento));
     this.AgregarValidacion(new ValidadorNumerico(tbNroDocumento));
     this.AgregarValidacion(new ValidadorDateTimeUntil(dpFechaNacimiento, FechaHelper.Ahora()));
     this.AgregarValidacion(new ValidadorString(tbDireccion, 1, 255));
     this.AgregarValidacion(new ValidadorNumerico(tbTelefono));
     this.AgregarValidacion(new ValidadorString(tbMail, 1, 255));
     this.AgregarValidacion(new ValidadorMail(tbMail));
 }
Ejemplo n.º 10
0
        private void FrmAfiliadoListado_Load(object sender, EventArgs e)
        {
            AccionLimpiar();
            this.AgregarValidacion(new ValidadorNumerico(tbNroPrincipal));
            this.AgregarValidacion(new ValidadorCombobox(cbTipoDoc));
            this.AgregarValidacion(new ValidadorNumerico(tbPlanMedico));
            this.AgregarValidacion(new ValidadorString(tbNombre, 1, 255));
            this.AgregarValidacion(new ValidadorString(tbApellido, 1, 255));
            this.dtpFechaNac.Value = FechaHelper.Ahora();

            this.CargarCombos();
        }
Ejemplo n.º 11
0
 protected override void AccionLimpiar()
 {
     tbApellido.Text               = string.Empty;
     ndCantHijos.Value             = 0;
     tbDireccion.Text              = string.Empty;
     tbMail.Text                   = string.Empty;
     tbNombre.Text                 = string.Empty;
     tbNroAfiliado.Text            = string.Empty;
     tbNroDocumento.Text           = string.Empty;
     tbTelefono.Text               = string.Empty;
     cbTipoDocumento.SelectedIndex = 0;
     dpFechaNacimiento.Value       = FechaHelper.Ahora();
 }
Ejemplo n.º 12
0
 private void FrmAgendaAlta_Load(object sender, EventArgs e)
 {
     //this.AccionLimpiar();
     this.AgregarValidacion(new ValidadorString(tbProfesional, 1, 255));
     this.AgregarValidacion(new ValidadorCombobox(cbDia));
     this.dpFechaDesde.Value = FechaHelper.Ahora();
     this.dpFechaHasta.Value = FechaHelper.Ahora();
     this.dpExcepcion.Value  = FechaHelper.Ahora();
     this.CargarDiasSemana();
     this.gbDatosAgenda.Enabled   = true;
     this.gbDetalleDiario.Enabled = false;
     this.gbExcepciones.Enabled   = false;
     this.btnGuardar.Enabled      = false;
 }
Ejemplo n.º 13
0
        private void FrmRecetaAlta_Load(object sender, EventArgs e)
        {
            this.dateTimePicker1.Value = FechaHelper.Ahora();
            this.ndCantidad.Value      = 1;
            this.tbCantidad.Text       = "Uno";
            this.cantidadMedicamentos  = 0;

            this.AgregarValidacion(new ValidadorString(tbMedicamento, 1, 255));
            this.dateTimePicker1.Value = FechaHelper.Ahora();
            this.btnAceptar.Enabled    = false;

            this.btnAgregar.Enabled = false;
            this.btnQuitar.Enabled  = false;
            this.btnBuscar.Enabled  = false;
        }
        protected override void AccionIniciar()
        {
            ListaSexo sexos = new ListaSexo();

            this.cbSexo.DataSource    = sexos.Todos;
            this.cbSexo.DisplayMember = "Nombre";
            this.cbSexo.ValueMember   = "Id";

            ListaTipoDocumento documentos = new ListaTipoDocumento();

            this.cbTipoDoc.DataSource     = documentos.Todos;
            this.cbTipoDoc.DisplayMember  = "Nombre";
            this.cbTipoDoc.ValueMember    = "Id";
            this.dtpFechaNacimiento.Value = FechaHelper.Ahora();

            //this.CargarTodosLosProfesionales();
        }
        protected override void AccionLimpiar()
        {
            tbApellido.Text             = string.Empty;
            tbDireccion.Text            = string.Empty;
            tbMail.Text                 = string.Empty;
            tbMatriculaProfesional.Text = string.Empty;
            tbNombre.Text               = string.Empty;
            tbNroDocumento.Text         = string.Empty;
            tbTelefono.Text             = string.Empty;

            dpFechaNacimiento.Value = FechaHelper.Ahora();

            //foreach (int i in clbEspecialidades.CheckedIndices)
            //{
            //    clbEspecialidades.SetItemCheckState(i, CheckState.Unchecked);
            //}
        }
Ejemplo n.º 16
0
        private void btnFarmacia_Click(object sender, EventArgs e)
        {
            BonoFarmacia farmacia = new BonoFarmacia();

            farmacia.IdPlanMedico     = _afiliado.IdPlanMedico;
            farmacia.NombrePlanMedico = _plan.Descripcion;
            farmacia.FechaVencimiento = FechaHelper.Ahora().AddDays(60);

            this.lstBonos.Items.Add(farmacia);

            Decimal subtotal = Convert.ToDecimal(tbPrecioTotal.Text);

            subtotal          += _plan.PrecioBonoFarmacia;
            tbPrecioTotal.Text = subtotal.ToString();

            this.btnComprar.Enabled = true;
        }
        private void FrmProfesionalAlta_Load(object sender, EventArgs e)
        {
            AccionLimpiar();

            this.CargarCombo();

            this.AgregarValidacion(new ValidadorString(tbNombre, 1, 255));
            this.AgregarValidacion(new ValidadorString(tbApellido, 1, 255));
            this.AgregarValidacion(new ValidadorCombobox(cbTipoDocumento));
            this.AgregarValidacion(new ValidadorNumerico(tbNroDocumento));
            this.AgregarValidacion(new ValidadorString(tbDireccion, 1, 255));
            this.AgregarValidacion(new ValidadorNumerico(tbTelefono));
            this.AgregarValidacion(new ValidadorString(tbMail, 1, 255));
            this.AgregarValidacion(new ValidadorDateTimeUntil(dpFechaNacimiento, FechaHelper.Ahora()));
            this.AgregarValidacion(new ValidadorCombobox(cbSexo));
            this.AgregarValidacion(new ValidadorNumerico(tbMatriculaProfesional));
            this.AgregarValidacion(new ValidadorLista(lstEspecialidades));
            this.dpFechaNacimiento.Value = FechaHelper.Ahora();
        }
Ejemplo n.º 18
0
        public IResultado <Compra> Comprar(Afiliado afiliado, decimal costo, IList <BonoConsulta> bonosConsulta, IList <BonoFarmacia> bonosFarmacia)
        {
            Resultado <Compra> resultado = new Resultado <Compra>();

            try
            {
                Compra compra = new Compra();

                DateTime fechaImpresion = FechaHelper.Ahora();

                decimal idCompra = _dal.RegistrarCompra(afiliado, fechaImpresion, costo);
                compra.IdCompra = idCompra;

                foreach (BonoConsulta bono in bonosConsulta)
                {
                    bono.FechaImpresion = fechaImpresion;
                    bono.IdCompra       = idCompra;
                    decimal idBono = _dal.CrearBonoConsulta(bono);
                    bono.IdBonoConsulta = idBono;
                    compra.BonosConsulta.Add(bono);
                }

                foreach (BonoFarmacia bono in bonosFarmacia)
                {
                    bono.FechaImpresion = fechaImpresion;
                    bono.IdCompra       = idCompra;
                    decimal idBono = _dal.CrearBonoFarmacia(bono);
                    bono.IdBonoFarmacia = idBono;
                    compra.BonosFarmacia.Add(bono);
                }
                resultado.Retorno = compra;
            }
            catch (Exception ex)
            {
                resultado.Correcto = false;
                resultado.Mensajes.Add(ex.Message);
            }

            return(resultado);
        }
        private void FrmCancelarProfesional_Load(object sender, EventArgs e)
        {
            try
            {
                IResultado <IList <TipoCancelacion> > resultado = _tipoCancDomain.ObtenerTodos();
                if (!resultado.Correcto)
                {
                    throw new ResultadoIncorrectoException <IList <TipoCancelacion> >(resultado);
                }

                this.cbTipo.DataSource    = resultado.Retorno;
                this.cbTipo.DisplayMember = "Nombre";
                this.cbTipo.ValueMember   = "IdTipoCancelacion";

                this.monthCalendar1.SelectionStart = FechaHelper.Ahora();
                this.monthCalendar1.SelectionEnd   = FechaHelper.Ahora();
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(this, ex.Message);
            }
        }
        private void CancelarTurnos()
        {
            IValidador vMotivo = new ValidadorString(textBox2, 1, 255);

            if (vMotivo.Validar())
            {
                StringBuilder sb = new StringBuilder("Se cancelaran los siguientes días: ").Append(Environment.NewLine);
                for (DateTime dia = monthCalendar1.SelectionStart; dia <= monthCalendar1.SelectionEnd; dia = dia.AddDays(1))
                {
                    sb.Append(FechaHelper.Format(dia, FechaHelper.DateFormat)).Append(Environment.NewLine);
                }
                DialogResult ds = MensajePorPantalla.MensajeInterrogativo(this, sb.ToString(), MessageBoxButtons.YesNo);
                if (ds == DialogResult.Yes)
                {
                    for (DateTime dia = monthCalendar1.SelectionStart; dia <= monthCalendar1.SelectionEnd; dia = dia.AddDays(1))
                    {
                        IList <Turno> turnosDelDia = _domain.BuscarTurnos(_profesional.IdProfesional, dia).Retorno;
                        foreach (Turno turno in turnosDelDia)
                        {
                            Cancelacion c = new Cancelacion();
                            c.CanceladoPor      = 'P';
                            c.Fecha             = FechaHelper.Ahora();
                            c.IdTipoCancelacion = ((TipoCancelacion)cbTipo.SelectedItem).IdTipoCancelacion;
                            c.IdTurno           = turno.IdTurno;
                            c.Motivo            = textBox2.Text;

                            IResultado <Cancelacion> resultado = _domain.Cancelar(c);
                            if (!resultado.Correcto)
                            {
                                throw new ResultadoIncorrectoException <Cancelacion>(resultado);
                            }
                        }
                    }
                    MensajePorPantalla.MensajeInformativo(this, "Se han cancelado los turnos");
                    this.Close();
                }
            }
        }
Ejemplo n.º 21
0
        public FrmProfesionalModificar(Profesional profesional)
            : base()
        {
            _profesionalDomain  = new ProfesionalDomain(Program.ContextoActual.Logger);
            _especialidadDomain = new EspecialidadDomain(Program.ContextoActual.Logger);

            _profesional = profesional;

            InitializeComponent();

            ListaSexo sexos = new ListaSexo();

            this.cbSexo.DataSource    = sexos.Todos;
            this.cbSexo.DisplayMember = "Nombre";
            this.cbSexo.ValueMember   = "Id";

            ListaTipoDocumento documentos = new ListaTipoDocumento();

            this.cbTipoDocumento.DataSource    = documentos.Todos;
            this.cbTipoDocumento.DisplayMember = "Nombre";
            this.cbTipoDocumento.ValueMember   = "Id";
            this.dpFechaNacimiento.Value       = FechaHelper.Ahora();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                Cancelacion c = new Cancelacion();
                c.Fecha             = FechaHelper.Ahora();
                c.IdTipoCancelacion = ((TipoCancelacion)cbTipo.SelectedItem).IdTipoCancelacion;
                c.IdTurno           = _turno.IdTurno;
                c.Motivo            = tbMotivo.Text;
                c.CanceladoPor      = 'A';

                IResultado <Cancelacion> resultado = _domain.Cancelar(c);
                if (!resultado.Correcto)
                {
                    throw new ResultadoIncorrectoException <Cancelacion>(resultado);
                }
                MensajePorPantalla.MensajeInformativo(this, "Su turno ha sido cancelado con éxito.");
                this.Close();
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(this, ex.Message);
            }
        }
 private void CargarProfesional(Profesional profesional)
 {
     try
     {
         this._profesional = profesional;
         this.btnBuscarProfesional.Enabled = false;
         this.tbProfesional.Text           = profesional.NombreCompleto;
         IResultado <FechaTurno> resultado = _turnoDomain.ObtenerFechasParaTurnos(profesional.IdProfesional, FechaHelper.Ahora());
         if (!resultado.Correcto)
         {
             throw new ResultadoIncorrectoException <FechaTurno>(resultado);
         }
         this.mcDesde.Enabled   = true;
         this.btnTurnos.Enabled = true;
         this.mcDesde.MinDate   = resultado.Retorno.FechaDesde;
         this.mcDesde.MaxDate   = resultado.Retorno.FechaHasta;
     }
     catch (Exception ex)
     {
         MensajePorPantalla.MensajeError(this, ex.Message);
     }
 }
Ejemplo n.º 24
0
        protected override IList <SqlParameter> GenerarParametrosModificar(Afiliado entidad)
        {
            IList <SqlParameter> parametros = new List <SqlParameter>();

            SqlParameter pId = new SqlParameter("@p_id", System.Data.SqlDbType.Decimal, 18, "p_id");

            pId.Value = entidad.IdAfiliado;
            parametros.Add(pId);

            SqlParameter pNroPrincipal = new SqlParameter("@p_nro_principal", System.Data.SqlDbType.Decimal, 18, "p_nro_principal");

            pNroPrincipal.Value = entidad.NroPrincipal;
            parametros.Add(pNroPrincipal);

            SqlParameter pNroSecundario = new SqlParameter("@p_nro_secundario", System.Data.SqlDbType.Decimal, 18, "p_nro_secundario");

            pNroSecundario.Value = entidad.NroSecundario;
            parametros.Add(pNroSecundario);


            SqlParameter pIdPlanMedico = new SqlParameter("@p_id_plan_medico", System.Data.SqlDbType.Decimal, 18, "p_id_plan_medico");

            pIdPlanMedico.Value = entidad.IdPlanMedico;
            parametros.Add(pIdPlanMedico);

            SqlParameter pTipoDocumento = new SqlParameter("@p_tipo_documento", System.Data.SqlDbType.Int, 4, "p_tipo_documento");

            pTipoDocumento.Value = entidad.TipoDocumento.Id;
            parametros.Add(pTipoDocumento);

            SqlParameter pDocumento = new SqlParameter("@p_documento", System.Data.SqlDbType.Decimal, 18, "p_documento");

            pDocumento.Value = entidad.Documento;
            parametros.Add(pDocumento);

            SqlParameter pNombre = new SqlParameter("@p_nombre", System.Data.SqlDbType.VarChar, 255, "p_nombre");

            pNombre.Value = entidad.Nombre;
            parametros.Add(pNombre);

            SqlParameter pApellido = new SqlParameter("@p_apellido", System.Data.SqlDbType.VarChar, 255, "p_apellido");

            pApellido.Value = entidad.Apellido;
            parametros.Add(pApellido);

            SqlParameter pDireccion = new SqlParameter("@p_direccion", System.Data.SqlDbType.VarChar, 255, "p_direccion");

            pDireccion.Value = entidad.Direccion;
            parametros.Add(pDireccion);

            SqlParameter pTelefono = new SqlParameter("@p_telefono", System.Data.SqlDbType.Decimal, 18, "p_telefono");

            pTelefono.Value = entidad.Telefono;
            parametros.Add(pTelefono);

            SqlParameter pMail = new SqlParameter("@p_mail", System.Data.SqlDbType.VarChar, 255, "p_mail");

            pMail.Value = entidad.Mail;
            parametros.Add(pMail);

            SqlParameter pFechaNacimiento = new SqlParameter("@p_fecha_nacimiento", System.Data.SqlDbType.DateTime, 8, "p_fecha_nacimiento");

            pFechaNacimiento.Value = entidad.FechaNacimiento;
            parametros.Add(pFechaNacimiento);

            SqlParameter pSexo = new SqlParameter("@p_sexo", System.Data.SqlDbType.Int, 4, "p_sexo");

            pSexo.Value = entidad.Sexo.Id;
            parametros.Add(pSexo);

            SqlParameter pEstadoCivil = new SqlParameter("@p_estado_civil", System.Data.SqlDbType.Int, 4, "p_estado_civil");

            pEstadoCivil.Value = entidad.EstadoCivil.Id;
            parametros.Add(pEstadoCivil);

            SqlParameter pFechaHoy = new SqlParameter("@p_fecha_hoy", System.Data.SqlDbType.DateTime, 8, "p_fecha_hoy");

            pFechaHoy.Value = FechaHelper.Ahora();
            parametros.Add(pFechaHoy);

            return(parametros);
        }
        private void Registrar()
        {
            try
            {
                decimal idBono = Convert.ToDecimal(this.tbBonoConsulta.Text);
                IResultado<bool> resultado = _domain.RegistrarLlegada(idBono, _turno.IdTurno, FechaHelper.Ahora());
                if (!resultado.Correcto)
                    throw new ResultadoIncorrectoException<bool>(resultado);

                MensajePorPantalla.MensajeInformativo(this, "La llegada al turno ha sido registrada");
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(this, ex.Message);
            }
            
        }
 private void FrmAgendaConsultar_Load(object sender, EventArgs e)
 {
     this.mcDesde.TodayDate      = FechaHelper.Ahora();
     this.mcDesde.SelectionStart = FechaHelper.Ahora();
     this.mcDesde.SelectionEnd   = FechaHelper.Ahora();
 }
Ejemplo n.º 27
0
        private void btnValidar_Click(object sender, EventArgs e)
        {
            try
            {
                decimal idBono = Convert.ToDecimal(tbBonoFarmacia.Text);
                IResultado <BonoFarmacia> resultado = _domain.ValidarBonoFarmacia(idBono, _afiliado.NroPrincipal, FechaHelper.Ahora());
                if (!resultado.Correcto)
                {
                    throw new ResultadoIncorrectoException <BonoFarmacia>(resultado);
                }

                bonoFarmacia = resultado.Retorno;

                groupBox2.Enabled            = true;
                this.tbBonoFarmacia.ReadOnly = true;
                this.btnBuscar.Enabled       = true;
                this.btnAgregar.Enabled      = true;
                this.btnQuitar.Enabled       = true;
                this.dateTimePicker1.Enabled = false;
            }
            catch (Exception ex)
            {
                MensajePorPantalla.MensajeError(this, ex.Message);
            }
        }