protected void txtNroDocumento_TextChanged(object sender, EventArgs e)
 {
     if (txtNroDocumento.Text.Trim() != "")
     {
         Sigesoft.Node.WinClient.BE.PacientList objpacientDto = new Sigesoft.Node.WinClient.BE.PacientList();
         OperationResult objOperationResult = new OperationResult();
         PacientBL       _objPacientBL      = new PacientBL();
         objpacientDto = _objPacientBL.GetPacient(ref objOperationResult, null, txtNroDocumento.Text.Trim());
         if (objpacientDto == null)
         {
             txtNombres.Text                = "";
             txtApellidoPaterno.Text        = "";
             txtApellidoMaterno.Text        = "";
             ddlGenero.SelectedValue        = "-1";
             dpFechaNacimiento.SelectedDate = null;
             txtPuesto.Text = "";
         }
         else
         {
             txtNombres.Text                = objpacientDto.v_FirstName;
             txtApellidoPaterno.Text        = objpacientDto.v_FirstLastName;
             txtApellidoMaterno.Text        = objpacientDto.v_SecondLastName;
             ddlGenero.SelectedValue        = objpacientDto.i_SexTypeId.ToString();
             dpFechaNacimiento.SelectedDate = objpacientDto.d_Birthdate;
             txtPuesto.Text = objpacientDto.v_DocNumber;
         }
     }
 }
        private void frmClonServicio_Load(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            PacientBL       _objPacientBL      = new PacientBL();
            var             clientOrganization = BLL.Utils.GetJoinOrganizationAndLocation(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId);

            Utils.LoadDropDownList(ddlCustomerOrganization, "Value1", "Id", clientOrganization, DropDownListAction.Select);

            Utils.LoadDropDownList(ddlProtocolId, "Value1", "Id", BLL.Utils.GetProtocolsByOrganizationForCombo(ref objOperationResult, "-1", "-1", null), DropDownListAction.Select);

            var lista = _objPacientBL.GetAllCCosto();

            txtCCosto.DataSource    = lista;
            txtCCosto.DisplayMember = "Puesto";
            txtCCosto.ValueMember   = "Puesto";

            txtCCosto.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
            txtCCosto.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
            this.txtCCosto.DropDownWidth    = 250;
            txtCCosto.DisplayLayout.Bands[0].Columns[0].Width = 10;
            txtCCosto.DisplayLayout.Bands[0].Columns[1].Width = 250;
            //if (!string.IsNullOrEmpty(objpacientDto.v_CurrentOccupation))
            //{
            //    txtCCosto.Value = objpacientDto.v_CurrentOccupation;
            //}
        }
        private string GetChangesPerson()
        {
            string cadena       = new PacientBL().GetComentaryUpdateByPersonId(_PersonId);
            string oldComentary = cadena;

            cadena += "<FechaActualiza:" + DateTime.Now.ToString() + "|UsuarioActualiza:" + Globals.ClientSession.v_UserName + "|";
            bool change = false;

            foreach (var item in nombreCamposPersona)
            {
                var    fields = this.Controls.Find(item, true);
                string keyTagControl;
                string value1;

                if (fields.Length > 0)
                {
                    keyTagControl = fields[0].GetType().Name;
                    value1        = GetValueControl(keyTagControl, fields[0]);

                    var ValorCampo = ListValuesCampoPersona.Find(x => x.NombreCampo == item).ValorCampo;
                    if (ValorCampo != value1)
                    {
                        cadena += item + ":" + ValorCampo + "|";
                        change  = true;
                    }
                }
            }
            if (change)
            {
                return(cadena);
            }

            return(oldComentary);
        }
        public frmOccupationalHistory(string pstrMode, string pstrHistoryId, string pstrPacientId, bool Validation)
        {
            OperationResult objOperationResult = new OperationResult();

            PacientBL   objPacientBL = new PacientBL();
            PacientList objpersonDto = new PacientList();

            InitializeComponent();

            objpersonDto = objPacientBL.GetPacient(ref objOperationResult, pstrPacientId, null);
            this.Text    = this.Text + "  (" + objpersonDto.v_FirstName + " " + objpersonDto.v_FirstLastName + " " + objpersonDto.v_SecondLastName + ")";

            _Mode      = pstrMode;
            _HistoryId = pstrHistoryId;
            _PacientId = pstrPacientId;

            Utils.LoadDropDownList(ddlTypeOperationId, "Value1", "Id", BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 204, null), DropDownListAction.Select);

            //frmHistory frm = new frmHistory(_PacientId);
            //bool ResultValidation = false;
            //ResultValidation = frm._Validation;

            //if (Validation)
            //{
            //    btnSave.Enabled = true;
            //}
            //else
            //{
            //    btnSave.Enabled = false;
            //}
        }
        public BoardGenerales GetDataGeneralEtario(string personId)
        {
            DatabaseContext ctx        = new DatabaseContext();
            var             objPacient = ctx.Person.Where(x => x.v_PersonId == personId).FirstOrDefault();
            int             Edad       = new PacientBL().GetEdad(objPacient.d_Birthdate.Value);
            //int grupoEtario = ObtenerIdGrupoEtarioDePaciente(Edad);

            BoardGenerales _BoardGenerales = new BoardGenerales();

            if (Edad < 13)
            {
                _BoardGenerales.DataNinioCustom = new EsoAntecedentesDal().GetNinio(personId);
            }
            else if (13 <= Edad && Edad <= 17)
            {
                _BoardGenerales.DataAdolescenteCustom = new EsoAntecedentesDal().GetAdolescente(personId);
            }
            else if (18 <= Edad && Edad <= 64)
            {
                _BoardGenerales.DataAdultoCustom = new EsoAntecedentesDal().GetAdulto(personId);
            }
            else
            {
                _BoardGenerales.DataAdultoCustom = new EsoAntecedentesDal().GetAdultoMayor(personId);
            }



            return(_BoardGenerales);
        }
Example #6
0
        private void GenerateLaboratorioReport(string pathFile, string pstrServiceId)
        {
            var MedicalCenter     = new ServiceBL().GetInfoMedicalCenter();
            var filiationData     = new PacientBL().GetPacientReportEPS(pstrServiceId);
            var serviceComponents = new ServiceBL().GetServiceComponentsReport(pstrServiceId);

            LaboratorioReport.CreateLaboratorioReport(filiationData, serviceComponents, MedicalCenter, pathFile);
        }
