Exemplo n.º 1
0
        private void CargaFicha(int Id)
        {
            TrxCARGA_PRESTACIONES_VETERINARIAS_DETALLE PrestacionesVeterinarias = new TrxCARGA_PRESTACIONES_VETERINARIAS_DETALLE();
            var prestaciones = PrestacionesVeterinarias.GetByIdWithReferencesFull(Id);

            if (prestaciones == null)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "js_carga_prestaciones", "javascript:alert('No existe información asociada.');", true);
            }

            //cargar ficha
            txtNumeroFicha.Text    = prestaciones.FICHA;
            txtNombre.Text         = prestaciones.NOMBRE;
            txtEspecie.Text        = prestaciones.ESPECIE;
            txtRaza.Text           = prestaciones.RAZA;
            txtSexo.Text           = prestaciones.SEXO;
            txtEdad.Text           = prestaciones.EDAD;
            txtTelefono.Text       = prestaciones.TELEFONO;
            txtProcedencia.Text    = prestaciones.PROCEDENCIA;
            txtGarantia.Text       = prestaciones.GARANTIA;
            txtPendiente.Text      = prestaciones.PENDIENTE;
            txtMontoTotal.Text     = prestaciones.TOTAL;
            txtRecepcion.Text      = prestaciones.RECEPCION;
            txtMedico.Text         = prestaciones.MEDICO;
            txtSolicitante.Text    = prestaciones.SOLICITA;
            txtFechaRecepción.Text = prestaciones.VALOR_FECHA_RECEPCION.ToString();//.FECHA_RECEPCION;
            txtFichaClinica.Text   = prestaciones.FICHA_CLINICA;

            //carga grilla
            var lista = prestaciones.CARGA_PRESTACIONES_VETERINARIAS_EXAMEN.Where(e => e.ACTIVO);
            List <DTOExamen> listaDTO = new List <DTOExamen>();

            foreach (var item in lista)
            {
                listaDTO.Add(new DTOExamen(item));
            }
            this.ListaExamen = listaDTO;

            //se carga grilla
            grdExamen.DataSource = listaDTO;
            grdExamen.DataBind();

            //validar
            TrxCARGA_PRESTACIONES_ENCABEZADO PrestacionesEncabezado = new TrxCARGA_PRESTACIONES_ENCABEZADO();
            var listaErrores = PrestacionesEncabezado.ValidarPrestacionVeterinaria(Id);

            grdErroresVeterinarios.DataSource = listaErrores;
            grdErroresVeterinarios.DataBind();
            panelErrores.Visible = listaErrores.Any();

            //Habilitar Edicion de Ficha
            string estado = prestaciones.CARGA_PRESTACIONES_ENCABEZADO.CARGA_PRESTACIONES_ESTADO.NOMBRE;

            if (estado == ENUM_CARGA_PRESTACIONES_ESTADO.Pendiente.ToString())
            {
                EditarFicha();
            }

            CalculoMontoPrestaciones();
        }
Exemplo n.º 2
0
        private void CargaGrilla(int?IdEstado, int?TipoPrestacion)
        {
            TrxCARGA_PRESTACIONES_ENCABEZADO CargaPrestacionesEncabezado = new TrxCARGA_PRESTACIONES_ENCABEZADO();

            gridRegistroCargaArchivo.DataSource = CargaPrestacionesEncabezado.GetResumenCargaPrestaciones(IdEstado, TipoPrestacion);
            gridRegistroCargaArchivo.DataBind();
        }
Exemplo n.º 3
0
        protected void btnCompletarRevision_Click(object sender, EventArgs e)
        {
            try
            {
                //verificar los registros selecionados
                foreach (GridViewRow grilla in gridRegistroCargaArchivo.Rows)
                {
                    CheckBox ChkEditar = (CheckBox)grilla.FindControl("ChkEditar");
                    if (ChkEditar.Checked)
                    {
                        var hdnId = grilla.FindControl("hdnId") as HiddenField;
                        int IdCargaPrestacionesEncabezado = int.Parse(hdnId.Value);

                        TrxCARGA_PRESTACIONES_ENCABEZADO carga = new TrxCARGA_PRESTACIONES_ENCABEZADO();
                        carga.CambiarEstadoCarga(IdCargaPrestacionesEncabezado, (int)ENUM_CARGA_PRESTACIONES_ESTADO.Completado);
                    }
                }
                btnBuscar_Click(null, null);
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                panelMensaje.CssClass = "MostrarMensaje";
                lblMensaje.Text       = ex.Message;
                return;
            }
        }
