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 btnSavePacient_Click(object sender, EventArgs e) { // Populate the entity var objpersonDto = new personDto(); objpersonDto = _objPacientBL.GetPerson(ref objOperationResult, _PersonId); objpersonDto.v_PersonId = _PersonId; objpersonDto.v_FirstName = txtName.Text.Trim(); objpersonDto.v_FirstLastName = txtFirstLastName.Text.Trim(); objpersonDto.v_SecondLastName = txtSecondLastName.Text.Trim(); objpersonDto.i_DocTypeId = Convert.ToInt32(ddlDocTypeId.SelectedValue); objpersonDto.i_SexTypeId = Convert.ToInt32(ddlSexTypeId.SelectedValue); objpersonDto.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatusId.SelectedValue); objpersonDto.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objpersonDto.v_DocNumber = txtDocNumber.Text.Trim(); objpersonDto.v_ComentaryUpdate = GetChangesPerson(); objpersonDto.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objpersonDto.v_Mail = txtMail.Text.Trim(); string Result = ""; // Save the data Result = _objPacientBL.UpdatePacient(ref objOperationResult, objpersonDto, Globals.ClientSession.GetAsList(), NumberDocument, txtDocNumber.Text); //// Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { MessageBox.Show("Se grabó correctamente.", "! INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else // Operación con error { if (Result == "-1") { MessageBox.Show("El Número de documento ya existe.", "! ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(Constants.GenericErrorMessage, "! ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); // Se queda en el formulario. } } }
private void btnEditWorker_Click(object sender, EventArgs e) { var personDto = _pacientBl.GetPerson(ref _operationResult, _personId); personDto.i_DocTypeId = int.Parse(cboDocumentType.SelectedValue.ToString()); personDto.v_FirstName = txtFirstName.Text; personDto.v_FirstLastName = txtLastName.Text; personDto.v_SecondLastName = txtSecondLastName.Text; personDto.d_Birthdate = dtpDateTimeStar.Value; personDto.i_SexTypeId = int.Parse(cboSexType.SelectedValue.ToString()); personDto.v_CurrentOccupation = txtCurrentOcupation.Text; if (_pacientBl.UpdatePacient(ref _operationResult, personDto, Globals.ClientSession.GetAsList(), txtNroDocument.Text, txtNroDocument.Text) != "") { MessageBox.Show(@"Se actualizó los datos del trabajador", @"INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(@"Error al actualizar", @"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnOK_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); string Result = ""; if (uvPacient.Validate(true, false).IsValid) { if (txtName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Nombres.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtFirstLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Paterno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSecondLastName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Apellido Materno.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtDocNumber.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para Número Documento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtMail.Text.Trim() != "") { if (!Sigesoft.Common.Utils.email_bien_escrito(txtMail.Text.Trim())) { MessageBox.Show("Por favor ingrese un Email con formato correcto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (dtpBirthdate.Checked == false) { MessageBox.Show("Por favor ingrese una fecha de nacimiento.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int caracteres = txtDocNumber.TextLength; if (int.Parse(ddlDocTypeId.SelectedValue.ToString()) == (int)Common.Document.DNI) { if (caracteres != 8) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocTypeId.SelectedValue.ToString()) == (int)Common.Document.PASAPORTE) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocTypeId.SelectedValue.ToString()) == (int)Common.Document.LICENCIACONDUCIR) { if (caracteres != 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else if (int.Parse(ddlDocTypeId.SelectedValue.ToString()) == (int)Common.Document.CARNETEXTRANJ) { if (caracteres < 9) { MessageBox.Show("La cantida de caracteres de Número Documento es invalido.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (Mode == "New") { // Populate the entity objpersonDto = new personDto(); objpersonDto.v_FirstName = txtName.Text.Trim(); objpersonDto.v_FirstLastName = txtFirstLastName.Text.Trim(); objpersonDto.v_SecondLastName = txtSecondLastName.Text.Trim(); objpersonDto.i_DocTypeId = Convert.ToInt32(ddlDocTypeId.SelectedValue); objpersonDto.i_SexTypeId = Convert.ToInt32(ddlSexTypeId.SelectedValue); objpersonDto.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatusId.SelectedValue); objpersonDto.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objpersonDto.v_DocNumber = txtDocNumber.Text.Trim(); objpersonDto.d_Birthdate = dtpBirthdate.Value; objpersonDto.v_BirthPlace = txtBirthPlace.Text.Trim(); objpersonDto.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objpersonDto.v_AdressLocation = txtAdressLocation.Text.Trim(); objpersonDto.v_Mail = txtMail.Text.Trim(); objpersonDto.v_CurrentOccupation = txtCurrentOccupation.Text.Trim(); objpersonDto.b_FingerPrintTemplate = FingerPrintTemplate; objpersonDto.b_FingerPrintImage = FingerPrintImage; objpersonDto.b_RubricImage = RubricImage; objpersonDto.t_RubricImageText = RubricImageText; objpersonDto.i_Relationship = Convert.ToInt32(ddlRelationshipId.SelectedValue); objpersonDto.i_AltitudeWorkId = Convert.ToInt32(ddlAltitudeWorkId.SelectedValue); objpersonDto.i_PlaceWorkId = Convert.ToInt32(ddlPlaceWorkId.SelectedValue); objpersonDto.v_ExploitedMineral = txtExploitedMineral.Text; if (pbPersonImage.Image != null) { MemoryStream ms = new MemoryStream(); Bitmap bm = new Bitmap(pbPersonImage.Image); bm.Save(ms, ImageFormat.Bmp); objpersonDto.b_PersonImage = Common.Utils.ResizeUploadedImage(ms); pbPersonImage.Image.Dispose(); } else { objpersonDto.b_PersonImage = null; } // Save the data Result = _objPacientBL.AddPacient(ref objOperationResult, objpersonDto, Globals.ClientSession.GetAsList()); } else if (Mode == "Edit") { // Populate the entity objpersonDto = new personDto(); objpersonDto = _objPacientBL.GetPerson(ref objOperationResult, PacientId); objpersonDto.v_PersonId = PacientId; objpersonDto.v_FirstName = txtName.Text.Trim(); objpersonDto.v_FirstLastName = txtFirstLastName.Text.Trim(); objpersonDto.v_SecondLastName = txtSecondLastName.Text.Trim(); objpersonDto.i_DocTypeId = Convert.ToInt32(ddlDocTypeId.SelectedValue); objpersonDto.i_SexTypeId = Convert.ToInt32(ddlSexTypeId.SelectedValue); objpersonDto.i_MaritalStatusId = Convert.ToInt32(ddlMaritalStatusId.SelectedValue); objpersonDto.i_LevelOfId = Convert.ToInt32(ddlLevelOfId.SelectedValue); objpersonDto.v_DocNumber = txtDocNumber.Text.Trim(); objpersonDto.d_Birthdate = dtpBirthdate.Value; objpersonDto.v_BirthPlace = txtBirthPlace.Text.Trim(); objpersonDto.v_TelephoneNumber = txtTelephoneNumber.Text.Trim(); objpersonDto.v_AdressLocation = txtAdressLocation.Text.Trim(); objpersonDto.v_Mail = txtMail.Text.Trim(); objpersonDto.v_CurrentOccupation = txtCurrentOccupation.Text.Trim(); objpersonDto.b_FingerPrintTemplate = FingerPrintTemplate; objpersonDto.b_FingerPrintImage = FingerPrintImage; objpersonDto.b_RubricImage = RubricImage; objpersonDto.t_RubricImageText = RubricImageText; objpersonDto.i_Relationship = Convert.ToInt32(ddlRelationshipId.SelectedValue); objpersonDto.i_AltitudeWorkId = Convert.ToInt32(ddlAltitudeWorkId.SelectedValue); objpersonDto.i_PlaceWorkId = Convert.ToInt32(ddlPlaceWorkId.SelectedValue); objpersonDto.v_ExploitedMineral = txtExploitedMineral.Text; if (pbPersonImage.Image != null) { MemoryStream ms = new MemoryStream(); Bitmap bm = new Bitmap(pbPersonImage.Image); bm.Save(ms, ImageFormat.Bmp); objpersonDto.b_PersonImage = Common.Utils.ResizeUploadedImage(ms); pbPersonImage.Image.Dispose(); } else { objpersonDto.b_PersonImage = null; } // Save the data Result = _objPacientBL.UpdatePacient(ref objOperationResult, objpersonDto, Globals.ClientSession.GetAsList(), NumberDocument, txtDocNumber.Text); } //// Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else // Operación con error { if (Result == "-1") { MessageBox.Show("El Número de documento ya existe.", "! ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(Constants.GenericErrorMessage, "! ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); // Se queda en el formulario. } } } else { MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
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!"); } }