Example #7
0
        private void BindGrid()
        {
            CalendarBL  objCalendarBL  = new CalendarBL();
            calendarDto objcalendarDto = new calendarDto();
            PacientBL   objPacientBL   = new PacientBL();
            PacientList objPacientDto  = new PacientList();

            OperationResult objOperationResult = new OperationResult();

            var objData = GetData(0, null, "", strFilterExpression);

            //Validar que el trabajador exista en el sistema
            objPacientDto = objPacientBL.GetPacient(ref objOperationResult, null, txtDocNumber.Text.Trim());
            //_CalendarId = objData[0].v_CalendarId;
            if (objPacientDto == null)
            {
                MessageBox.Show("Este Trabajador no está ingresado en el sistema SIGESOFT.", "NO SE ENCONTRÓ TRABAJADOR!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string Pacient = objPacientDto.v_FirstName + " " + objPacientDto.v_FirstLastName + " " + objPacientDto.v_SecondLastName;

            if (objData.Count == 0)
            {
                MessageBox.Show("El trabajado " + Pacient + " no está agendado. Comuníquese con el área de Recepción.", "NO SE ENCONTRÓ CITA!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (objData[0].i_CalendarStatusId == (int)CalendarStatus.Cancelado)
                {
                    MessageBox.Show("La cita del trabajor " + Pacient + " ha sido cancelada. Comuníquese con el área de recepción.", "¡INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (objData[0].i_CalendarStatusId != (int)CalendarStatus.Agendado)
                {
                    MessageBox.Show("El trabajor " + Pacient + " ya está dentro del Centro Médico.", "¡INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult Result = MessageBox.Show("¿Desea registar el ingreso de " + Pacient + " al centro médico?", "TRABAJADOR AGENDADO!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (Result == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (var item in objData)
                    {
                        objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, item.v_CalendarId);
                        objcalendarDto.d_EntryTimeCM = DateTime.Now;

                        objcalendarDto.i_CalendarStatusId = (int)CalendarStatus.Ingreso;
                        objCalendarBL.UpdateCalendar(ref objOperationResult, objcalendarDto, Globals.ClientSession.GetAsList());
                    }
                }
                _objLista                    = _objCalendarBL.GetCalendarsPagedAndFiltered1(ref objOperationResult, 0, null, "i_CalendarStatusId ASC , d_EntryTimeCM ASC", null, DateTime.Now.Date, DateTime.Now.Date.AddDays(1));
                grdData.DataSource           = _objLista;
                lblRecordCountTotal.Text     = "Total : " + _objLista.Count.ToString();
                lblRecordCountPendiente.Text = "Pendientes : " + _objLista.FindAll(p => p.i_CalendarStatusId == (int)CalendarStatus.Agendado).Count();
            }
        }
        public BoardEsoAntecedentes ObtenerEsoAntecedentesPorGrupoId(string PersonId)
        {
            BoardEsoAntecedentes _BoardEsoAntecedentes = new BoardEsoAntecedentes();
            DatabaseContext      ctx = new DatabaseContext();
            DateTime             BirthDatePacient = ctx.Person.Where(x => x.v_PersonId == PersonId).FirstOrDefault().d_Birthdate.Value;
            int Edad        = new PacientBL().GetEdad(BirthDatePacient);
            int GrupoEtario = ObtenerIdGrupoEtarioDePaciente(Edad);
            int GrupoBase   = 282; //Antecedentes
            int Grupo       = int.Parse(GrupoBase.ToString() + GrupoEtario.ToString());

            var Actual = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(Grupo, GrupoEtario, PersonId);

            int GrupoEtarioAnterior = 0;

            switch (GrupoEtario)
            {
            case 1:
            {
                GrupoEtarioAnterior = 2;
                break;
            }

            case 2:
            {
                GrupoEtarioAnterior = 4;
                break;
            }

            case 3:
            {
                GrupoEtarioAnterior = 1;
                break;
            }

            case 4:
            {
                GrupoEtarioAnterior = 4;
                break;
            }

            default:
            {
                GrupoEtarioAnterior = 0;
                break;
            }
            }

            var Anterior = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(Grupo, GrupoEtarioAnterior, PersonId);

            _BoardEsoAntecedentes.AntecedenteActual   = Actual;
            _BoardEsoAntecedentes.AntecedenteAnterior = Anterior;
            return(_BoardEsoAntecedentes);
        }
        private DataSet GetReportOftalmologiaAntiguo()
        {
            var dataListForReport = new PacientBL().GetReportOftalmologiaAntiguo(_serviceId, Constants.OFTALMOLOGIA_ID);

            dsGetRepo = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dataListForReport);

            dt.TableName = "dtOftalmologiaAntiguo";
            dsGetRepo.Tables.Add(dt);

            return(dsGetRepo);
        }
        private DataSet GetReportAlturaFisica()
        {
            var dataListForReport = new PacientBL().GetAlturaEstructural(_serviceId, Constants.ALTURA_ESTRUCTURAL_ID);

            dsGetRepo = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dataListForReport);

            dt.TableName = "dtAlturaEstructural";

            dsGetRepo.Tables.Add(dt);

            return(dsGetRepo);
        }
        private DataSet GetReportPsicologia()
        {
            var dataListForReport = new PacientBL().GetFichaPsicologicaOcupacional(_serviceId);

            dsGetRepo = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dataListForReport);

            dt.TableName = "InformePsico";

            dsGetRepo.Tables.Add(dt);

            return(dsGetRepo);
        }
Example #12
0
        private DataSet GetReportOsteomuscular2()
        {
            var dataListForReport = new PacientBL().GetMusculoEsqueletico(_serviceId, Constants.OSTEO_MUSCULAR_ID_1);

            dsGetRepo = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dataListForReport);

            dt.TableName = "dtMusculoEsqueletico";

            dsGetRepo.Tables.Add(dt);

            return dsGetRepo;

        }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                var MedicalCenter = new ServiceBL().GetInfoMedicalCenter();

                List <string> Filters       = new List <string>();
                DateTime?     pdatBeginDate = dtpDateTimeStar.Value.Date;
                DateTime?     pdatEndDate   = dptDateTimeEnd.Value.Date.AddDays(1);

                if (ddlCustomerOrganization.SelectedValue.ToString() != "-1")
                {
                    var id3 = ddlCustomerOrganization.SelectedValue.ToString().Split('|');
                    Filters.Add("v_CustomerOrganizationId==" + "\"" + id3[0] + "\"&&v_CustomerLocationId==" + "\"" + id3[1] + "\"");
                }

                if (ddlProtocolId.SelectedValue.ToString() != "-1")
                {
                    Filters.Add("IdProtocolId==" + "\"" + ddlProtocolId.SelectedValue + "\"");
                }

                // Create the Filter Expression
                strFilterExpression = null;
                if (Filters.Count > 0)
                {
                    foreach (string item in Filters)
                    {
                        strFilterExpression = strFilterExpression + item + " && ";
                    }
                    strFilterExpression = strFilterExpression.Substring(0, strFilterExpression.Length - 4);
                }

                if (MedicalCenter.v_IdentificationNumber == "20505518145")
                {
                    var objData = new PacientBL().ReporteMatrizExcelSanJoaquin(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdData.DataSource  = objData;
                    lblRecordCount.Text = string.Format("Se encontraron {0} registros.", objData.Count());
                }
                else
                {
                    //var objData = new PacientBL().ReporteMatrizExcel(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    var objData = new PacientBL().ReporteMatrizExcel(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);

                    grdData.DataSource  = objData;
                    lblRecordCount.Text = string.Format("Se encontraron {0} registros.", objData.Count());
                }
            }
        }
        private void frmConsentimientoHojaRuta_Load(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                crConsentimientoHojaRuta rp = null;
                rp = new Reports.crConsentimientoHojaRuta();

                //Hoja de Ruta
                OperationResult objOperationResult = new OperationResult();
                // Cabecera
                var headerRoadMap = _calendarBL.GetHeaderRoadMap(_calendarId);
                // Detalle
                var detailRoadMap = _serviceBL.GetServiceComponentsByCategoryExceptLab(ref objOperationResult, _serviceId);

                DataSet ds = new DataSet();

                DataTable dtHeader = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(headerRoadMap);
                DataTable dtDetail = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(detailRoadMap);

                dtHeader.TableName = "dtHeaderRoadMap";
                dtDetail.TableName = "dtDetailRoadMap";

                ds.Tables.Add(dtHeader);
                ds.Tables.Add(dtDetail);
                rp.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                rp.Subreports["crRoadMap.rpt"].SetDataSource(ds);
                rp.DetailSection1.SectionFormat.EnableSuppress = false;

                ////Consentimiento

                var     aptitudeCertificate = new PacientBL().GetReportConsentimiento(_serviceId);
                DataSet ds1 = new DataSet();

                DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(aptitudeCertificate);

                dt.TableName = "dtConsentimiento";

                ds1.Tables.Add(dt);
                rp.Subreports["crConsentimiento.rpt"].SetDataSource(ds1);
                rp.Section3.SectionFormat.EnableSuppress = false;

                crystalReportViewer1.EnableDrillDown = false;
                var Path = Application.StartupPath;
                rp.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Path + @"\Temp\Reporte.pdf");
                crystalReportViewer1.ReportSource = rp;
                crystalReportViewer1.Show();
            }
        }
