private string GetPersonId(ScheduleForProcess record) { var oPersonDto = _pacientBl.GetPersonByNroDocument(ref _operationResult, record.NroDocument); if (oPersonDto != null) { oPersonDto.v_CurrentOccupation = record.CurrentOccupation; _pacientBl.UpdatePacient(ref _operationResult, oPersonDto, Globals.ClientSession.GetAsList(), oPersonDto.v_DocNumber, oPersonDto.v_DocNumber); return(oPersonDto.v_PersonId); } return(_pacientBl.AddPacient(ref _operationResult, PopulatePeronsDto(record), Globals.ClientSession.GetAsList())); }
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!"); } }