Exemplo n.º 4
0
        protected void btnPaso1Adjuntar_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    //panelMensaje.CssClass = "OcultarMensaje";

                    if (!fileExcel.HasFile)
                    {
                        return;
                    }
                    btnPaso1Adjuntar.Visible = false;

                    //Leer archivo Excel
                    string fileExt = Path.GetExtension(fileExcel.FileName).ToLower();
                    if ((fileExt == ".xls") || (fileExt == ".xlsx"))
                    {
                        int fileSize = fileExcel.PostedFile.ContentLength;

                        // Limite: 4MB
                        if (fileSize < 4194304)
                        {
                            TrxCARGA_PRESTACIONES_ENCABEZADO _TrxCARGA_PRESTACIONES_ENCABEZADO = new TrxCARGA_PRESTACIONES_ENCABEZADO();
                            int IdCargaPrestacionesEncabezado = _TrxCARGA_PRESTACIONES_ENCABEZADO.UploadArchivoPrestaciones((int)ENUM_TIPO_PRESTACION.Humanas, fileExcel.FileName, fileExcel.FileBytes);
                            Response.Redirect("RegistroCargaArchivo.aspx", false);
                        }
                        else
                        {
                            throw new Exception("El archivo supera el tamaño máximo permitido: 4MB. ");
                        }
                    }
                    else
                    {
                        throw new Exception("Formato de archivo no permitido. ");
                    }
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                panelMensaje.CssClass = "MostrarMensaje";
                lblMensaje.Text       = ex.Message;
                return;
            }
            finally
            {
                btnPaso1Adjuntar.Visible = true;
            }
        }
Exemplo n.º 5
0
        private void BuscarPrestaciones()
        {
            grdPrestaciones.Visible = true;
            if (Request.QueryString["Id"] == null)
            {
                throw new Exception("No se ha indicado identificador de la cuenta registrada");
            }
            string Id = Request.QueryString["Id"].ToString();

            DTOFindPrestaciones dto = new DTOFindPrestaciones();

            dto.PageIndex = grdPrestaciones.PageIndex;
            dto.PageSize  = grdPrestaciones.PageSize;

            if (!string.IsNullOrEmpty(txtNroFicha.Text))
            {
                dto.numero = txtNroFicha.Text;
            }
            if (!string.IsNullOrEmpty(txtNombre.Text))
            {
                dto.nombre = txtNombre.Text;
            }
            if (!string.IsNullOrEmpty(ddlEstadoPrestacion.SelectedValue))
            {
                dto.estado = int.Parse(ddlEstadoPrestacion.SelectedValue);
            }
            if (!string.IsNullOrEmpty(txtProcedencia.Text))
            {
                dto.prodedencia = txtProcedencia.Text;
            }
            dto.id = int.Parse(Id);

            TrxCARGA_PRESTACIONES_ENCABEZADO carga = new TrxCARGA_PRESTACIONES_ENCABEZADO();
            int Total = carga.GetDetalleCargaPrestacionesCount(dto);

            grdPrestaciones.DataSource = carga.GetDetalleCargaPrestaciones(dto);
            grdPrestaciones.DataBind();

            Paginador1.TotalPages = Total % grdPrestaciones.PageSize == 0 ? Total / grdPrestaciones.PageSize : Total / grdPrestaciones.PageSize + 1;
            Paginador1.Visible    = (Total > 0);
            Paginador1.Inicializar(dto);
        }
