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(); } }
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); } }
private void Schedule(List <IdsPersonAndProtocol> list) { foreach (var item in list) { var objCalendarDto = new calendarDto(); objCalendarDto.v_PersonId = item.PersonId; objCalendarDto.d_DateTimeCalendar = dtpCalendarDate.Value; objCalendarDto.i_ServiceTypeId = (int)ServiceType.Empresarial; objCalendarDto.i_CalendarStatusId = (int)CalendarStatus.Agendado; objCalendarDto.i_ServiceId = (int)MasterService.Eso; objCalendarDto.v_ProtocolId = item.ProtocolId; objCalendarDto.i_NewContinuationId = 1; objCalendarDto.i_LineStatusId = (int)LineStatus.EnCircuito; objCalendarDto.i_IsVipId = (int)SiNo.NO; _calendarBl.AddShedule(ref _operationResult, objCalendarDto, Globals.ClientSession.GetAsList(), item.ProtocolId, item.PersonId, (int)MasterService.Eso, "Nuevo"); } }
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); } }
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. } } }
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(); }
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); }
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); } }
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. } } } }
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 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); } }