Example #1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                OperationResult             objOperationResult   = new OperationResult();
                CalendarBL                  objCalendarBL        = new CalendarBL();
                List <CalendarList>         objCalendarList      = new List <CalendarList>();
                ServiceComponentList        objServiceComponent  = new ServiceComponentList();
                List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();

                objCalendarList             = objCalendarBL.GetPacientInLineByComponentId1(ref objOperationResult, 0, null, "d_ServiceDate ASC", _componentId, DateTime.Now.Date, _componentIds.ToArray());
                grdListaLlamando.DataSource = objCalendarList;

                lblNameComponent.Text = _componentName;

                //var dataList = BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 125, null).FindAll(p => p.Id != "1" && p.Id != "3");

                //Utils.LoadDropDownList(ddlServiceStatusId, "Value1", "Id", dataList, DropDownListAction.Select);

                grdDataServiceComponent.DataSource = ListServiceComponent;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Utils.ExceptionFormatter(ex), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnRemoverEsamen_Click(object sender, EventArgs e)
        {
            CalendarBL _objCalendarBL = new CalendarBL();

            if (grdData.Selected.Rows.Count == 0)
            {
                return;
            }

            ServiceBL    oServiceBL = new ServiceBL();
            DialogResult Result     = MessageBox.Show("¿Está seguro de eliminar este registro?", "ADVERTENCIA!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.OK)
            {
                var             _auxiliaryExams    = new List <ServiceComponentList>();
                OperationResult objOperationResult = new OperationResult();

                string v_ServiceComponentId = grdData.Selected.Rows[0].Cells["ServiceComponentId"].Value.ToString();
                string v_ServiceId          = grdData.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();


                ServiceComponentList auxiliaryExam = new ServiceComponentList();
                auxiliaryExam.v_ServiceComponentId = v_ServiceComponentId;
                _auxiliaryExams.Add(auxiliaryExam);

                _objCalendarBL.UpdateAdditionalExam(_auxiliaryExams, v_ServiceId, (int?)SiNo.NO, Globals.ClientSession.GetAsList());
                btnFilter_Click(sender, e);
            }
        }
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            CalendarBL      objCalendarBL      = new CalendarBL();
            OperationResult objOperationResult = new OperationResult();


            List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"];

            if (ListaServicios == null)
            {
                Alert.Show("Seleccione un registro");
                return;
            }
            else
            {
                foreach (var item in ListaServicios)
                {
                    objCalendarBL.Reschedule(ref objOperationResult, ((ClientSession)Session["objClientSession"]).GetAsList(), item.CalendarId, DateTime.Parse(dpFecha.SelectedDate.Value.ToString()), 1, item.ProtocolId, item.IdPaciente, 2);
                }

                //Analizar el resultado de la operación
                if (objOperationResult.Success == 1)  // Operación sin error
                {
                    // Cerrar página actual y hacer postback en el padre para actualizar
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else  // Operación con error
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                    // Se queda en el formulario.
                }
            }
        }
        public IHttpActionResult GetDataCalendar(MultiDataModel data)
        {
            var dataFilter = JsonConvert.DeserializeObject <BoardCalendar>(data.String1);
            var result     = new CalendarBL().GetDataCalendar(dataFilter);

            return(Ok(result));
        }
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            CalendarBL objCalendarBL = new CalendarBL();
            ServiceBL  oServiceBL    = new ServiceBL();

            if (_formulario == "service")
            {
                foreach (var item in _ListaServicios)
                {
                    oServiceBL.ActualizarFechaEntregaServicio(item.ToString(), dtpDateTimeStar.Value);
                }
            }
            else if (_formulario == "calendar")
            {
                //OperationResult objOperationResult = new OperationResult();
                //foreach (var item in _ListaServicios)
                //{
                //    //oServiceBL.ActualizarFechaIniciarCircuitoCalendar(item.ToString(), dtpDateTimeStar.Value);
                //    objCalendarBL.CircuitStart(ref objOperationResult, item.ToString(), DateTime.Now, Globals.ClientSession.GetAsList());

                //}
            }

            MessageBox.Show("Se grabó correctamente", "SISTEMAS!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public IHttpActionResult SaveAdditionalExamsForCalendar(MultiDataModel data)
        {
            List <AdditionalExamCreate> dataAdd = JsonConvert.DeserializeObject <List <AdditionalExamCreate> >(data.String1);

            var result = new CalendarBL().SaveAdditionalExamsForCalendar(dataAdd, data.Int1, data.Int2);

            return(Ok(result));
        }
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();
            }
        }
