Exemplo n.º 1
0
        public void AddDxFrecuenteDetalle(ref OperationResult pobjOperationResult, dxfrecuentedetalleDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                dxfrecuentedetalle    objEntity = dxfrecuentedetalleAssembler.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, 302), "HZ");
                objEntity.v_DxFrecuenteDetalleId = NewId;

                dbContext.AddTodxfrecuentedetalle(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return;
            }
        }
        /// <summary>
        /// Converts this instance of <see cref="dxfrecuentedetalle"/> to an instance of <see cref="dxfrecuentedetalleDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="dxfrecuentedetalle"/> to convert.</param>
        public static dxfrecuentedetalleDto ToDTO(this dxfrecuentedetalle entity)
        {
            if (entity == null) return null;

            var dto = new dxfrecuentedetalleDto();

            dto.v_DxFrecuenteDetalleId = entity.v_DxFrecuenteDetalleId;
            dto.v_DxFrecuenteId = entity.v_DxFrecuenteId;
            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;
        }
        /// <summary>
        /// Converts this instance of <see cref="dxfrecuentedetalleDto"/> to an instance of <see cref="dxfrecuentedetalle"/>.
        /// </summary>
        /// <param name="dto"><see cref="dxfrecuentedetalleDto"/> to convert.</param>
        public static dxfrecuentedetalle ToEntity(this dxfrecuentedetalleDto dto)
        {
            if (dto == null) return null;

            var entity = new dxfrecuentedetalle();

            entity.v_DxFrecuenteDetalleId = dto.v_DxFrecuenteDetalleId;
            entity.v_DxFrecuenteId = dto.v_DxFrecuenteId;
            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;
        }
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="dxfrecuentedetalle"/> converted from <see cref="dxfrecuentedetalleDto"/>.</param>
 static partial void OnEntity(this dxfrecuentedetalleDto dto, dxfrecuentedetalle entity);
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="dxfrecuentedetalleDto"/> converted from <see cref="dxfrecuentedetalle"/>.</param>
 static partial void OnDTO(this dxfrecuentedetalle entity, dxfrecuentedetalleDto dto);