private void btnOK_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); if (uvOrganization.Validate(true, false).IsValid) { if (txtName.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un nombre apropiado para la Razón Social.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_Mode == "New") { _masterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); // Populate the entity _masterrecommendationrestricctionDto.v_Name = txtName.Text.Trim(); _masterrecommendationrestricctionDto.i_TypifyingId = _TypifyingId; _masterRecommendationRestricctionName = txtName.Text.Trim(); // Save the data _MasterRecommendationRestricctionId = _objBL.AddMasterRecommendationRestricction(ref objOperationResult, _masterrecommendationrestricctionDto, Globals.ClientSession.GetAsList()); } else if (_Mode == "Edit") { // Populate the entity _masterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); _masterrecommendationrestricctionDto.v_Name = txtName.Text.Trim(); _masterrecommendationrestricctionDto.v_MasterRecommendationRestricctionId = _MasterRecommendationRestricctionId; // Save the data _objBL.UpdateMasterRecommendationRestricction(ref objOperationResult, _masterrecommendationrestricctionDto, Globals.ClientSession.GetAsList()); } //// 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 { MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "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); } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); diseasesDto objDiseaseDto = new diseasesDto(); diseasesDto objDiseaseDto1 = new diseasesDto(); List <dxfrecuentedetalleDto> ListadxfrecuentedetalleDto = new List <dxfrecuentedetalleDto>(); if (ddlExamen.SelectedValue == null || ddlExamen.SelectedValue == "-1") { Alert.Show("Por favor seleccione un examen."); return; } if (Session["v_DxFrecuenteId"] != null) // Grabar un Dx frecuente { //Grabar el Dx en el servicio Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList _diagnosticRepository = new Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList(); List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList> _ListadiagnosticRepository = new List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList>(); List <Sigesoft.Node.WinClient.BE.RecomendationList> Recomendaciones = new List <Node.WinClient.BE.RecomendationList>(); Sigesoft.Node.WinClient.BE.RecomendationList Recomendacion = null; List <Sigesoft.Node.WinClient.BE.RestrictionList> Restricciones = new List <Node.WinClient.BE.RestrictionList>(); Sigesoft.Node.WinClient.BE.RestrictionList Restriccion = null; _diagnosticRepository.v_DiagnosticRepositoryId = Guid.NewGuid().ToString(); _diagnosticRepository.v_DiseasesId = Session["DiseasesId"].ToString(); _diagnosticRepository.i_AutoManualId = 1; _diagnosticRepository.i_PreQualificationId = 1; _diagnosticRepository.i_FinalQualificationId = (int)FinalQualification.Definitivo; _diagnosticRepository.i_DiagnosticTypeId = (int)TipoDx.Enfermedad_Comun; _diagnosticRepository.v_ServiceId = Session["ServiceId"].ToString(); _diagnosticRepository.v_ComponentId = ddlExamen.SelectedValue.ToString(); //_componentId; _diagnosticRepository.i_RecordStatus = (int)RecordStatus.Agregado; _diagnosticRepository.i_RecordType = (int)RecordType.Temporal; #region Recomendación if (txtRecomendacion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrecommendation = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRecomendacion1.Text.Trim()); if (masterrecommendation == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRecomendacion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 1; //Crear Recomendación var MasterRecommendationId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = MasterRecommendationId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } else { var ListaReco = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(Session["v_DxFrecuenteId"].ToString(), 1); foreach (var item in ListaReco) { Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = item.v_MasterRecommendationRestricctionId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } } } #endregion #region Restricciones if (txtRestriccion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrestriccion = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRestriccion1.Text.Trim()); if (masterrestriccion == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRestriccion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 2; //Crear Restricción var MasterRestriccionId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = MasterRestriccionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } else { var ListaRestri = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(Session["v_DxFrecuenteId"].ToString(), 2); foreach (var item1 in ListaRestri) { Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = item1.v_MasterRecommendationRestricctionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } } } #endregion _diagnosticRepository.Restrictions = Restricciones; _diagnosticRepository.Recomendations = Recomendaciones; _ListadiagnosticRepository.Add(_diagnosticRepository); oServiceBL.AddDiagnosticRepository(ref objOperationResult, _ListadiagnosticRepository, null, ((ClientSession)Session["objClientSession"]).GetAsList(), true); 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. } } else if (Session["DiseasesId"] == null) { #region Crear el Dx Frecuente objDiseaseDto.v_CIE10Id = Session["Cie10Id"].ToString(); objDiseaseDto.v_Name = txtDxActualizado.Text; objDiseaseDto1 = oServiceBL.GetIsValidateDiseases(ref objOperationResult, objDiseaseDto.v_Name); string DxFrecuneteId = null; if (objDiseaseDto1 == null) { //Creo el Diseases objDiseaseDto.v_DiseasesId = oServiceBL.AddDiseases(ref objOperationResult, objDiseaseDto, ((ClientSession)Session["objClientSession"]).GetAsList()); //Crear nuevo Dx Frecuente y lo amarro al diseasesId creado DxFrecuenteBL oDxFrecuenteBL = new DxFrecuenteBL(); dxfrecuenteDto odxfrecuenteDto = new dxfrecuenteDto(); odxfrecuenteDto.v_DiseasesId = objDiseaseDto.v_DiseasesId; odxfrecuenteDto.v_CIE10Id = Session["Cie10Id"].ToString(); DxFrecuneteId = oDxFrecuenteBL.AddDxFrecuente(ref objOperationResult, odxfrecuenteDto, ((ClientSession)Session["objClientSession"]).GetAsList()); //Agregar Recomendaciones a Dx Frecuente dxfrecuentedetalleDto odxfrecuentedetalleDto = new dxfrecuentedetalleDto(); //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrecommendation = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRecomendacion1.Text.Trim()); var MasterRecommendationId = ""; if (masterrecommendation == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRecomendacion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 1; //Crear Recomendación MasterRecommendationId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } odxfrecuentedetalleDto.v_DxFrecuenteId = DxFrecuneteId; odxfrecuentedetalleDto.v_MasterRecommendationRestricctionId = MasterRecommendationId; ListadxfrecuentedetalleDto.Add(odxfrecuentedetalleDto); odxfrecuentedetalleDto = new dxfrecuentedetalleDto(); //Agregar Restricciones a Dx Frecuente var masterrestriccion = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRestriccion1.Text.Trim()); var MasterRestriccionId = ""; if (masterrestriccion == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRestriccion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 2; //Crear Restricción MasterRestriccionId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } odxfrecuentedetalleDto.v_DxFrecuenteId = DxFrecuneteId; odxfrecuentedetalleDto.v_MasterRecommendationRestricctionId = MasterRestriccionId; ListadxfrecuentedetalleDto.Add(odxfrecuentedetalleDto); //Agrego el detalle de los dxfrecuentes creados foreach (var item in ListadxfrecuentedetalleDto) { oDxFrecuenteBL.AddDxFrecuenteDetalle(ref objOperationResult, item, ((ClientSession)Session["objClientSession"]).GetAsList()); } } else { Alert.Show("Escoja uno que tenga código interno", "Error de validación", MessageBoxIcon.Warning); return; } #endregion #region Grabo el dx al servicio //Grabar el Dx en el servicio Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList _diagnosticRepository = new Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList(); List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList> _ListadiagnosticRepository = new List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList>(); List <Sigesoft.Node.WinClient.BE.RecomendationList> Recomendaciones = new List <Node.WinClient.BE.RecomendationList>(); Sigesoft.Node.WinClient.BE.RecomendationList Recomendacion = null; List <Sigesoft.Node.WinClient.BE.RestrictionList> Restricciones = new List <Node.WinClient.BE.RestrictionList>(); Sigesoft.Node.WinClient.BE.RestrictionList Restriccion = null; _diagnosticRepository.v_DiagnosticRepositoryId = Guid.NewGuid().ToString(); _diagnosticRepository.v_DiseasesId = objDiseaseDto.v_DiseasesId; _diagnosticRepository.i_AutoManualId = 1; _diagnosticRepository.i_PreQualificationId = 1; _diagnosticRepository.i_FinalQualificationId = (int)FinalQualification.Definitivo; _diagnosticRepository.i_DiagnosticTypeId = (int)TipoDx.Enfermedad_Comun; _diagnosticRepository.v_ServiceId = Session["ServiceId"].ToString(); _diagnosticRepository.v_ComponentId = ddlExamen.SelectedValue.ToString(); //_componentId; _diagnosticRepository.i_RecordStatus = (int)RecordStatus.Agregado; _diagnosticRepository.i_RecordType = (int)RecordType.Temporal; #region Recomendación if (txtRecomendacion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrecommendation = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRecomendacion1.Text.Trim()); if (masterrecommendation == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRecomendacion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 1; //Crear Recomendación var MasterRecommendationId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = MasterRecommendationId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } else { var ListaReco = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(DxFrecuneteId, 1); foreach (var item in ListaReco) { Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = item.v_MasterRecommendationRestricctionId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } } } #endregion #region Restricciones if (txtRestriccion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrestriccion = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRestriccion1.Text.Trim()); if (masterrestriccion == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRestriccion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 2; //Crear Restricción var MasterRestriccionId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = MasterRestriccionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } else { var ListaRestri = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(DxFrecuneteId, 2); foreach (var item1 in ListaRestri) { Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = item1.v_MasterRecommendationRestricctionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } } } #endregion _diagnosticRepository.Restrictions = Restricciones; _diagnosticRepository.Recomendations = Recomendaciones; _ListadiagnosticRepository.Add(_diagnosticRepository); oServiceBL.AddDiagnosticRepository(ref objOperationResult, _ListadiagnosticRepository, null, ((ClientSession)Session["objClientSession"]).GetAsList(), true); 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. } #endregion } else if (Session["DiseasesId"] != null) { string DxFrecuneteId = null; objDiseaseDto = oServiceBL.GetDiseases(ref objOperationResult, Session["DiseasesId"].ToString()); objDiseaseDto.v_CIE10Id = Session["Cie10Id"].ToString(); objDiseaseDto.v_Name = txtDxActualizado.Text; oServiceBL.UpdateDiseases(ref objOperationResult, objDiseaseDto, ((ClientSession)Session["objClientSession"]).GetAsList()); #region Crear el Dx Frecuente //Crear nuevo Dx Frecuente y lo amarro al diseasesId creado DxFrecuenteBL oDxFrecuenteBL = new DxFrecuenteBL(); dxfrecuenteDto odxfrecuenteDto = new dxfrecuenteDto(); odxfrecuenteDto.v_DiseasesId = objDiseaseDto.v_DiseasesId; odxfrecuenteDto.v_CIE10Id = Session["Cie10Id"].ToString(); DxFrecuneteId = oDxFrecuenteBL.AddDxFrecuente(ref objOperationResult, odxfrecuenteDto, ((ClientSession)Session["objClientSession"]).GetAsList()); //Agregar Recomendaciones a Dx Frecuente dxfrecuentedetalleDto odxfrecuentedetalleDto = new dxfrecuentedetalleDto(); //Verficiar si la recomendación se encuentra en la bd MasterRecommendationRestricctionBL oMasterRecommendationRestricctionBL = new MasterRecommendationRestricctionBL(); var masterrecommendation = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRecomendacion1.Text.Trim()); var MasterRecommendationId = ""; if (masterrecommendation == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRecomendacion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 1; //Crear Recomendación MasterRecommendationId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } odxfrecuentedetalleDto.v_DxFrecuenteId = DxFrecuneteId; odxfrecuentedetalleDto.v_MasterRecommendationRestricctionId = MasterRecommendationId; ListadxfrecuentedetalleDto.Add(odxfrecuentedetalleDto); odxfrecuentedetalleDto = new dxfrecuentedetalleDto(); //Agregar Restricciones a Dx Frecuente var masterrestriccion = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRestriccion1.Text.Trim()); var MasterRestriccionId = ""; if (masterrestriccion == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRestriccion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 2; //Crear Restricción MasterRestriccionId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } odxfrecuentedetalleDto.v_DxFrecuenteId = DxFrecuneteId; odxfrecuentedetalleDto.v_MasterRecommendationRestricctionId = MasterRestriccionId; ListadxfrecuentedetalleDto.Add(odxfrecuentedetalleDto); //Agrego el detalle de los dxfrecuentes creados foreach (var item in ListadxfrecuentedetalleDto) { oDxFrecuenteBL.AddDxFrecuenteDetalle(ref objOperationResult, item, ((ClientSession)Session["objClientSession"]).GetAsList()); } #endregion #region Grabo el dx al servicio //Grabar el Dx en el servicio Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList _diagnosticRepository = new Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList(); List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList> _ListadiagnosticRepository = new List <Sigesoft.Node.WinClient.BE.DiagnosticRepositoryList>(); List <Sigesoft.Node.WinClient.BE.RecomendationList> Recomendaciones = new List <Node.WinClient.BE.RecomendationList>(); Sigesoft.Node.WinClient.BE.RecomendationList Recomendacion = null; List <Sigesoft.Node.WinClient.BE.RestrictionList> Restricciones = new List <Node.WinClient.BE.RestrictionList>(); Sigesoft.Node.WinClient.BE.RestrictionList Restriccion = null; _diagnosticRepository.v_DiagnosticRepositoryId = Guid.NewGuid().ToString(); _diagnosticRepository.v_DiseasesId = objDiseaseDto.v_DiseasesId; _diagnosticRepository.i_AutoManualId = 1; _diagnosticRepository.i_PreQualificationId = 1; _diagnosticRepository.i_FinalQualificationId = (int)FinalQualification.Definitivo; _diagnosticRepository.i_DiagnosticTypeId = (int)TipoDx.Enfermedad_Comun; _diagnosticRepository.v_ServiceId = Session["ServiceId"].ToString(); _diagnosticRepository.v_ComponentId = ddlExamen.SelectedValue.ToString(); //_componentId; _diagnosticRepository.i_RecordStatus = (int)RecordStatus.Agregado; _diagnosticRepository.i_RecordType = (int)RecordType.Temporal; #region Recomendación if (txtRecomendacion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd masterrecommendation = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRecomendacion1.Text.Trim()); if (masterrecommendation == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRecomendacion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 1; //Crear Recomendación MasterRecommendationId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = MasterRecommendationId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } else { var ListaReco = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(DxFrecuneteId, 1); foreach (var item in ListaReco) { Recomendacion = new Node.WinClient.BE.RecomendationList(); Recomendacion.v_ServiceId = Session["ServiceId"].ToString(); Recomendacion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Recomendacion.v_MasterRecommendationId = item.v_MasterRecommendationRestricctionId; Recomendacion.i_RecordType = (int)RecordType.Temporal; Recomendacion.i_RecordStatus = (int)RecordStatus.Agregado; Recomendaciones.Add(Recomendacion); } } } #endregion #region Restricciones if (txtRestriccion1.Text.Trim() != "") { //Verficiar si la recomendación se encuentra en la bd masterrestriccion = oMasterRecommendationRestricctionBL.GetMasterRecommendationRestricctionByName(txtRestriccion1.Text.Trim()); if (masterrestriccion == null) { masterrecommendationrestricctionDto omasterrecommendationrestricctionDto = new masterrecommendationrestricctionDto(); omasterrecommendationrestricctionDto.v_Name = txtRestriccion1.Text.Trim(); omasterrecommendationrestricctionDto.i_TypifyingId = 2; //Crear Restricción MasterRestriccionId = oMasterRecommendationRestricctionBL.AddMasterRecommendationRestricction(ref objOperationResult, omasterrecommendationrestricctionDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = MasterRestriccionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } else { var ListaRestri = oServiceBL.ObtenerListaRecomendacionesPorDxFrecuente(DxFrecuneteId, 2); foreach (var item1 in ListaRestri) { Restriccion = new Node.WinClient.BE.RestrictionList(); Restriccion.v_ServiceId = Session["ServiceId"].ToString(); Restriccion.v_ComponentId = ddlExamen.SelectedValue.ToString(); Restriccion.v_MasterRestrictionId = item1.v_MasterRecommendationRestricctionId; Restriccion.i_RecordType = (int)RecordType.Temporal; Restriccion.i_RecordStatus = (int)RecordStatus.Agregado; Restricciones.Add(Restriccion); } } } #endregion _diagnosticRepository.Restrictions = Restricciones; _diagnosticRepository.Recomendations = Recomendaciones; _ListadiagnosticRepository.Add(_diagnosticRepository); oServiceBL.AddDiagnosticRepository(ref objOperationResult, _ListadiagnosticRepository, null, ((ClientSession)Session["objClientSession"]).GetAsList(), true); 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. } #endregion } }