Example #8
0
        private void mnuComenzarCircuito_Click(object sender, EventArgs e)
        {
            CalendarBL                  objCalendarBL        = new CalendarBL();
            calendarDto                 objCalendarDto       = new calendarDto();
            ServiceBL                   objServiceBL         = new ServiceBL();
            serviceDto                  objServiceDto        = new serviceDto();
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();

            DateTime FechaAgenda = DateTime.Parse(grdDataCalendar.Selected.Rows[0].Cells[4].Value.ToString());

            if (FechaAgenda.Date != DateTime.Now.Date)
            {
                MessageBox.Show("No se permite Iniciar Circuito con una fecha que no sea la actual.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DialogResult Result = MessageBox.Show("¿Está seguro de INICIAR CIRCUITO este registro?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                string strCalendarId = grdDataCalendar.Selected.Rows[0].Cells[0].Value.ToString();

                objCalendarBL.CircuitStart(ref objOperationResult, strCalendarId, DateTime.Now, Globals.ClientSession.GetAsList());

                objServiceDto = objServiceBL.GetService(ref objOperationResult, grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString());

                var NewCont = grdDataCalendar.Selected.Rows[0].Cells["i_NewContinuationId"].Value;
                if ((int)NewCont == (int)Common.modality.NuevoServicio)
                {
                    objServiceDto.i_ServiceStatusId = (int)Common.ServiceStatus.Iniciado;
                }
                else if ((int)NewCont == (int)Common.modality.ContinuacionServicio)
                {
                    objServiceDto.i_ServiceStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_ServiceStatusId"].Value.ToString());
                }

                objServiceBL.UpdateService(ref objOperationResult, objServiceDto, Globals.ClientSession.GetAsList());

                _strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();

                btnFilter_Click(sender, e);

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                grdDataCalendar.Rows[_RowIndexgrdDataCalendar].Selected = true;

                MessageBox.Show("Circuito iniciado, paciente disponible para su atención", " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #9
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            CalendarBL _calendar = new CalendarBL();
            string     nroCarta  = txtNroCartaSolicitud.Text;
            string     result    = VerificarRegistro();

            _calendar.RegistrarCarta(_service, nroCarta);
            result = VerificarRegistro();
            if (result == "")
            {
                MessageBox.Show("NO SE PRODUJO NINGÚN REGISTRO", "Validación!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Se registro correctamente", "Información!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            this.Close();
        }
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                DiskFileDestinationOptions objDiskOpt         = new DiskFileDestinationOptions();
                OperationResult            objOperationResult = new OperationResult();
                string ruta  = Common.Utils.GetApplicationConfigValue("rutaReportes").ToString();
                var    Lista = new AuthorizedPersonBL().GetAuthorizedPersonPagedAndFiltered(ref objOperationResult, 0, null, null, null);

                foreach (var item in Lista)
                {
                    var     Cabecera = new CalendarBL().HojaRutaCabecera(item.v_AuthorizedPersonId);
                    var     Detalle  = new CalendarBL().HojaRutaDetalle(item.v_ProtocolId);
                    var     rp       = new Reports.crRoadMapCampania();
                    DataSet ds       = new DataSet();

                    DataTable dtHeader = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Cabecera);
                    DataTable dtDetail = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Detalle);

                    dtHeader.TableName = "dtCabecera";
                    dtDetail.TableName = "dtDetalle";

                    ds.Tables.Add(dtHeader);
                    ds.Tables.Add(dtDetail);
                    rp.SetDataSource(ds);


                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = Application.StartupPath + @"\TempMerge\" + Guid.NewGuid().ToString() + ".pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                }

                var x = _filesNameToMerge.ToList();
                _mergeExPDF.FilesName = x;
                //_mergeExPDF.DestinationFile = Application.StartupPath + @"\TempMerge\" + _serviceId + ".pdf"; ;
                _mergeExPDF.DestinationFile = ruta + "xxx" + ".pdf";;
                _mergeExPDF.Execute();
                _mergeExPDF.RunFile();
            }
        }
Example #11
0
        private void ShowReport()
        {
            OperationResult objOperationResult = new OperationResult();

            var rp = new Reports.crAgendaDetallado();

            var     aptitudeCertificate = new CalendarBL().ReporteAgenda(ref objOperationResult, 0, null, null, _FilterExpression, _FechaInicio, _FechaFin);
            DataSet ds1 = new DataSet();

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

            dt.TableName = "dtAgendaDetallado";

            ds1.Tables.Add(dt);

            rp.SetDataSource(ds1);

            crystalReportViewer1.ReportSource = rp;
            crystalReportViewer1.Show();
        }
Example #12
0
        private void mnuFinCircuito_Click(object sender, EventArgs e)
        {
            CalendarBL      objCalendarBL      = new CalendarBL();
            calendarDto     objCalendarDto     = new calendarDto();
            OperationResult objOperationResult = new OperationResult();

            DialogResult Result = MessageBox.Show("¿Está seguro de TERMINAR CIRCUITO este registro?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                string strCalendarId = grdDataCalendar.Selected.Rows[0].Cells[0].Value.ToString();

                objCalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, strCalendarId);
                objCalendarDto.v_CalendarId   = strCalendarId;
                objCalendarDto.i_LineStatusId = (int)Common.LineStatus.FueraCircuito;

                objCalendarBL.UpdateCalendar(ref objOperationResult, objCalendarDto, Globals.ClientSession.GetAsList());

                btnFilter_Click(sender, e);
            }
        }
        public IHttpActionResult GetPacientInLineByComponentId_Atx(MultiDataModel data)
        {
            var           ListComponent = new ComponentDal().GetAllComponents();
            List <string> Components    = new List <string>();

            if (data.Int3 == -1)
            {
                Components.Add(data.String2);
            }
            else
            {
                Components = ListComponent.FindAll(p => p.Value4 == data.Int2)
                             .Select(s => s.Value2)
                             .OrderBy(p => p).ToList();
            }

            var dateTime = DateTime.Parse(data.String1);
            var result   = new CalendarBL().GetPacientInLineByComponentId_ATX(dateTime, Components, data.Int1, data.Int3);

            return(Ok(result));
        }