Example #15
0
        public frmTramasSusalud()
        {
            InitializeComponent();
            OperationResult objOperationResult = new OperationResult();
            PacientBL       _PacientBL         = new PacientBL();

            using (new LoadingClass.PleaseWait(this.Location, "Data CIE10..."))
            {
                lista = _PacientBL.LlenarDxsTramas(ref objOperationResult);
            };
            using (new LoadingClass.PleaseWait(this.Location, "Data UPS..."))
            {
                listaUps = _PacientBL.LlenarListaUps(ref objOperationResult);
            };
            using (new LoadingClass.PleaseWait(this.Location, "Data Procedimientos..."))
            {
                listaproc = _PacientBL.LlenarListaProc(ref objOperationResult);
            };
        }
        private void LoadPerson()
        {
            PacientList     objpacientDto      = new PacientList();
            PacientBL       _objPacientBL      = new PacientBL();
            OperationResult objOperationResult = new OperationResult();

            objpacientDto                    = _objPacientBL.GetPacient(ref objOperationResult, _PersonId, null);
            NumberDocument                   = objpacientDto.v_DocNumber;
            txtName.Text                     = objpacientDto.v_FirstName;
            txtFirstLastName.Text            = objpacientDto.v_FirstLastName;
            txtSecondLastName.Text           = objpacientDto.v_SecondLastName;
            ddlDocTypeId.SelectedValue       = objpacientDto.i_DocTypeId.ToString();
            ddlSexTypeId.SelectedValue       = objpacientDto.i_SexTypeId.ToString();
            ddlMaritalStatusId.SelectedValue = objpacientDto.i_MaritalStatusId.ToString();
            ddlLevelOfId.SelectedValue       = objpacientDto.i_LevelOfId.ToString();
            txtDocNumber.Text                = objpacientDto.v_DocNumber;
            txtTelephoneNumber.Text          = objpacientDto.v_TelephoneNumber;
            txtMail.Text                     = objpacientDto.v_Mail;
        }
        public MessageCustom UpdateDataAdultoMayor(BoardGenerales data, int userId, int nodeId)
        {
            MessageCustom _MessageCustom = new MessageCustom();

            try
            {
                using (var ts = new TransactionScope())
                {
                    DatabaseContext ctx         = new DatabaseContext();
                    var             objPacient  = ctx.Person.Where(x => x.v_PersonId == data.DataAdultoMayorCustom.v_PersonId).FirstOrDefault();
                    int             Edad        = new PacientBL().GetEdad(objPacient.d_Birthdate.Value);
                    int             GrupoEtario = ObtenerIdGrupoEtarioDePaciente(Edad);
                    bool            resultado   = new EsoAntecedentesDal().GuardarAntecedenteAsistencial(data.EsoAntecedentesPadre, userId, data.DataAdultoMayorCustom.v_PersonId, GrupoEtario, nodeId);


                    var result = new EsoAntecedentesDal().UpdateDataAdultoMayor(data.DataAdultoMayorCustom, userId);
                    if (result == null)
                    {
                        throw new Exception("");
                    }
                    else
                    {
                        _MessageCustom.Error   = false;
                        _MessageCustom.Status  = (int)StatusHttp.Ok;
                        _MessageCustom.Id      = result;
                        _MessageCustom.Message = "Los datos se actualizaron correctamente.";
                    }



                    ts.Complete();
                }
                return(_MessageCustom);
            }
            catch (Exception ex)
            {
                _MessageCustom.Error   = true;
                _MessageCustom.Status  = (int)StatusHttp.BadRequest;
                _MessageCustom.Message = "Sucedió un error al actualizar, por favor vuelva a intentar.";
                return(_MessageCustom);
            }
        }
Example #18
0
        private void ShowReport()
        {
            OperationResult objOperationResult = new OperationResult();

            var rp = new Reports.crAlturaMayor();

            var     aptitudeCertificate = new PacientBL().GetAlturaEstructural(_serviceId, _ComponentId);
            DataSet ds1 = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(aptitudeCertificate);

            dt.TableName = "dtAlturaEstructural";

            ds1.Tables.Add(dt);

            rp.SetDataSource(ds1);

            crystalReportViewer1.ReportSource = rp;
            crystalReportViewer1.Show();
        }
        private DataSet GetReportAlturaFisica()
        {
            var servicesId8 = new List <string>();

            servicesId8.Add(_serviceId);
            var componentReportId8 = new ServiceBL().ObtenerIdsParaImportacionExcel(servicesId8, 11);
            var dataListForReport  = new PacientBL().GetAlturaEstructural(_serviceId, Constants.ALTURA_ESTRUCTURAL_ID, componentReportId8[0].ComponentId);

            //var dataListForReport = new PacientBL().GetAlturaEstructural(_serviceId, Constants.ALTURA_ESTRUCTURAL_ID);

            dsGetRepo = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dataListForReport);

            dt.TableName = "dtAlturaEstructural";

            dsGetRepo.Tables.Add(dt);

            return(dsGetRepo);
        }
        private void ShowReport()
        {
            OperationResult objOperationResult = new OperationResult();

            var rp = new Reports.InformePsicologicoOcupacional();

            var aptitudeCertificate = new PacientBL().GetFichaPsicologicaOcupacional(_serviceId);

            DataSet ds1 = new DataSet();

            DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(aptitudeCertificate);

            dt.TableName = "InformePsico";

            ds1.Tables.Add(dt);

            rp.SetDataSource(ds1);

            crystalReportViewer1.ReportSource = rp;
            crystalReportViewer1.Show();
        }
Example #21
0
        private void bgwSendEmail(string PersonId, string Nombre, string ApePaterno, string ApeMaterno, string Pass, string Email)
        {
            OperationResult objOperationResult = new OperationResult();

            try
            {
                //Obtener el nuevo Pass
                string decimalNumber = Pass;
                int    number        = int.Parse(decimalNumber);
                string hex           = number.ToString("x");
                string NuevoPAss     = hex.ToString();

                //Actualizar nuevo Pass

                PacientBL oPacientBL = new PacientBL();
                oPacientBL.ActualizarContraseniaPaciente(ref objOperationResult, PersonId, NuevoPAss);


                // Obtener los Parametros necesarios para el envio de notificación
                var configEmail = _objSystemParameterBL.GetSystemParameterForComboOrder(ref objOperationResult, 161, "i_ParameterId");

                string smtp         = configEmail[0].Value1.ToLower();
                int    port         = int.Parse(configEmail[1].Value1);
                string from         = configEmail[2].Value1.ToLower();
                string fromPassword = configEmail[4].Value1;
                string subject      = configEmail[6].Value1;
                bool   enableSsl    = Convert.ToBoolean(int.Parse(configEmail[3].Value1));
                string personName   = string.Format("{0} {1} {2}", Nombre, ApePaterno, ApeMaterno);
                string message      = string.Format(configEmail[5].Value1, personName, email.Value.Trim(), NuevoPAss);

                // Enviar notificación de usuario y clave via email
                Sigesoft.Common.Utils.SendMessage(smtp, port, enableSsl, true, from, fromPassword, Email, "", subject, message, null);
            }
            catch (Exception ex)
            {}
        }
Example #22
0
        private void grdDataCalendar_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            btnConsentimiento.Enabled = btnExportExcel.Enabled = btnExportPdf.Enabled = (grdDataCalendar.Selected.Rows.Count > 0);
            btnSendEmail.Enabled      = (grdDataCalendar.Selected.Rows.Count > 0 && _sendEmailEnabled);


            if (grdDataCalendar.Selected.Rows.Count != 0)
            {
                OperationResult             objOperationResult   = new OperationResult();
                ServiceBL                   objServiceBL         = new ServiceBL();
                PacientBL                   objPacientBL         = new PacientBL();
                personDto                   objpersonDto         = new personDto();
                List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
                //string strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();
                _strServicelId       = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();
                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                txtTrabajador.Text = grdDataCalendar.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
                _PacientId         = grdDataCalendar.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();

                _serviceId = grdDataCalendar.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();

                _calendarId = grdDataCalendar.Selected.Rows[0].Cells["v_CalendarId"].Value.ToString();

                if (grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value != null)
                {
                    WorkingOrganization.Text = grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
                }

                txtProtocol.Text = grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value == null ? "" : grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
                txtService.Text  = grdDataCalendar.Selected.Rows[0].Cells["v_ServiceName"].Value.ToString();

                if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value != null)
                {
                    if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString() == Constants.CONSULTAMEDICA)
                    {
                        txtTypeESO.Text = "";
                    }
                    else
                    {
                        txtTypeESO.Text = grdDataCalendar.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
                    }
                }

                objpersonDto = objPacientBL.GetPerson(ref objOperationResult, _PacientId);

                //Byte[] ooo = (byte[])grdDataCalendar.Selected.Rows[0].Cells["b_PersonImage"].Value;
                Byte[] ooo = objpersonDto.b_PersonImage;
                if (ooo == null)
                {
                    //pbImage.SizeMode = PictureBoxSizeMode.CenterImage;
                    pbImage.Image = Resources.nofoto;
                    _personImage  = null;
                }
                else
                {
                    //pbImage.SizeMode = PictureBoxSizeMode.Zoom;
                    pbImage.Image = Common.Utils.BytesArrayToImageOficce(ooo, pbImage);
                    _personImage  = ooo;
                }

                // Huella y Firma
                if (objpersonDto.b_FingerPrintImage == null)
                {
                    txtExisteHuella.Text      = "NO REGISTRADO";
                    txtExisteHuella.ForeColor = Color.Red;
                }
                else
                {
                    txtExisteHuella.Text      = "REGISTRADO";
                    txtExisteHuella.ForeColor = Color.DarkBlue;
                }

                // Firma
                if (objpersonDto.b_RubricImage == null)
                {
                    txtExisteFirma.Text      = "NO REGISTRADO";
                    txtExisteFirma.ForeColor = Color.Red;
                }
                else
                {
                    txtExisteFirma.Text      = "REGISTRADO";
                    txtExisteFirma.ForeColor = Color.DarkBlue;
                }
            }

            btnImprimirHojaRuta.Enabled = (grdDataServiceComponent.Rows.Count > 0);
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            //if (_auxiliaryExams == null)
            //    _auxiliaryExams = new List<ServiceComponentList>();
            try
            {
                var    ruta       = Common.Utils.GetApplicationConfigValue("rutaExamenesAdicionales").ToString();
                var    rutaBasura = Common.Utils.GetApplicationConfigValue("rutaReportesBasura").ToString();
                string pathFile   = "";
                string CMP        = "";
                var    openFile   = false;
                using (new LoadingClass.PleaseWait(this.Location, "Cargando..."))
                {
                    OperationResult             objOperationResult = new OperationResult();
                    List <AdditionalExamCustom> ListAdditionalExam = new List <AdditionalExamCustom>();

                    foreach (ListViewItem item in lvExamenesSeleccionados.Items)
                    {
                        AdditionalExamCustom _additionalExam = new AdditionalExamCustom();
                        var fields = item.SubItems;
                        _additionalExam.ComponentId  = fields[1].Text;
                        _additionalExam.IsProcessed  = int.Parse(fields[2].Text);
                        _additionalExam.IsNewService = int.Parse(fields[3].Text);
                        _additionalExam.Commentary   = txtCommentary.Text;
                        _additionalExam.ServiceId    = _serviceId;
                        _additionalExam.PersonId     = _personId;
                        _additionalExam.ProtocolId   = "";
                        if (_additionalExam.IsNewService == 1)
                        {
                            _additionalExam.ProtocolId = Constants.Prot_Hospi_Adic;
                        }
                        ListAdditionalExam.Add(_additionalExam);
                    }


                    var datosGrabo = objServiceBL.DevolverDatosUsuarioFirma(Globals.ClientSession.i_SystemUserId);


                    if (datosGrabo != null)
                    {
                        if (datosGrabo.CMP != null)
                        {
                            CMP      = datosGrabo.CMP;
                            pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + datosGrabo.CMP));
                        }
                    }

                    using (var ts = new TransactionScope())
                    {
                        var success = _additionalExamBl.AddAdditionalExam(ListAdditionalExam, Globals.ClientSession.GetAsList());
                        if (!success)
                        {
                            throw new Exception("Sucedió un error, por favor vuelva a intentarlo");
                        }

                        ts.Complete();
                    }
                    List <Categoria> AdditionalExam = new List <Categoria>();
                    List <Categoria> DataSource     = new List <Categoria>();
                    List <string>    ComponentList  = new List <string>();
                    var ListadditExam = new AdditionalExamBL().GetAdditionalExamByServiceId_all(_serviceId, Globals.ClientSession.i_SystemUserId);

                    foreach (var componenyId in ListadditExam)
                    {
                        ComponentList.Add(componenyId.ComponentId);
                    }

                    foreach (var componentId in ComponentList)
                    {
                        var ListServiceComponent = new ServiceBL().GetAllComponents(ref objOperationResult, (int)TipoBusqueda.ComponentId, componentId);

                        Categoria categoria = DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId);
                        if (categoria != null)
                        {
                            List <ComponentDetailList> componentDetail = new List <ComponentDetailList>();
                            componentDetail = ListServiceComponent[0].Componentes;
                            DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId).Componentes.AddRange(componentDetail);
                        }
                        else
                        {
                            DataSource.AddRange(ListServiceComponent);
                        }
                    }


                    var MedicalCenter = objServiceBL.GetInfoMedicalCenter();
                    var DatosPaciente = new PacientBL().DevolverDatosPaciente(_serviceId);

                    new PrintAdditionalExam().GenerateAdditionalexam(pathFile, MedicalCenter, DatosPaciente, datosGrabo, txtCommentary.Text, DataSource, ListadditExam);
                }

                List <string> pdfList = new List <string>();
                pdfList.Add(pathFile);
                _mergeExPDF.FilesName       = pdfList;
                _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP));
                _mergeExPDF.Execute();
                _mergeExPDF.RunFile();

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR:" + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        public List <EsoCuidadosPreventivosFechas> ObtenerFechasCuidadosPreventivos(string PersonId)
        {
            try
            {
                DatabaseContext ctx          = new DatabaseContext();
                var             objPacient   = ctx.Person.Where(x => x.v_PersonId == PersonId).FirstOrDefault();
                int             Edad         = new PacientBL().GetEdad(objPacient.d_Birthdate.Value);
                int             _GrupoEtario = ObtenerIdGrupoEtarioDePaciente(Edad);
                int             GrupoBase    = 0;
                switch (_GrupoEtario)
                {
                case (int)GrupoEtario.Ninio:
                {
                    GrupoBase = 292;
                    break;
                }

                case (int)GrupoEtario.Adolecente:
                {
                    GrupoBase = 285;
                    break;
                }

                case (int)GrupoEtario.Adulto:
                {
                    if (objPacient.i_SexTypeId == 1)
                    {
                        GrupoBase = 284;
                        break;
                    }
                    else
                    {
                        GrupoBase = 283;
                        break;
                    }
                }

                case (int)GrupoEtario.AdultoMayor:
                {
                    GrupoBase = 286;
                    break;
                }

                default:
                {
                    GrupoBase = 0;
                    break;
                }
                }
                var data        = new EsoAntecedentesDal().ObtenerFechasCuidadosPreventivos(PersonId);
                var Comentarios = new EsoAntecedentesDal().ObtenerComentariosCuidadosPreventivos(PersonId);
                foreach (var F in data)
                {
                    F.Listado = new EsoAntecedentesDal().ObtenerListadoCuidadosPreventivos(GrupoBase, PersonId, F.FechaServicio);

                    foreach (var obj in F.Listado)
                    {
                        var newGrupo = obj.GrupoId.ToString() + obj.ParameterId.ToString();
                        int Group    = int.Parse(newGrupo);
                        var find     = Comentarios.Find(x => x.GrupoId == Group && x.ParametroId == obj.ParameterId);
                        if (find != null)
                        {
                            obj.DataComentario = find;
                        }
                    }
                }



                return(data);
            }
            catch (Exception e)
            {
                return(new List <EsoCuidadosPreventivosFechas>());
            }
        }
Example #25
0
        private void grdDataCalendar_MouseDown(object sender, MouseEventArgs e)
        {
            Point point = new System.Drawing.Point(e.X, e.Y);

            Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point);


            if (uiElement == null || uiElement.Parent == null)
            {
                return;
            }

            Infragistics.Win.UltraWinGrid.UltraGridRow row = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow));
            if (e.Button == MouseButtons.Right)
            {
                if (row != null)
                {
                    _RowIndexgrdDataCalendar = row.Index;
                    grdDataCalendar.Rows[row.Index].Selected = true;
                    int CalendarStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_CalendarStatusId"].Value.ToString());
                    int LineStatusId     = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_LineStatusId"].Value.ToString());
                    int ServiceStatusId  = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_ServiceStatusId"].Value.ToString());
                    _PacientId = grdDataCalendar.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();

                    if (CalendarStatusId == (int)Common.CalendarStatus.Agendado)
                    {
                        contextMenuStrip1.Items["mnuCancelCalendar"].Enabled   = true;
                        contextMenuStrip1.Items["mnuFinCircuito"].Enabled      = false;
                        contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = true;
                        contextMenuStrip1.Items["mnuReagendarCita"].Enabled    = true;
                    }
                    else if (CalendarStatusId == (int)Common.CalendarStatus.Atendido)
                    {
                        contextMenuStrip1.Items["mnuCancelCalendar"].Enabled   = false;
                        contextMenuStrip1.Items["mnuFinCircuito"].Enabled      = true;
                        contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false;
                        contextMenuStrip1.Items["mnuReagendarCita"].Enabled    = false;
                    }
                    else if (CalendarStatusId == (int)Common.CalendarStatus.Cancelado)
                    {
                        contextMenuStrip1.Items["mnuCancelCalendar"].Enabled   = false;
                        contextMenuStrip1.Items["mnuFinCircuito"].Enabled      = false;
                        contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false;
                        contextMenuStrip1.Items["mnuReagendarCita"].Enabled    = true;
                    }

                    if (LineStatusId == (int)Common.LineStatus.FueraCircuito && CalendarStatusId == (int)Common.CalendarStatus.Atendido)
                    {
                        contextMenuStrip1.Items["mnuCancelCalendar"].Enabled   = false;
                        contextMenuStrip1.Items["mnuFinCircuito"].Enabled      = false;
                        contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false;
                        contextMenuStrip1.Items["mnuReagendarCita"].Enabled    = false;
                    }

                    OperationResult             objOperationResult   = new OperationResult();
                    ServiceBL                   objServiceBL         = new ServiceBL();
                    List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
                    _strServicelId       = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();
                    ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId);
                    grdDataServiceComponent.DataSource = ListServiceComponent;
                }
                else
                {
                    contextMenuStrip1.Items["mnuCancelCalendar"].Enabled   = false;
                    contextMenuStrip1.Items["mnuFinCircuito"].Enabled      = false;
                    contextMenuStrip1.Items["mnuComenzarCircuito"].Enabled = false;
                    contextMenuStrip1.Items["mnuReagendarCita"].Enabled    = false;
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                if (row != null)
                {
                    OperationResult             objOperationResult   = new OperationResult();
                    ServiceBL                   objServiceBL         = new ServiceBL();
                    List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
                    PacientBL                   objPacientBL         = new PacientBL();
                    personDto                   objpersonDto         = new personDto();
                    _PacientId = grdDataCalendar.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();
                    //string strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();
                    _strServicelId       = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();
                    ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId);
                    grdDataServiceComponent.DataSource = ListServiceComponent;

                    txtTrabajador.Text = grdDataCalendar.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();

                    if (grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value != null)
                    {
                        WorkingOrganization.Text = grdDataCalendar.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
                    }

                    txtProtocol.Text = grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value == null ? "" : grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
                    txtService.Text  = grdDataCalendar.Selected.Rows[0].Cells["v_ServiceName"].Value.ToString();

                    if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value != null)
                    {
                        if (grdDataCalendar.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString() == Constants.CONSULTAMEDICA)
                        {
                            txtTypeESO.Text = "";
                        }
                        else
                        {
                            txtTypeESO.Text = grdDataCalendar.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
                        }
                    }

                    _personName = grdDataCalendar.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();

                    objpersonDto = objPacientBL.GetPerson(ref objOperationResult, _PacientId);

                    Byte[] ooo = objpersonDto.b_PersonImage;

                    if (ooo == null)
                    {
                        pbImage.Image = Resources.nofoto;
                    }
                    else
                    {
                        pbImage.Image = Common.Utils.BytesArrayToImageOficce(ooo, pbImage);
                        _personImage  = ooo;
                    }

                    // Huella y Firma
                    if (objpersonDto.b_FingerPrintImage == null)
                    {
                        txtExisteHuella.Text      = "NO REGISTRADO";
                        txtExisteHuella.ForeColor = Color.Red;
                    }
                    else
                    {
                        txtExisteHuella.Text      = "REGISTRADO";
                        txtExisteHuella.ForeColor = Color.DarkBlue;
                    }

                    // Firma
                    if (objpersonDto.b_RubricImage == null)
                    {
                        txtExisteFirma.Text      = "NO REGISTRADO";
                        txtExisteFirma.ForeColor = Color.Red;
                    }
                    else
                    {
                        txtExisteFirma.Text      = "REGISTRADO";
                        txtExisteFirma.ForeColor = Color.DarkBlue;
                    }
                }
            }
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportDocument  rp = new ReportDocument();
            OperationResult objOperationResult = new OperationResult();
            List <string>   _filesNameToMerge  = new List <string>();
            string          ServiceId          = null;

            //setear dato de aptitud
            if (Request.QueryString["v_ServiceId"] != null)
            {
                ServiceId = Request.QueryString["v_ServiceId"].ToString();
            }


            if (Session["ConsultorioId"] == null)
            {
                _tempSourcePath = Path.Combine(Server.MapPath("/TempMerge"));
                List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"];

                foreach (var item in ListaServicios)
                {
                    var aptitudeCertificate = new ServiceBL().GetAptitudeCertificate(ref objOperationResult, item.IdServicio).ToList();

                    DataSet   ds = new DataSet();
                    DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(aptitudeCertificate);
                    dt.TableName = "AptitudeCertificate";
                    ds.Tables.Add(dt);

                    if (aptitudeCertificate[0].i_NumberQuotasMen == (int)EmpresaDx.ConDx)
                    {
                        if (aptitudeCertificate[0].i_EsoTypeId == ((int)TypeESO.Retiro).ToString())
                        {
                            rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificateRetiros.rpt"));
                        }
                        else
                        {
                            if (aptitudeCertificate[0].i_AptitudeStatusId == (int)AptitudeStatus.AptoObs)
                            {
                                rp.Load(Server.MapPath("cr.CertficadoObservado.rpt"));
                            }
                            else
                            {
                                rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt"));
                            }
                        }
                    }
                    else
                    {
                        if (aptitudeCertificate[0].i_EsoTypeId == ((int)TypeESO.Retiro).ToString())
                        {
                            rp.Load(Server.MapPath("crOccupationalRetirosSinDx.rpt"));
                        }
                        else
                        {
                            if (aptitudeCertificate[0].i_AptitudeStatusId == (int)AptitudeStatus.AptoObs)
                            {
                                rp.Load(Server.MapPath("cr.CertficadoObservadoSinDx.rpt"));
                            }
                            else
                            {
                                rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificateSinDx.rpt"));
                            }
                        }
                    }



                    //rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt"));
                    rp.SetDataSource(ds);

                    rp.SetDataSource(ds);
                    var ruta = Server.MapPath("files/CM" + item.IdServicio.ToString() + ".pdf");


                    _filesNameToMerge.Add(ruta);

                    rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta);
                }
                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }



            else if (Session["ConsultorioId"].ToString() == "6")  // RX
            {
                var RX_TORAX_ID = new ServiceBL().ReportRadiologico(ServiceId, Constants.RX_TORAX_ID);

                DataSet   ds = new DataSet();
                DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(RX_TORAX_ID);
                dt.TableName = "dtRadiologico";
                ds.Tables.Add(dt);

                rp.Load(Server.MapPath("crInformeRadiologico.rpt"));

                rp.SetDataSource(ds);

                rp.SetDataSource(ds);
                var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf");


                _filesNameToMerge.Add(ruta);


                var OIT_ID = new ServiceBL().ReportInformeRadiografico(ServiceId, Constants.OIT_ID);
                if (OIT_ID.Count != 0)
                {
                    DataSet   dsOIT_ID = new DataSet();
                    DataTable dtOIT_ID = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(OIT_ID);
                    dtOIT_ID.TableName = "dtInformeRadiografico";
                    dsOIT_ID.Tables.Add(dt);

                    rp.Load(Server.MapPath("crInformeRadiograficoOIT.rpt"));

                    rp.SetDataSource(ds);

                    rp.SetDataSource(ds);
                    var ruta1 = Server.MapPath("files/CM" + ServiceId + ".pdf");


                    _filesNameToMerge.Add(ruta1);
                }

                rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta);


                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }
            else if (Session["ConsultorioId"].ToString() == "5") // CARDIO
            {
                var ELECTROCARDIOGRAMA_ID = new ServiceBL().GetReportEstudioElectrocardiografico(ServiceId, Constants.ELECTROCARDIOGRAMA_ID);

                DataSet   ds = new DataSet();
                DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(ELECTROCARDIOGRAMA_ID);
                dt.TableName = "dtEstudioElectrocardiografico";
                ds.Tables.Add(dt);

                rp.Load(Server.MapPath("crEstudioElectrocardiografico.rpt"));

                rp.SetDataSource(ds);

                rp.SetDataSource(ds);
                var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf");


                _filesNameToMerge.Add(ruta);

                rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta);


                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }
            else if (Session["ConsultorioId"].ToString() == "15") // AUDIO
            {
                DataSet dsAudiometria = new DataSet();
                var     dxList        = new ServiceBL().GetDiagnosticRepositoryByComponent(ServiceId, Constants.AUDIOMETRIA_ID);
                if (dxList.Count == 0)
                {
                    DiagnosticRepositoryList        oDiagnosticRepositoryList = new DiagnosticRepositoryList();
                    List <DiagnosticRepositoryList> Lista = new List <DiagnosticRepositoryList>();
                    oDiagnosticRepositoryList.v_ServiceId              = "Sin Id";
                    oDiagnosticRepositoryList.v_DiseasesName           = "Sin Alteración";
                    oDiagnosticRepositoryList.v_DiagnosticRepositoryId = "Sin Id";
                    Lista.Add(oDiagnosticRepositoryList);
                    var dtDx = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Lista);
                    dtDx.TableName = "dtDiagnostic";
                    dsAudiometria.Tables.Add(dtDx);
                }
                else
                {
                    var dtDx = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dxList);
                    dtDx.TableName = "dtDiagnostic";
                    dsAudiometria.Tables.Add(dtDx);
                }


                var recom = dxList.SelectMany(s1 => s1.Recomendations).ToList();
                if (recom.Count == 0)
                {
                    Sigesoft.Node.WinClient.BE.RecomendationList        oRecomendationList = new Sigesoft.Node.WinClient.BE.RecomendationList();
                    List <Sigesoft.Node.WinClient.BE.RecomendationList> Lista = new List <Sigesoft.Node.WinClient.BE.RecomendationList>();

                    oRecomendationList.v_ServiceId              = "Sin Id";
                    oRecomendationList.v_RecommendationName     = "Sin Recomendaciones";
                    oRecomendationList.v_DiagnosticRepositoryId = "Sin Id";
                    Lista.Add(oRecomendationList);
                    var dtReco = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Lista);
                    dtReco.TableName = "dtRecomendation";
                    dsAudiometria.Tables.Add(dtReco);
                }
                else
                {
                    var dtReco = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(recom);
                    dtReco.TableName = "dtRecomendation";
                    dsAudiometria.Tables.Add(dtReco);
                }

                var audioUserControlList     = new ServiceBL().ReportAudiometriaUserControl(ServiceId, Constants.AUDIOMETRIA_ID);
                var audioCabeceraList        = new ServiceBL().ReportAudiometria(ServiceId, Constants.AUDIOMETRIA_ID);
                var dtAudiometriaUserControl = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioUserControlList);
                var dtCabecera = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioCabeceraList);


                dtCabecera.TableName = "dtAudiometria";
                dtAudiometriaUserControl.TableName = "dtAudiometriaUserControl";

                dsAudiometria.Tables.Add(dtCabecera);
                dsAudiometria.Tables.Add(dtAudiometriaUserControl);

                rp.Load(Server.MapPath("crFichaAudiometria.rpt"));

                rp.SetDataSource(dsAudiometria);


                var ruta = Server.MapPath("files/AU" + ServiceId + ".pdf");

                _filesNameToMerge.Add(ruta);

                rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta);



                //HISTORIA OCUPACIONAL AUDIOMETRÍA

                var dataListForReport_1 = new ServiceBL().ReportHistoriaOcupacionalAudiometria(ServiceId);

                DataSet   ds = new DataSet();
                DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(dataListForReport_1);
                dt.TableName = "dtHistoriaOcupacional";
                ds.Tables.Add(dt);

                rp.Load(Server.MapPath("crHistoriaOcupacionalAudiometria.rpt"));

                rp.SetDataSource(ds);

                rp.SetDataSource(ds);
                var ruta1 = Server.MapPath("files/CM" + ServiceId + ".pdf");


                _filesNameToMerge.Add(ruta1);

                rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta1);


                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }

            else if (Session["ConsultorioId"].ToString() == "1") // LAB
            {
                var ruta = Server.MapPath("files/INFLAB" + ServiceId + ".pdf");

                GenerateLaboratorioReport(ruta, ServiceId);
                _filesNameToMerge.Add(ruta);

                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }
            else if (Session["ConsultorioId"].ToString() == "14") // OFTALMO
            {
                var OFTALMOLOGIA_ID = new PacientBL().GetOftalmologia(ServiceId, Constants.OFTALMOLOGIA_ID);

                DataSet   ds = new DataSet();
                DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(OFTALMOLOGIA_ID);
                dt.TableName = "dtOftalmologia";
                ds.Tables.Add(dt);

                rp.Load(Server.MapPath("crOftalmologia.rpt"));

                rp.SetDataSource(ds);

                rp.SetDataSource(ds);
                var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf");

                _filesNameToMerge.Add(ruta);

                rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta);

                _mergeExPDF.FilesName = _filesNameToMerge;
                string Dif     = Guid.NewGuid().ToString();
                string NewPath = Server.MapPath("files/" + Dif + ".pdf");
                _mergeExPDF.DestinationFile = NewPath;
                _mergeExPDF.Execute();
                ShowPdf1.FilePath = "files/" + Dif + ".pdf";
            }
        }
Example #27
0
        protected void btnSubir_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            CalendarBL      objCalendarBL      = new CalendarBL();
            calendarDto     objCalendarDto     = new calendarDto();
            PacientBL       objPacientBL       = new PacientBL();
            pacientDto      objPacientDto      = new pacientDto();
            PacientList     PacientList        = new PacientList();

            if (dpFechaInicio.SelectedDate.Value < DateTime.Now.Date)
            {
                Alert.ShowInTop("No se permite agendar con una fecha anterior a la actual.", "Error de validación");
                return;
            }

            string CalendarId;
            string PacientId = "";

            StringBuilder sbDatos = new StringBuilder();

            var ListaGrilla = (List <Sigesoft.Node.WinClient.BE.PacientList>)Session["_TempPacientList"];

            foreach (var item in ListaGrilla)
            {
                personDto objPersonDto = new personDto();
                //Validar si el trabajador existe
                objPersonDto = objPacientBL.GetPersonByNroDocument(ref objOperationResult, item.v_DocNumber);
                if (objPersonDto != null)
                {
                    objPersonDto.v_FirstName       = item.v_FirstName.Trim();
                    objPersonDto.v_FirstLastName   = item.v_FirstLastName.Trim();
                    objPersonDto.v_SecondLastName  = item.v_SecondLastName.Trim();
                    objPersonDto.i_DocTypeId       = item.i_DocTypeId;
                    objPersonDto.v_DocNumber       = item.v_DocNumber;
                    objPersonDto.i_SexTypeId       = item.i_SexTypeId;
                    objPersonDto.d_Birthdate       = item.d_Birthdate;
                    objPersonDto.i_LevelOfId       = -1;
                    objPersonDto.i_MaritalStatusId = -1;

                    objPersonDto.i_BloodGroupId           = -1;
                    objPersonDto.i_BloodFactorId          = -1;
                    objPersonDto.i_DepartmentId           = -1;
                    objPersonDto.i_ProvinceId             = -1;
                    objPersonDto.i_DistrictId             = -1;
                    objPersonDto.i_ResidenceInWorkplaceId = -1;
                    objPersonDto.i_TypeOfInsuranceId      = -1;
                    objPersonDto.i_OccupationTypeId       = -1;
                    objPersonDto.i_AltitudeWorkId         = -1;
                    objPersonDto.i_PlaceWorkId            = -1;
                    objPersonDto.i_Relationship           = -1;

                    objPersonDto.v_CurrentOccupation = item.v_CurrentOccupation;
                    objPacientBL.UpdatePacient(ref objOperationResult, objPersonDto, ((ClientSession)Session["objClientSession"]).GetAsList(), objPersonDto.v_DocNumber, objPersonDto.v_DocNumber);
                    PacientId = objPersonDto.v_PersonId;
                }
                else
                {
                    objPersonDto                          = new personDto();
                    objPersonDto.v_FirstName              = item.v_FirstName.Trim();
                    objPersonDto.v_FirstLastName          = item.v_FirstLastName.Trim();
                    objPersonDto.v_SecondLastName         = item.v_SecondLastName.Trim();
                    objPersonDto.i_DocTypeId              = item.i_DocTypeId;
                    objPersonDto.v_DocNumber              = item.v_DocNumber;
                    objPersonDto.i_SexTypeId              = item.i_SexTypeId;
                    objPersonDto.d_Birthdate              = item.d_Birthdate;
                    objPersonDto.i_LevelOfId              = -1;
                    objPersonDto.i_MaritalStatusId        = -1;
                    objPersonDto.i_BloodGroupId           = -1;
                    objPersonDto.i_BloodFactorId          = -1;
                    objPersonDto.i_DepartmentId           = -1;
                    objPersonDto.i_ProvinceId             = -1;
                    objPersonDto.i_DistrictId             = -1;
                    objPersonDto.i_ResidenceInWorkplaceId = -1;
                    objPersonDto.i_TypeOfInsuranceId      = -1;
                    objPersonDto.i_OccupationTypeId       = -1;
                    objPersonDto.i_AltitudeWorkId         = -1;
                    objPersonDto.i_PlaceWorkId            = -1;
                    objPersonDto.i_Relationship           = -1;
                    objPersonDto.v_Deducible              = 0;
                    //objPersonDto.v_Password = item.v_DocNumber;
                    objPersonDto.v_CurrentOccupation = item.v_CurrentOccupation;

                    PacientId = objPacientBL.AddPacient(ref objOperationResult, objPersonDto, ((ClientSession)Session["objClientSession"]).GetAsList());
                }

                var Verificar = objPacientBL.GetBlackList(ref objOperationResult, objPersonDto.v_PersonId);


                if (PacientId != null && Verificar == null)      // Se grabo el paciente y se lo agenda
                {
                    objCalendarDto.v_PersonId         = PacientId;
                    objCalendarDto.d_DateTimeCalendar = dpFechaInicio.SelectedDate.Value;
                    objCalendarDto.i_ServiceTypeId    = (int)ServiceType.Empresarial;
                    objCalendarDto.i_CalendarStatusId = (int)CalendarStatus.Agendado;
                    objCalendarDto.i_ServiceId        = (int)MasterService.Eso;
                    //objCalendarDto.v_ProtocolId = _ProtocolId;
                    //Obtener Id de Protocolo por medio del código del protocolo
                    var ProtocolId = oProtocolBL.ObtenerProtocoloIdPorCodigoProtocolo(ddlProtocoloId.SelectedText);
                    if (ProtocolId == null)
                    {
                        Alert.ShowInTop("El protocolo no existe en el sistema.", "ERRROR!");
                        return;
                    }
                    objCalendarDto.v_ProtocolId        = ProtocolId;
                    objCalendarDto.i_NewContinuationId = (int)modality.NuevoServicio;
                    objCalendarDto.i_LineStatusId      = (int)LineStatus.FueraCircuito;
                    objCalendarDto.i_IsVipId           = (int)SiNo.NO;

                    CalendarId = objPacientBL.AddShedule(ref objOperationResult, objCalendarDto, ((ClientSession)Session["objClientSession"]).GetAsList(), ProtocolId, PacientId, (int)MasterService.Eso, "Nuevo");
                }
                else      // no se grabro el paciente
                {
                    sbDatos.Append("PACIENTE :  ");
                    sbDatos.Append(objPersonDto.v_FirstName + " " + objPersonDto.v_FirstLastName + " " + objPersonDto.v_SecondLastName);
                    sbDatos.Append("  DOCUMENTO :  ");
                    sbDatos.Append(objPersonDto.v_DocNumber);
                    sbDatos.Append("\n");
                }
            }

            //iniciar circuitos


            if (objOperationResult.Success == 1)      // Operación sin error
            {
                Alert.Show("Se agendó correctamente.");
            }
            else    // Operación con error
            {
                Alert.ShowInTop("Error al agendar, por favor comuníquese con su proveedor", "ERROR!");
            }
        }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                var MedicalCenter = new ServiceBL().GetInfoMedicalCenter();

                List <string> Filters       = new List <string>();
                DateTime?     pdatBeginDate = dtpDateTimeStar.Value.Date;
                DateTime?     pdatEndDate   = dptDateTimeEnd.Value.Date.AddDays(1);

                if (ddlCustomerOrganization.SelectedValue.ToString() != "-1")
                {
                    var id3 = ddlCustomerOrganization.SelectedValue.ToString().Split('|');
                    Filters.Add("v_CustomerOrganizationId==" + "\"" + id3[0] + "\"&&v_CustomerLocationId==" + "\"" + id3[1] + "\"");
                }

                if (ddlEmployerOrganization.SelectedValue.ToString() != "-1")
                {
                    var id3 = ddlEmployerOrganization.SelectedValue.ToString().Split('|');
                    Filters.Add("v_EmployerOrganizationId==" + "\"" + id3[0] + "\"&&v_EmployerLocationId==" + "\"" + id3[1] + "\"");
                }

                if (ddlWorkingOrganization.SelectedValue.ToString() != "-1")
                {
                    var id3 = ddlWorkingOrganization.SelectedValue.ToString().Split('|');
                    Filters.Add("v_WorkingOrganizationId==" + "\"" + id3[0] + "\"&&v_WorkingLocationId==" + "\"" + id3[1] + "\"");
                }

                if (ddlProtocolId.SelectedValue.ToString() != "-1")
                {
                    Filters.Add("ProtocolId==" + "\"" + ddlProtocolId.SelectedValue + "\"");
                }

                // Create the Filter Expression
                strFilterExpression = null;
                if (Filters.Count > 0)
                {
                    foreach (string item in Filters)
                    {
                        strFilterExpression = strFilterExpression + item + " && ";
                    }
                    strFilterExpression = strFilterExpression.Substring(0, strFilterExpression.Length - 4);
                }

                if (tabControl1.SelectedTab.Name == "tpShauindo")
                {
                    var objData = new PacientBL().ReporteMatrizShauindo(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdShauindo.DataSource    = objData;
                    lblRecordCount.Text       = string.Format("Se encontraron {0} registros.", objData.Count());
                    btnExportShauindo.Enabled = true;
                }
                else if (tabControl1.SelectedTab.Name == "tpLaZanja")
                {
                    var objData = new PacientBL().ReporteMatrizLaZanja(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdLaZanja.DataSource    = objData;
                    lblRecordCount.Text      = string.Format("Se encontraron {0} registros.", objData.Count());
                    btnExportLaZanja.Enabled = true;
                }
                else if (tabControl1.SelectedTab.Name == "tpGoldFields")
                {
                    var objData = new PacientBL().ReporteMatrizGoldFields(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdGolFields.DataSource    = objData;
                    lblRecordCount.Text        = string.Format("Se encontraron {0} registros.", objData.Count());
                    btnExportGolFields.Enabled = true;
                }
                else if (tabControl1.SelectedTab.Name == "tpSolucManteIntegra")
                {
                    var objData = new PacientBL().ReporteMatrizSolucManteIntegra(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdSoluc.DataSource    = objData;
                    lblRecordCount.Text    = string.Format("Se encontraron {0} registros.", objData.Count());
                    btnExportSoluc.Enabled = true;
                }
                else if (tabControl1.SelectedTab.Name == "tpMiBanco")
                {
                    var objData = new PacientBL().ReporteMatrizMiBanco(pdatBeginDate, pdatEndDate, ddlCustomerOrganization.SelectedValue.ToString(), strFilterExpression);
                    grdMiBanco.DataSource    = objData;
                    lblRecordCount.Text      = string.Format("Se encontraron {0} registros.", objData.Count());
                    btnExportMiBanco.Enabled = true;
                }
            }
        }
Example #29
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            if (grdDataAdditionalExam.Rows.Count == 0)
            {
                MessageBox.Show("No hay exámenes para imprimir", "VALIDACIÓN", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            var    ruta       = Common.Utils.GetApplicationConfigValue("rutaExamenesAdicionales").ToString();
            var    rutaBasura = Common.Utils.GetApplicationConfigValue("rutaReportesBasura").ToString();
            string pathFile   = "";
            string CMP        = "";
            var    openFile   = false;

            using (new LoadingClass.PleaseWait(this.Location, "Cargando..."))
            {
                OperationResult objOperationResult = new OperationResult();

                var datosGrabo = new ServiceBL().DevolverDatosUsuarioFirma(Globals.ClientSession.i_SystemUserId);
                CMP      = datosGrabo.CMP;
                pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + datosGrabo.CMP));


                List <Categoria> AdditionalExam = new List <Categoria>();
                List <Categoria> DataSource     = new List <Categoria>();
                List <string>    ComponentList  = new List <string>();
                var ListadditExam = new AdditionalExamBL().GetAdditionalExamByServiceId_all(_serviceId, Globals.ClientSession.i_SystemUserId);

                foreach (var componenyId in ListadditExam)
                {
                    ComponentList.Add(componenyId.ComponentId);
                }

                foreach (var componentId in ComponentList)
                {
                    var ListServiceComponent = new ServiceBL().GetAllComponents(ref objOperationResult, (int)TipoBusqueda.ComponentId, componentId);

                    Categoria categoria = DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId);
                    if (categoria != null)
                    {
                        List <ComponentDetailList> componentDetail = new List <ComponentDetailList>();
                        componentDetail = ListServiceComponent[0].Componentes;
                        DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId).Componentes.AddRange(componentDetail);
                    }
                    else
                    {
                        DataSource.AddRange(ListServiceComponent);
                    }
                }


                var MedicalCenter = new ServiceBL().GetInfoMedicalCenter();
                var DatosPaciente = new PacientBL().DevolverDatosPaciente(_serviceId);

                new PrintAdditionalExam().GenerateAdditionalexam(pathFile, MedicalCenter, DatosPaciente, datosGrabo, txtComentario.Text, DataSource, ListadditExam);
            }

            List <string> pdfList = new List <string>();

            pdfList.Add(pathFile);
            _mergeExPDF.FilesName       = pdfList;
            _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP));
            _mergeExPDF.Execute();
            _mergeExPDF.RunFile();
        }
        private void btnschedule_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            CalendarBL      objCalendarBL      = new CalendarBL();
            calendarDto     objCalendarDto     = new calendarDto();
            PacientBL       objPacientBL       = new PacientBL();
            pacientDto      objPacientDto      = new pacientDto();
            PacientList     PacientList        = new PacientList();
            BlackListBL     objBlackListBL     = new BlackListBL();

            if (dtpDateTimeCalendar.Value < DateTime.Now.Date)
            {
                MessageBox.Show("No se permite agendar con una fecha anterior a la actual.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string CalendarId;
            string PacientId   = "";
            string ProtocoloId = "";

            StringBuilder sbDatos = new StringBuilder();

            if (uvschedule.Validate(true, false).IsValid)
            {
                foreach (var item in _TempPacientList)
                {
                    personDto objPersonDto = new personDto();
                    //Validar si el trabajador existe
                    objPersonDto = objPacientBL.GetPersonByNroDocument(ref objOperationResult, item.v_DocNumber);
                    if (objPersonDto != null)
                    {
                        objPersonDto.v_FirstName       = item.v_FirstName.Trim();
                        objPersonDto.v_FirstLastName   = item.v_FirstLastName.Trim();
                        objPersonDto.v_SecondLastName  = item.v_SecondLastName.Trim();
                        objPersonDto.i_DocTypeId       = item.i_DocTypeId;
                        objPersonDto.v_DocNumber       = item.v_DocNumber;
                        objPersonDto.i_SexTypeId       = item.i_SexTypeId;
                        objPersonDto.d_Birthdate       = item.d_Birthdate;
                        objPersonDto.i_LevelOfId       = -1;
                        objPersonDto.i_MaritalStatusId = -1;

                        objPersonDto.i_BloodGroupId           = -1;
                        objPersonDto.i_BloodFactorId          = -1;
                        objPersonDto.i_DepartmentId           = -1;
                        objPersonDto.i_ProvinceId             = -1;
                        objPersonDto.i_DistrictId             = -1;
                        objPersonDto.i_ResidenceInWorkplaceId = -1;
                        objPersonDto.i_TypeOfInsuranceId      = -1;
                        objPersonDto.i_OccupationTypeId       = -1;
                        objPersonDto.i_AltitudeWorkId         = -1;
                        objPersonDto.i_PlaceWorkId            = -1;
                        objPersonDto.i_Relationship           = -1;

                        objPersonDto.v_CurrentOccupation = item.v_CurrentOccupation;
                        objPacientBL.UpdatePacient(ref objOperationResult, objPersonDto, Globals.ClientSession.GetAsList(), objPersonDto.v_DocNumber, "");
                        PacientId = objPersonDto.v_PersonId;
                    }
                    else
                    {
                        objPersonDto                          = new personDto();
                        objPersonDto.v_FirstName              = item.v_FirstName.Trim();
                        objPersonDto.v_FirstLastName          = item.v_FirstLastName.Trim();
                        objPersonDto.v_SecondLastName         = item.v_SecondLastName.Trim();
                        objPersonDto.i_DocTypeId              = item.i_DocTypeId;
                        objPersonDto.v_DocNumber              = item.v_DocNumber;
                        objPersonDto.i_SexTypeId              = item.i_SexTypeId;
                        objPersonDto.d_Birthdate              = item.d_Birthdate;
                        objPersonDto.i_LevelOfId              = -1;
                        objPersonDto.i_MaritalStatusId        = -1;
                        objPersonDto.i_BloodGroupId           = -1;
                        objPersonDto.i_BloodFactorId          = -1;
                        objPersonDto.i_DepartmentId           = -1;
                        objPersonDto.i_ProvinceId             = -1;
                        objPersonDto.i_DistrictId             = -1;
                        objPersonDto.i_ResidenceInWorkplaceId = -1;
                        objPersonDto.i_TypeOfInsuranceId      = -1;
                        objPersonDto.i_OccupationTypeId       = -1;
                        objPersonDto.i_AltitudeWorkId         = -1;
                        objPersonDto.i_PlaceWorkId            = -1;
                        objPersonDto.i_Relationship           = -1;
                        objPersonDto.v_Password               = item.v_DocNumber;
                        objPersonDto.v_CurrentOccupation      = item.v_CurrentOccupation;

                        PacientId = objPacientBL.AddPacient(ref objOperationResult, objPersonDto, Globals.ClientSession.GetAsList());
                    }

                    var Verificar = objBlackListBL.GetBlackList(ref objOperationResult, objPersonDto.v_PersonId);


                    if (PacientId != null && Verificar == null)  // Se grabo el paciente y se lo agenda
                    {
                        objCalendarDto.v_PersonId         = PacientId;
                        objCalendarDto.d_DateTimeCalendar = dtpDateTimeCalendar.Value;
                        objCalendarDto.i_ServiceTypeId    = Int32.Parse(ddlServiceTypeId.SelectedValue.ToString());
                        objCalendarDto.i_CalendarStatusId = Int32.Parse(ddlCalendarStatusId.SelectedValue.ToString());
                        objCalendarDto.i_ServiceId        = Int32.Parse(ddlMasterServiceId.SelectedValue.ToString());
                        //objCalendarDto.v_ProtocolId = _ProtocolId;
                        objCalendarDto.v_ProtocolId        = item.v_ProtocoloId;
                        objCalendarDto.i_NewContinuationId = Int32.Parse(ddlNewContinuationId.SelectedValue.ToString());
                        objCalendarDto.i_LineStatusId      = Int32.Parse(ddlLineStatusId.SelectedValue.ToString());
                        objCalendarDto.i_IsVipId           = Int32.Parse(ddlVipId.SelectedValue.ToString());

                        CalendarId = objCalendarBL.AddShedule(ref objOperationResult, objCalendarDto, Globals.ClientSession.GetAsList(), item.v_ProtocoloId, PacientId, Int32.Parse(ddlMasterServiceId.SelectedValue.ToString()), "Nuevo", chkIsCampania.Checked ? 1 : 0);
                    }
                    else  // no se grabro el paciente
                    {
                        sbDatos.Append("PACIENTE :  ");
                        sbDatos.Append(objPersonDto.v_FirstName + " " + objPersonDto.v_FirstLastName + " " + objPersonDto.v_SecondLastName);
                        sbDatos.Append("  DOCUMENTO :  ");
                        sbDatos.Append(objPersonDto.v_DocNumber);
                        sbDatos.Append("\n");
                    }
                }
                if (objOperationResult.Success == 1)  // Operación sin error
                {
                    if (sbDatos.ToString() != "")
                    {
                        MessageBox.Show(sbDatos.ToString(), "Estos pacientes no fueron agendados", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                    }
                }
                else// Operación con error
                {
                    if (objOperationResult.ErrorMessage != null)
                    {
                        MessageBox.Show(objOperationResult.ErrorMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(sbDatos.ToString(), "Estos pacientes no fueron agendados", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        // Se queda en el formulario.
                    }
                }
            }
        }