Exemplo n.º 6
0
        protected void btnPaso1Adjuntar_Click(object sender, EventArgs e)
        {
            if (!fileExcel.HasFile)
            {
                return;
            }

            //Leer archivo Excel
            string fileExt = (fileExcel.FileName).ToLower();

            if ((fileExt == ".xls") || (fileExt == ".xlsx"))
            {
                int fileSize = fileExcel.PostedFile.ContentLength;

                // Limite: 4MB
                if (fileSize < 4194304)
                {
                    int    TipoIngreso = ddlTipoPrestacion.SelectedIndex;
                    string filename    = DateTime.UtcNow.ToString("yyyyMMddhhmmssffff") + "_" + fileExcel.FileName;
                    byte[] Size        = fileExcel.FileBytes;
                    TrxCARGA_PRESTACIONES_ENCABEZADO _TrxCARGA_PRESTACIONES_ENCABEZADO = new TrxCARGA_PRESTACIONES_ENCABEZADO();
                    var ingreso = _TrxCARGA_PRESTACIONES_ENCABEZADO.UploadArchivoPrestaciones(TipoIngreso, filename, Size);
                }
                else
                {
                    lblMensaje.Text = "El archivo supera el tamaño máximo permitido: 4MB. ";
                }
            }
            else
            {
                lblMensaje.Text = "Formato de archivo no permitido. ";
            }

            #region trash

            /*
             * try
             * {
             *  if (Page.IsValid)
             *  {
             *      if (!fileExcel.HasFile) return;
             *      btnPaso1Adjuntar.Visible = false;
             *
             *      //Leer archivo Excel
             *      string fileExt = Path.GetExtension(fileExcel.FileName).ToLower();
             *      if ((fileExt == ".xls") || (fileExt == ".xlsx"))
             *      {
             *          int fileSize = fileExcel.PostedFile.ContentLength;
             *
             *          // Limite: 4MB
             *          if (fileSize < 4194304)
             *          {
             *              string filename = DateTime.UtcNow.ToString("yyyyMMddhhmmssffff") + "_" + fileExcel.FileName;
             *              string archivo = Variables.DirectorioCargaMasiva + @"\" + filename;
             *
             *              if (!Directory.Exists(Variables.DirectorioCargaMasiva))
             *              {
             *                  Directory.CreateDirectory(Variables.DirectorioCargaMasiva);
             *              }
             *
             *              fileExcel.SaveAs(archivo);
             *
             *              List<DTOCargaTribunal> lista = new List<DTOCargaTribunal>();
             *              if ((fileExt == ".txt") || (fileExt == ".csv"))
             *              {
             *                  lista = ProcesarArchivoTexto(archivo);
             *              }
             *              else if ((fileExt == ".xls") || (fileExt == ".xlsx"))
             *              {
             *                  varPathFile = archivo;
             *
             *                  Guid TaskID = Guid.NewGuid();
             *                  this.hdnTaskId.Value = TaskID.ToString();
             *
             *                  Thread newThread = new Thread(ProcesarArchivoExcel);
             *                  newThread.Start();
             *
             *                  Timer1.Enabled = true;
             *              }
             *          }
             *          else
             *          {
             *              lblErrorArchivo.Text = "El archivo supera el tamaño máximo permitido: 4MB. ";
             *          }
             *      }
             *      else
             *      {
             *          lblErrorArchivo.Text = "Formato de archivo no permitido. ";
             *      }
             *
             *  }
             * }
             * catch (Exception ex)
             * {
             *  ISException.RegisterExcepcion(ex);
             *  lblMensaje.Text = ex.Message;
             *  return;
             * }
             * finally
             * {
             *  btnPaso1Adjuntar.Visible = true;
             * }
             */
            #endregion
        }
Exemplo n.º 7
0
        private void CargaFicha(int Id)
        {
            try
            {
                TrxCARGA_PRESTACIONES_HUMANAS_DETALLE PrestacionesHumanas = new TrxCARGA_PRESTACIONES_HUMANAS_DETALLE();
                var prestaciones = PrestacionesHumanas.GetByIdWithReferencesFull(Id);
                if (prestaciones == null)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "js_carga_prestaciones", "javascript:alert('No existe información asociada.');", true);
                }

                //cargar ficha
                txtNombre.Text         = prestaciones.NOMBRE;
                txtNumeroFicha.Text    = prestaciones.FICHA;
                txtFechaRecepcion.Text = prestaciones.FECHA_RECEPCION;
                txtTelefono.Text       = prestaciones.TELEFONO;
                txtMedico.Text         = prestaciones.MEDICO;
                txtProcedencia.Text    = prestaciones.PROCEDENCIA;
                txtPrevision.Text      = prestaciones.PREVISION;
                txtGarantia.Text       = prestaciones.GARANTIA;
                txtPendiente.Text      = prestaciones.PENDIENTE;
                txtPagado.Text         = prestaciones.PAGADO;
                txtMontoTotal.Text     = prestaciones.TOTAL;
                txtRecepcion.Text      = prestaciones.RECEPCION;
                txtEdad.Text           = prestaciones.EDAD;
                txtRut.Text            = prestaciones.RUT;

                var lista = prestaciones.CARGA_PRESTACIONES_HUMANAS_EXAMEN.Where(e => e.ACTIVO);
                List <DTOExamen> listaDTO = new List <DTOExamen>();
                foreach (var item in lista)
                {
                    listaDTO.Add(new DTOExamen(item));
                }
                this.ListaExamen = listaDTO;

                //se carga grilla
                grdExamen.DataSource = listaDTO;
                grdExamen.DataBind();

                // validar
                TrxCARGA_PRESTACIONES_ENCABEZADO PrestacionesEncabezado = new TrxCARGA_PRESTACIONES_ENCABEZADO();
                var listaErrores = PrestacionesEncabezado.ValidarPrestacionHumana(Id);
                grdErroresHumanos.DataSource = listaErrores;
                grdErroresHumanos.DataBind();
                panelErrores.Visible = listaErrores.Any();

                //Habilitar Edicion de Ficha
                if (prestaciones.CARGA_PRESTACIONES_ENCABEZADO.CARGA_PRESTACIONES_ESTADO.ID == (int)ENUM_CARGA_PRESTACIONES_ESTADO.Pendiente) //o con errores
                {
                    EditarFicha();
                }

                CalculoMontoPrestaciones();
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                panelMensaje.CssClass = "MostrarMensaje";
                lblMensaje.Text       = ex.Message;
                return;
            }
        }
