コード例 #1
0
        /// <summary>
        /// Converts this instance of <see cref="componentfieldvaluesrecommendation"/> to an instance of <see cref="componentfieldvaluesrecommendationDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="componentfieldvaluesrecommendation"/> to convert.</param>
        public static componentfieldvaluesrecommendationDto ToDTO(this componentfieldvaluesrecommendation entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new componentfieldvaluesrecommendationDto();

            dto.v_ComponentFieldValuesRecommendationId = entity.v_ComponentFieldValuesRecommendationId;
            dto.v_ComponentFieldValuesId             = entity.v_ComponentFieldValuesId;
            dto.v_MasterRecommendationRestricctionId = entity.v_MasterRecommendationRestricctionId;
            dto.i_IsDeleted    = entity.i_IsDeleted;
            dto.i_InsertUserId = entity.i_InsertUserId;
            dto.d_InsertDate   = entity.d_InsertDate;
            dto.i_UpdateUserId = entity.i_UpdateUserId;
            dto.d_UpdateDate   = entity.d_UpdateDate;

            entity.OnDTO(dto);

            return(dto);
        }
コード例 #2
0
        /// <summary>
        /// Converts this instance of <see cref="componentfieldvaluesrecommendationDto"/> to an instance of <see cref="componentfieldvaluesrecommendation"/>.
        /// </summary>
        /// <param name="dto"><see cref="componentfieldvaluesrecommendationDto"/> to convert.</param>
        public static componentfieldvaluesrecommendation ToEntity(this componentfieldvaluesrecommendationDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new componentfieldvaluesrecommendation();

            entity.v_ComponentFieldValuesRecommendationId = dto.v_ComponentFieldValuesRecommendationId;
            entity.v_ComponentFieldValuesId             = dto.v_ComponentFieldValuesId;
            entity.v_MasterRecommendationRestricctionId = dto.v_MasterRecommendationRestricctionId;
            entity.i_IsDeleted    = dto.i_IsDeleted;
            entity.i_InsertUserId = dto.i_InsertUserId;
            entity.d_InsertDate   = dto.d_InsertDate;
            entity.i_UpdateUserId = dto.i_UpdateUserId;
            entity.d_UpdateDate   = dto.d_UpdateDate;

            dto.OnEntity(entity);

            return(entity);
        }
コード例 #3
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="componentfieldvaluesrecommendation"/> converted from <see cref="componentfieldvaluesrecommendationDto"/>.</param>
 static partial void OnEntity(this componentfieldvaluesrecommendationDto dto, componentfieldvaluesrecommendation entity);
コード例 #4
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="componentfieldvaluesrecommendationDto"/> converted from <see cref="componentfieldvaluesrecommendation"/>.</param>
 static partial void OnDTO(this componentfieldvaluesrecommendation entity, componentfieldvaluesrecommendationDto dto);
コード例 #5
0
        public void UpdateMedicalExamFieldValues(ref OperationResult pobjOperationResult, List <componentfieldvaluesrestrictionDto> pobjComponentFieldValuesRestrictionAdd, List <componentfieldvaluesrestrictionDto> pobjComponentFieldValuesRestrictionDelete, List <componentfieldvaluesrecommendationDto> pobjComponentFieldValuesRecommendationAdd, List <componentfieldvaluesrecommendationDto> pobjComponentFieldValuesRecommendationDelete, componentfieldvaluesDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                #region Actualizar Valor

                componentfieldvaluesrestrictionDto objcomponentfieldvaluesrestrictionDto = new componentfieldvaluesrestrictionDto();
                // Obtener la entidad fuente
                var objEntitySource = (from a in dbContext.componentfieldvalues
                                       where a.v_ComponentFieldValuesId == pobjDtoEntity.v_ComponentFieldValuesId
                                       select a).FirstOrDefault();

                // Crear la entidad con los datos actualizados
                pobjDtoEntity.d_UpdateDate   = DateTime.Now;
                pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                componentfieldvalues objEntity = componentfieldvaluesAssembler.ToEntity(pobjDtoEntity);

                // Copiar los valores desde la entidad actualizada a la Entidad Fuente
                dbContext.componentfieldvalues.ApplyCurrentValues(objEntity);

                // Guardar los cambios
                dbContext.SaveChanges();
                #endregion

                #region Crear Restriccion
                int intNodeId = int.Parse(ClientSession[0]);
                foreach (var item in pobjComponentFieldValuesRestrictionAdd)
                {
                    componentfieldvaluesrestriction objEntity1 = componentfieldvaluesrestrictionAssembler.ToEntity(item);

                    objEntity1.d_InsertDate   = DateTime.Now;
                    objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]);
                    objEntity1.i_IsDeleted    = 0;

                    var NewId1 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 28), "VR");
                    objEntity1.v_ComponentFieldValuesRestrictionId = NewId1;
                    objEntity1.v_ComponentFieldValuesId            = pobjDtoEntity.v_ComponentFieldValuesId;

                    dbContext.AddTocomponentfieldvaluesrestriction(objEntity1);
                }
                // Guardar los cambios
                dbContext.SaveChanges();

                #endregion

                #region Eliminar Restriccion

                if (pobjComponentFieldValuesRestrictionDelete != null)
                {
                    // Eliminar Componentes del protocolo
                    foreach (var item in pobjComponentFieldValuesRestrictionDelete)
                    {
                        // Obtener la entidad fuente
                        var objEntitySource1 = (from a in dbContext.componentfieldvaluesrestriction
                                                where a.v_ComponentFieldValuesRestrictionId == item.v_ComponentFieldValuesRestrictionId
                                                select a).FirstOrDefault();

                        // Crear la entidad con los datos actualizados
                        objEntitySource1.d_UpdateDate   = DateTime.Now;
                        objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                        objEntitySource1.i_IsDeleted    = 1;
                    }
                }

                // Guardar los cambios
                dbContext.SaveChanges();
                #endregion

                #region Crear Recommendation
                foreach (var item in pobjComponentFieldValuesRecommendationAdd)
                {
                    componentfieldvaluesrecommendation objEntity1 = componentfieldvaluesrecommendationAssembler.ToEntity(item);

                    objEntity1.d_InsertDate   = DateTime.Now;
                    objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]);
                    objEntity1.i_IsDeleted    = 0;

                    var NewId1 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 31), "VC");
                    objEntity1.v_ComponentFieldValuesRecommendationId = NewId1;
                    objEntity1.v_ComponentFieldValuesId = pobjDtoEntity.v_ComponentFieldValuesId;

                    dbContext.AddTocomponentfieldvaluesrecommendation(objEntity1);
                }
                // Guardar los cambios
                dbContext.SaveChanges();

                #endregion

                #region Eliminar Recommendation

                if (pobjComponentFieldValuesRecommendationDelete != null)
                {
                    // Eliminar Componentes del protocolo
                    foreach (var item in pobjComponentFieldValuesRecommendationDelete)
                    {
                        // Obtener la entidad fuente
                        var objEntitySource1 = (from a in dbContext.componentfieldvaluesrecommendation
                                                where a.v_ComponentFieldValuesRecommendationId == item.v_ComponentFieldValuesRecommendationId
                                                select a).FirstOrDefault();

                        // Crear la entidad con los datos actualizados
                        objEntitySource1.d_UpdateDate   = DateTime.Now;
                        objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                        objEntitySource1.i_IsDeleted    = 1;
                    }
                }

                // Guardar los cambios
                dbContext.SaveChanges();
                #endregion

                //// Guardar los cambios
                //dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamId=" + objEntity.v_ComponentFieldValuesId.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamId=" + pobjDtoEntity.v_ComponentFieldValuesId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return;
            }
        }