public string AddMedicalExamFieldValues(ref OperationResult pobjOperationResult, List <ComponentFieldValuesRestrictionList> ComponentFieldValuesRestrictionList, List <ComponentFieldValuesRecommendationList> ComponentFieldValuesRecommendationList, componentfieldvaluesDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); componentfieldvalues objEntity = componentfieldvaluesAssembler.ToEntity(pobjDtoEntity); componentfieldvaluesrestrictionDto objcomponentfieldvaluesrestrictionDto = new componentfieldvaluesrestrictionDto(); componentfieldvaluesrecommendationDto objcomponentfieldvaluesrecommendationDto = new componentfieldvaluesrecommendationDto(); objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; // Autogeneramos el Pk de la tabla int intNodeId = int.Parse(ClientSession[0]); NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 19), "MV"); objEntity.v_ComponentFieldValuesId = NewId; dbContext.AddTocomponentfieldvalues(objEntity); dbContext.SaveChanges(); if (ComponentFieldValuesRestrictionList != null) { for (int i = 0; i < ComponentFieldValuesRestrictionList.Count; i++) { objcomponentfieldvaluesrestrictionDto.v_ComponentFieldValuesId = NewId; objcomponentfieldvaluesrestrictionDto.v_MasterRecommendationRestricctionId = ComponentFieldValuesRestrictionList[i].v_MasterRecommendationRestricctionId; AddRestriction(ref pobjOperationResult, objcomponentfieldvaluesrestrictionDto, ClientSession); } } if (ComponentFieldValuesRecommendationList != null) { for (int i = 0; i < ComponentFieldValuesRecommendationList.Count; i++) { objcomponentfieldvaluesrecommendationDto.v_ComponentFieldValuesId = NewId; objcomponentfieldvaluesrecommendationDto.v_ComponentFieldValuesRecommendationId = ComponentFieldValuesRecommendationList[i].v_MasterRecommendationRestricctionId; AddRecommendation(ref pobjOperationResult, objcomponentfieldvaluesrecommendationDto, ClientSession); } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamFieldValuesId=" + NewId.ToString(), Success.Ok, null); return(NewId); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamFieldValuesId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return(null); } }