Example #14
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            CalendarBL      objCalendarBL      = new CalendarBL();
            OperationResult objOperationResult = new OperationResult();


            List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"];

            if (ListaServicios == null)
            {
                Alert.Show("Seleccione un registro");
                return;
            }
            else
            {
                foreach (var item in ListaServicios)
                {
                    calendarDto objCalendarDto = new calendarDto();

                    objCalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, item.CalendarId);
                    objCalendarDto.v_CalendarId       = item.CalendarId;
                    objCalendarDto.i_CalendarStatusId = 4; //Cancelado
                    objCalendarDto.i_LineStatusId     = 2; //Fuera de Circuito

                    objCalendarBL.UpdateCalendar(ref objOperationResult, objCalendarDto, ((ClientSession)Session["objClientSession"]).GetAsList());
                }

                //Analizar el resultado de la operación
                if (objOperationResult.Success == 1)  // Operación sin error
                {
                    // Cerrar página actual y hacer postback en el padre para actualizar
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else  // Operación con error
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                    // Se queda en el formulario.
                }
            }
        }
        public IHttpActionResult UpdateServiceForProtocol(MultiDataModel data)
        {
            MessageCustom _MessageCustom = new MessageCustom();

            try
            {
                using (var ts = new TransactionScope())
                {
                    var  dataService   = JsonConvert.DeserializeObject <ServiceCustom>(data.String1);
                    bool resultService = new ServiceBl().UpdateServiceForProtocol(dataService, data.Int1);
                    if (!resultService)
                    {
                        throw new Exception("Sucedió un error al actualizar el servicio, por ello no se guardó ningún cambio.");
                    }

                    bool resultCalendar = new CalendarBL().UpdateCalendarForProtocol(dataService, data.Int1);
                    if (!resultCalendar)
                    {
                        throw new Exception("Sucedió un error al actualizar la agenda, por ello no se guardó ningún cambio.");
                    }

                    else
                    {
                        _MessageCustom.Error = false;
                    }
                    _MessageCustom.Status  = (int)StatusHttp.Ok;
                    _MessageCustom.Id      = "";
                    _MessageCustom.Message = "Se actualizó correctamente.";
                    ts.Complete();
                    return(Ok(_MessageCustom));
                }
            }
            catch (Exception ex)
            {
                _MessageCustom.Error   = true;
                _MessageCustom.Status  = (int)StatusHttp.BadRequest;
                _MessageCustom.Message = ex.Message;
                return(Ok(_MessageCustom));
            }
        }
