Ejemplo n.º 1
0
        public void AddTramas(ref OperationResult pobjOperationResult, tramasDto pobjDtoEntity, List <string> ClientSession)
        {
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                tramas objEntity = tramasAssembler.ToEntity(pobjDtoEntity);

                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, 360), "TR");;
                objEntity.v_TramaId = NewId;

                dbContext.AddTotramas(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "TRAMA", "v_TramaId=" + NewId.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.CREACION, "TRAMA", "v_TramaId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return;
            }
        }
Ejemplo n.º 2
0
        public void UpdateTrama(ref OperationResult pobjOperationResult, tramasDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                // Obtener la entidad fuente
                var objEntitySource = (from a in dbContext.tramas
                                       where a.v_TramaId == pobjDtoEntity.v_TramaId
                                       select a).FirstOrDefault();

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

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

                // Guardar los cambios
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "TRAMA", "v_TramaId=" + objEntity.v_TramaId.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, "TRAMA", "v_TramaId=" + pobjDtoEntity.v_TramaId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);

                return;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts this instance of <see cref="tramas"/> to an instance of <see cref="tramasDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="tramas"/> to convert.</param>
        public static tramasDto ToDTO(this tramas entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new tramasDto();

            dto.v_TramaId          = entity.v_TramaId;
            dto.v_TipoRegistro     = entity.v_TipoRegistro;
            dto.d_FechaIngreso     = entity.d_FechaIngreso;
            dto.d_FechaAlta        = entity.d_FechaAlta;
            dto.i_Genero           = entity.i_Genero;
            dto.i_GrupoEtario      = entity.i_GrupoEtario;
            dto.v_DiseasesName     = entity.v_DiseasesName;
            dto.v_CIE10Id          = entity.v_CIE10Id;
            dto.i_UPS              = entity.i_UPS;
            dto.i_Procedimiento    = entity.i_Procedimiento;
            dto.i_Especialidad     = entity.i_Especialidad;
            dto.i_TipoParto        = entity.i_TipoParto;
            dto.i_TipoNacimiento   = entity.i_TipoNacimiento;
            dto.i_TipoComplicacion = entity.i_TipoComplicacion;
            dto.i_Programacion     = entity.i_Programacion;
            dto.i_TipoCirugia      = entity.i_TipoCirugia;
            dto.i_HorasProg        = entity.i_HorasProg;
            dto.i_HorasEfect       = entity.i_HorasEfect;
            dto.i_HorasActo        = entity.i_HorasActo;
            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;
            dto.v_ComentaryUpdate  = entity.v_ComentaryUpdate;

            entity.OnDTO(dto);

            return(dto);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Converts this instance of <see cref="tramasDto"/> to an instance of <see cref="tramas"/>.
        /// </summary>
        /// <param name="dto"><see cref="tramasDto"/> to convert.</param>
        public static tramas ToEntity(this tramasDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new tramas();

            entity.v_TramaId          = dto.v_TramaId;
            entity.v_TipoRegistro     = dto.v_TipoRegistro;
            entity.d_FechaIngreso     = dto.d_FechaIngreso;
            entity.d_FechaAlta        = dto.d_FechaAlta;
            entity.i_Genero           = dto.i_Genero;
            entity.i_GrupoEtario      = dto.i_GrupoEtario;
            entity.v_DiseasesName     = dto.v_DiseasesName;
            entity.v_CIE10Id          = dto.v_CIE10Id;
            entity.i_UPS              = dto.i_UPS;
            entity.i_Procedimiento    = dto.i_Procedimiento;
            entity.i_Especialidad     = dto.i_Especialidad;
            entity.i_TipoParto        = dto.i_TipoParto;
            entity.i_TipoNacimiento   = dto.i_TipoNacimiento;
            entity.i_TipoComplicacion = dto.i_TipoComplicacion;
            entity.i_Programacion     = dto.i_Programacion;
            entity.i_TipoCirugia      = dto.i_TipoCirugia;
            entity.i_HorasProg        = dto.i_HorasProg;
            entity.i_HorasEfect       = dto.i_HorasEfect;
            entity.i_HorasActo        = dto.i_HorasActo;
            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;
            entity.v_ComentaryUpdate  = dto.v_ComentaryUpdate;

            dto.OnEntity(entity);

            return(entity);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="tramas"/> converted from <see cref="tramasDto"/>.</param>
 static partial void OnEntity(this tramasDto dto, tramas entity);
Ejemplo n.º 6
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="tramasDto"/> converted from <see cref="tramas"/>.</param>
 static partial void OnDTO(this tramas entity, tramasDto dto);