Exemplo n.º 8
0
        protected void btnValidado_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    CalculoMontoPrestaciones();

                    if (Request.QueryString["Id"] == null)
                    {
                        throw new Exception("No se ha indicado identificador de la cuenta registrada");
                    }

                    int Id = int.Parse(Request.QueryString["Id"].ToString());

                    if (!string.IsNullOrEmpty(txtRut.Text))
                    {
                        if (!ValidaRut(txtRut.Text))
                        {
                            throw new Exception("Rut no es valido");
                        }
                    }

                    //se obtienen los datos desde el formuario
                    IFormatProvider culture = new CultureInfo("es-CL", true);
                    int             IdCargaPrestacionesDetalleEstado = (int)ENUM_CARGA_PRESTACIONES_DETALLE_ESTADO.Validado;
                    string          ficha          = !string.IsNullOrEmpty(txtNumeroFicha.Text) ? txtNumeroFicha.Text : string.Empty;
                    string          nombre         = !string.IsNullOrEmpty(txtNombre.Text) ? txtNombre.Text : string.Empty;
                    string          fechaRecepcion = !string.IsNullOrEmpty(txtFechaRecepcion.Text) ? txtFechaRecepcion.Text : string.Empty;
                    string          telefono       = !string.IsNullOrEmpty(txtTelefono.Text) ? txtTelefono.Text : string.Empty;
                    string          medico         = !string.IsNullOrEmpty(txtMedico.Text) ? txtMedico.Text : string.Empty;
                    string          procedencia    = txtProcedencia.Text.Trim();
                    string          prevision      = !string.IsNullOrEmpty(txtPrevision.Text) ? txtPrevision.Text : string.Empty;
                    string          garantia       = !string.IsNullOrEmpty(txtGarantia.Text) ? txtGarantia.Text : string.Empty;
                    string          pendiente      = !string.IsNullOrEmpty(txtPendiente.Text) ? txtPendiente.Text : string.Empty;
                    string          pagado         = !string.IsNullOrEmpty(txtPagado.Text) ? txtPagado.Text : string.Empty;
                    string          total          = !string.IsNullOrEmpty(txtMontoTotal.Text) ? txtMontoTotal.Text : string.Empty;
                    string          recepcion      = txtRecepcion.Text.Trim();
                    string          edad           = !string.IsNullOrEmpty(txtEdad.Text) ? txtEdad.Text : string.Empty;
                    string          rut            = !string.IsNullOrEmpty(txtRut.Text) ? txtRut.Text : string.Empty;

                    //se recorren los examenes para guardar
                    List <DTOExamen> listaDTO = this.ListaExamen;
                    int numeroFila            = 0;
                    foreach (GridViewRow grilla in grdExamen.Rows)
                    {
                        TextBox txtExamen = (TextBox)grilla.FindControl("txtExamen");
                        TextBox txtValor  = (TextBox)grilla.FindControl("txtValor");

                        listaDTO[numeroFila].NOMBRE_EXAMEN = txtExamen.Text;
                        listaDTO[numeroFila].VALOR_EXAMEN  = txtValor.Text;

                        numeroFila++;
                    }
                    this.ListaExamen = listaDTO;

                    TrxCARGA_PRESTACIONES_ENCABEZADO  PrestacionesEncabezado = new TrxCARGA_PRESTACIONES_ENCABEZADO();
                    DTO_RESULTADO_ACTUALIZACION_FICHA resultado = PrestacionesEncabezado.ActualizarCargaPrestacionHumana(Id,
                                                                                                                         ficha, nombre, fechaRecepcion, telefono, medico, procedencia, prevision, garantia,
                                                                                                                         pendiente, pagado, total, recepcion, edad, rut,
                                                                                                                         IdCargaPrestacionesDetalleEstado, "", this.ListaExamen);

                    if (!resultado.RESULTADO)
                    {
                        // mostrar errores en grilla
                        var listaErrores = resultado.ERRORES_VALIDACION;
                        grdErroresHumanos.DataSource = listaErrores;
                        grdErroresHumanos.DataBind();
                        panelErrores.Visible = listaErrores.Any();
                    }
                    else
                    {
                        //si no existio errores pasa al regsitro siguiente
                        string id          = Request.QueryString["Id"].ToString();
                        int?   IdSiguiente = PrestacionesEncabezado.GetIdSiguienteFichaHumana(int.Parse(id));
                        if (IdSiguiente.HasValue)
                        {
                            Response.Redirect("EditarPrestacionesHumanas.aspx?Id=" + (IdSiguiente.Value).ToString(), false);
                        }
                        else
                        {
                            btnCancelar_Click(null, null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                panelMensaje.CssClass = "MostrarMensaje";
                lblMensaje.Text       = ex.Message;
                return;
            }
        }