Example #16
0
        private void btnIniciarCircuitoMasivo_Click(object sender, EventArgs e)
        {
            CalendarBL objCalendarBL = new CalendarBL();

            _ListaCalendar = new List <string>();
            foreach (var item in grdDataCalendar.Rows)
            {
                //CheckBox ck = (CheckBox)item.Cells["b_FechaEntrega"].Value;

                if ((bool)item.Cells["b_Seleccionar"].Value)
                {
                    string x = item.Cells["v_CalendarId"].Value.ToString();
                    _ListaCalendar.Add(x);
                }
            }

            if (_ListaCalendar.Count == 0)
            {
                MessageBox.Show("No hay ningún servicio con check, por favor seleccionar uno.", "VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                OperationResult objOperationResult = new OperationResult();
                foreach (var item in _ListaCalendar)
                {
                    //oServiceBL.ActualizarFechaIniciarCircuitoCalendar(item.ToString(), dtpDateTimeStar.Value);
                    objCalendarBL.CircuitStart(ref objOperationResult, item.ToString(), DateTime.Now, Globals.ClientSession.GetAsList());
                }
            }

            //frmPopupFechaEntrega frm = new frmPopupFechaEntrega(_ListaCalendar,"calendar");
            //frm.ShowDialog();
            MessageBox.Show("Se inició correctamente el inicio de circuito", "SISTEMAS!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            btnFilter_Click(sender, e);
        }
Example #17
0
        private void btnUpdateandSelect_Click(object sender, EventArgs e)
        {
            CalendarBL      objCalendarBL      = new CalendarBL();
            calendarDto     objcalendarDto     = new calendarDto();
            OperationResult objOperationResult = new OperationResult();


            for (int i = 0; i < _objLista.Count; i++)
            {
                if (_DocNumber == _objLista[i].v_DocNumber)
                {
                    objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, _objLista[i].v_CalendarId);


                    objcalendarDto.d_EntryTimeCM      = (DateTime?)null;
                    objcalendarDto.i_CalendarStatusId = (int)CalendarStatus.Agendado;
                    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();
        }
Example #18
0
        private void Liberar()
        {
            try
            {
                OperationResult objOperationResult = new OperationResult();
                ServiceBL       objServiceBL       = new ServiceBL();
                _ServiceComponentId = new List <string>();

                servicecomponentDto         objservicecomponentDto = null;
                List <ServiceComponentList> ListServiceComponent   = new List <ServiceComponentList>();


                if (grdDataServiceComponent.Rows.Count() == 0)
                {
                    MessageBox.Show("Debe seleccionar un paciente para poder LIBERARLO", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (_categoryId == -1)
                {
                    _ServiceComponentId.Add(grdLlamandoPaciente.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
                }
                else
                {
                    var servCompCat = objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId);

                    foreach (var item in servCompCat)
                    {
                        _ServiceComponentId.Add(item.v_ServiceComponentId);
                    }
                }

                List <servicecomponentDto> list = new List <servicecomponentDto>();

                for (int i = 0; i < _ServiceComponentId.Count; i++)
                {
                    objservicecomponentDto = new servicecomponentDto();
                    objservicecomponentDto.v_ServiceComponentId       = _ServiceComponentId[i];
                    objservicecomponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                    objservicecomponentDto.i_Iscalling                = (int)SiNo.NO;
                    objservicecomponentDto.i_Iscalling_1              = (int)SiNo.NO;
                    objservicecomponentDto.d_EndDate                  = DateTime.Now;
                    objservicecomponentDto.i_ServiceComponentStatusId = (int)Common.ServiceComponentStatus.PorAprobacion;



                    list.Add(objservicecomponentDto);
                    //Buscar en la lista y reemplazar el i_QueueStatusId

                    foreach (var item in _objCalendarListAMC.Where(c => c.v_ServiceComponentId == _ServiceComponentId[i]))
                    {
                        item.i_QueueStatusId = (int)Common.QueueStatusId.LIBRE;
                    }
                }

                // update
                if (_componentName == "LABORATORIO")
                {
                    objServiceBL.UpdateServiceComponentOfficeLaboratorio(list);
                }
                else
                {
                    objServiceBL.UpdateServiceComponentOffice(list);
                }


                #region Check de salir de circuito

                if (chkHability.Checked == true) // finaliza el servicio y actualiza el estado del servicio
                {
                    if (ddlServiceStatusId.SelectedValue.ToString() == ((int)ServiceStatus.Iniciado).ToString())
                    {
                        MessageBox.Show("Debe elegir cualquier otro estado que no sea (Iniciado)\nSi desea Liberar y/o Finalizar Circuito.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    serviceDto objserviceDto = new serviceDto();

                    objserviceDto.v_ServiceId       = _serviceId;
                    objserviceDto.i_ServiceStatusId = int.Parse(ddlServiceStatusId.SelectedValue.ToString());
                    objserviceDto.v_Motive          = txtReason.Text;

                    objServiceBL.UpdateServiceOffice(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());

                    //Actualizamos el estado de la linea de la agenda como fuera de circuito
                    CalendarBL  objCalendarBL  = new CalendarBL();
                    calendarDto objcalendarDto = new calendarDto();
                    objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, _CalendarId);
                    objcalendarDto.i_LineStatusId = 2;// int.Parse(Common.LineStatus.FueraCircuito.ToString());
                    objCalendarBL.UpdateCalendar(ref objOperationResult, objcalendarDto, Globals.ClientSession.GetAsList());
                }

                #endregion

                //Actualizar grdDataServiceComponent

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                btnRefresh_Click(null, null);

                txtReason.Text           = "";
                grdListaLlamando.Enabled = true;
                //grdLlamandoPaciente.Enabled = false;
                btnRefresh.Enabled  = true;
                chkHability.Enabled = false;
                chkHability.Checked = false;
                groupBox3.Enabled   = false;

                List <CalendarList> GrillaVacia = new List <CalendarList>();
                grdLlamandoPaciente.DataSource = GrillaVacia;

                _objCalendarListAMC.RemoveAll(x => x.i_QueueStatusId == 1);
                grdLlamandoPaciente.DataSource = _objCalendarListAMC;
                //grdLlamandoPaciente.DataSource = _objCalendarListAMC.FindAll(p => p.i_QueueStatusId != 1);

                //grdLlamandoPaciente.DataSource = new List<CalendarList>();

                if (_objCalendarListAMC.Count == 0)
                {
                    if (_objCalendarListAMC.Count > 0)
                    {
                        grdLlamandoPaciente.Rows[0].Selected = true;
                    }

                    btnRellamar.Enabled                 = false;
                    btnAtenderVerServicio.Enabled       = false;
                    btnLiberarFinalizarCircuito.Enabled = false;
                    grdLlamandoPaciente.Enabled         = false;
                    //grdLlamandoPaciente_Click(null, null);
                }

                else
                {
                    grdLlamandoPaciente.Rows[0].Selected = true;
                }

                //grdLlamandoPaciente.DataSource = new List<CalendarList>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Utils.ExceptionFormatter(ex), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #19
0
        private void AddAuxiliaryExam()
        {
            var findResult = lvExamenesSeleccionados.FindItemWithText(MedicalExamId);

            // El examen ya esta agregado
            if (findResult != null)
            {
                MessageBox.Show("Por favor seleccione otro examen.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var res = _ListaComponentes.Find(p => p == MedicalExamId);

            if (res != null)
            {
                var DialogResult = MessageBox.Show("El paciente ya cuenta con este examen, ¿Desea crear nuevo servicio?", "Error de Valicación", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (DialogResult == System.Windows.Forms.DialogResult.Yes)
                {
                    #region Agenda Automática
                    CalendarBL      calendarBl         = new CalendarBL();
                    OperationResult objOperationResult = new OperationResult();

                    var protocolId = Constants.Prot_Hospi_Adic;

                    var objCalendarDto = new calendarDto();
                    objCalendarDto.v_PersonId         = new PacientBL().GetPersonByNroDocument(ref objOperationResult, _dni).v_PersonId;// item.PersonId;
                    objCalendarDto.d_DateTimeCalendar = DateTime.Now;
                    objCalendarDto.d_CircuitStartDate = DateTime.Now;
                    objCalendarDto.d_EntryTimeCM      = DateTime.Now;
                    objCalendarDto.i_ServiceTypeId    = (int)ServiceType.Particular;
                    objCalendarDto.i_ServiceId        = (int)MasterService.Hospitalizacion;

                    objCalendarDto.i_CalendarStatusId  = (int)CalendarStatus.Agendado;
                    objCalendarDto.i_LineStatusId      = (int)LineStatus.EnCircuito;
                    objCalendarDto.v_ProtocolId        = protocolId;
                    objCalendarDto.i_NewContinuationId = 1;
                    objCalendarDto.i_LineStatusId      = (int)LineStatus.EnCircuito;
                    objCalendarDto.i_IsVipId           = (int)SiNo.NO;

                    var serviceId = calendarBl.AddShedule(ref objOperationResult, objCalendarDto, Globals.ClientSession.GetAsList(), protocolId, objCalendarDto.v_PersonId, (int)MasterService.Eso, "Nuevo");

                    serviceDto objServiceDto = new serviceDto();
                    objServiceDto = new ServiceBL().GetService(ref objOperationResult, serviceId);
                    objServiceDto.d_ServiceDate = DateTime.Now;

                    objServiceDto.i_ServiceStatusId = (int)Common.ServiceStatus.Iniciado;
                    new ServiceBL().UpdateService(ref objOperationResult, objServiceDto, Globals.ClientSession.GetAsList());


                    var servicesComponents = new ServiceBL().GetServiceComponents(ref objOperationResult, serviceId);

                    foreach (var servicesComponent in servicesComponents)
                    {
                        servicecomponentDto oservicecomponentDto = new servicecomponentDto();
                        oservicecomponentDto = new ServiceBL().GetServiceComponent(ref objOperationResult,
                                                                                   servicesComponent.v_ServiceComponentId);
                        oservicecomponentDto.i_MedicoTratanteId   = 11;
                        oservicecomponentDto.i_IsVisibleId        = 1;
                        oservicecomponentDto.v_ServiceComponentId = servicesComponent.v_ServiceComponentId;
                        new ServiceBL().UpdateServiceComponent(ref objOperationResult, oservicecomponentDto, Globals.ClientSession.GetAsList());
                    }



                    var oHospitalizacionserviceDto = new hospitalizacionserviceDto();

                    oHospitalizacionserviceDto.v_HopitalizacionId = _nroHospitalizacion;
                    oHospitalizacionserviceDto.v_ServiceId        = serviceId;

                    new HospitalizacionBL().AddHospitalizacionService(ref objOperationResult, oHospitalizacionserviceDto, Globals.ClientSession.GetAsList());
                    #endregion

                    MessageBox.Show("Se generó el servicio: " + serviceId, " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //var DialogResult = DialogResult.OK;
                    //var frm = new frmCalendar(_nroHospitalizacion, _dni, _serviceId);
                    //frm.ShowDialog();
                }
                else
                {
                    return;
                }
            }


            var row = new ListViewItem(new[] { MedicalExamName, MedicalExamId, ServiceComponentConcatId });

            lvExamenesSeleccionados.Items.Add(row);

            gbExamenesSeleccionados.Text = string.Format("Examenes Seleccionados {0}", lvExamenesSeleccionados.Items.Count);
        }
Example #20
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            OperationResult     objOperationResult     = new OperationResult();
            CalendarBL          objCalendarBL          = new CalendarBL();
            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();
            List <CalendarList> objCalendarList        = new List <CalendarList>();

            objCalendarList = objCalendarBL.GetCallPacientPagedAndFilteredGroupByCategoryId(ref objOperationResult, 0, null, "", "");

            if (objCalendarList == null)
            {
                return;
            }

            grdData.DataSource = objCalendarList;

            foreach (var item in objCalendarList)
            {
                if (item.i_QueueStatusId == (int)QueueStatusId.LLAMANDO && item.i_Iscalling == (int)SiNo.NO)
                {
                    string Repetitions = ConfigurationManager.AppSettings["Repetitions"];

                    for (int i = 0; i < int.Parse(Repetitions.ToString()); i++)
                    {
                        WindowsMediaPlayer wplayer = new WindowsMediaPlayer();

                        wplayer.URL = PathSound;

                        wplayer.controls.play();

                        string VTrabajador;

                        if (item.i_Gender == (int)Common.Gender.MASCULINO)
                        {
                            VTrabajador = "Trabajador";
                        }
                        else
                        {
                            VTrabajador = "Trabajadora";
                        }

                        if (item.v_NameOffice == "--Seleccionar--")
                        {
                            synth.SpeakAsync(string.Format(CallFormat, item.v_Pacient, item.v_OfficeNumber, item.v_CategoryName, VTrabajador));
                        }
                        else
                        {
                            synth.SpeakAsync(string.Format(CallFormat, item.v_Pacient, item.v_OfficeNumber + "," + item.v_NameOffice));
                        }
                    }
                }
            }

            List <CalendarList> x = objCalendarBL.GetCallPacientPagedAndFiltered(ref objOperationResult, 0, null, "", "");

            foreach (var item in x)
            {
                //Se actualiza el Flag de IsCalling para saber que el paciente ya ha sido llamado una vez
                string ServiceComponentId = item.v_ServiceComponentId;

                //if (NroTv =="1")
                //{
                objServiceBL.UpdateServiceComponentVisor(ref objOperationResult, ServiceComponentId, (int)SiNo.SI);
                //}
                //else if (NroTv == "2")
                //{
                //    objServiceBL.UpdateServiceComponentVisor_(ref objOperationResult, ServiceComponentId, (int)SiNo.SI);
                //}
            }
        }
Example #21
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();
            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();


            //Verificar si el paciente ya ha sido llamado en la BD y no en la temporal



            //var Resultado = objServiceBL.VerificarSiPacienteNoPuedeSerLlamado(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            ////var Resultado = _objCalendarListAMC.Find(p => p.v_ServiceId == grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            //if (Resultado != null)
            //{
            //    MessageBox.Show("Usted ya llamó al paciente o el paciente está siendo llamdo por otro consultorio.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            //    //grdListaLlamando.Enabled = false;
            //    grdLlamandoPaciente.Enabled = true;
            //    //btnRefresh.Enabled = false;

            //    chkHability.Enabled = true;

            //    btnLlamar.Enabled = false;
            //    btnRefresh_Click(null, null);

            //    if (grdLlamandoPaciente.Rows.Count > 0)
            //    {
            //        grdLlamandoPaciente.Rows[0].Selected = true;
            //        btnRellamar.Enabled = true;
            //        btnAtenderVerServicio.Enabled = true;
            //        btnLiberarFinalizarCircuito.Enabled = true;
            //    }
            //    return;
            //}


            Boolean Resultado1 = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado1)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                if (Valores.Count != 0)
                {
                    decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                    decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                    if (ValorIMCServicio < ValorIMCProtocolo)
                    {
                        MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        return;
                    }
                }
            }

            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("Este paciente está ocupado en otro consultorio. Para llamarlo de todas formas seleccione SÍ", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (Result == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }


            List <CalendarList> GrillaVacia = new List <CalendarList>();

            grdLlamandoPaciente.DataSource = GrillaVacia;
            grdLlamandoPaciente.ClearUndoHistory();
            // Cargar grilla de llamando al paciente  ************
            _objCalendarListAMC.Add(objCalendar);
            grdLlamandoPaciente.DataSource = _objCalendarListAMC;
            //*******************************************************

            objCalendar.v_Pacient                 = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName        = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId      = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();
            objCalendar.v_ServiceId               = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            objCalendar.d_Birthdate               = DateTime.Parse(grdListaLlamando.Selected.Rows[0].Cells["d_Birthdate"].Value.ToString());
            objCalendar.v_DocNumber               = grdListaLlamando.Selected.Rows[0].Cells["v_DocNumber"].Value.ToString();
            objCalendar.v_WorkingOrganizationName = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ProtocolName            = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
            objCalendar.v_ProtocolId              = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();
            objCalendar.v_EsoTypeName             = grdListaLlamando.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
            objCalendar.v_PersonId                = grdListaLlamando.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();
            objCalendar.i_QueueStatusId           = (int)QueueStatusId.LLAMANDO;

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }



            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            //grdListaLlamando.Enabled = false;
            grdLlamandoPaciente.Enabled = true;
            //btnRefresh.Enabled = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
        public IHttpActionResult IniciarCircuito(MultiDataModel data)
        {
            var result = new CalendarBL().CircuitStart(data.String1, data.Int1);

            return(Ok(result));
        }
Example #23
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!");
            }
        }
Example #24
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();

            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();

            Boolean Resultado = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                if (ValorIMCServicio < ValorIMCProtocolo)
                {
                    MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }


            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("¿Está seguro de LLAMAR a este paciente que está ocupado?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.No)
                {
                    return;
                }
            }

            objCalendar.v_Pacient            = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName   = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }

            // Cargar grilla de llamando al paciente  ************
            objCalendarList.Add(objCalendar);
            grdLlamandoPaciente.DataSource = objCalendarList;

            if (grdLlamandoPaciente.Rows.Count > 0)
            {
                grdLlamandoPaciente.Rows[0].Selected = true;
            }

            //*******************************************************

            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            grdListaLlamando.Enabled    = false;
            grdLlamandoPaciente.Enabled = true;
            btnRefresh.Enabled          = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
        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.
                    }
                }
            }
        }
Example #26
0
        private void Liberar()
        {
            try
            {
                OperationResult objOperationResult = new OperationResult();
                ServiceBL       objServiceBL       = new ServiceBL();

                servicecomponentDto         objservicecomponentDto = null;
                List <ServiceComponentList> ListServiceComponent   = new List <ServiceComponentList>();

                if (_categoryId == -1)
                {
                    _ServiceComponentId.Add(grdLlamandoPaciente.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
                }
                else
                {
                    var servCompCat = objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId);

                    foreach (var item in servCompCat)
                    {
                        _ServiceComponentId.Add(item.v_ServiceComponentId);
                    }
                }

                List <servicecomponentDto> list = new List <servicecomponentDto>();

                for (int i = 0; i < _ServiceComponentId.Count; i++)
                {
                    objservicecomponentDto = new servicecomponentDto();
                    objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                    objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LIBRE;
                    objservicecomponentDto.i_Iscalling          = (int)SiNo.NO;
                    objservicecomponentDto.d_EndDate            = DateTime.Now;
                    list.Add(objservicecomponentDto);
                }

                // update
                objServiceBL.UpdateServiceComponentOffice(list);

                #region Check de salir de circuito

                if (chkHability.Checked == true) // finaliza el servicio y actualiza el estado del servicio
                {
                    if (ddlServiceStatusId.SelectedValue.ToString() == ((int)ServiceStatus.Iniciado).ToString())
                    {
                        MessageBox.Show("Debe elegir cualquier otro estado que no sea (Iniciado)\nSi desea Liberar y/o Finalizar Circuito.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    serviceDto objserviceDto = new serviceDto();

                    objserviceDto.v_ServiceId       = _serviceId;
                    objserviceDto.i_ServiceStatusId = int.Parse(ddlServiceStatusId.SelectedValue.ToString());
                    objserviceDto.v_Motive          = txtReason.Text;

                    objServiceBL.UpdateServiceOffice(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());

                    //Actualizamos el estado de la linea de la agenda como fuera de circuito
                    CalendarBL  objCalendarBL  = new CalendarBL();
                    calendarDto objcalendarDto = new calendarDto();
                    objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, _CalendarId);
                    objcalendarDto.i_LineStatusId = 2;// int.Parse(Common.LineStatus.FueraCircuito.ToString());
                    objCalendarBL.UpdateCalendar(ref objOperationResult, objcalendarDto, Globals.ClientSession.GetAsList());
                }

                #endregion

                //Actualizar grdDataServiceComponent

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                btnRefresh_Click(null, null);

                txtReason.Text              = "";
                grdListaLlamando.Enabled    = true;
                grdLlamandoPaciente.Enabled = false;
                btnRefresh.Enabled          = true;
                chkHability.Enabled         = false;
                chkHability.Checked         = false;
                groupBox3.Enabled           = false;

                grdLlamandoPaciente.DataSource = new List <CalendarList>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Utils.ExceptionFormatter(ex), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }