public string AddHospitalizacionHabitacion(ref OperationResult pobjOperationResult, hospitalizacionhabitacionDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); hospitalizacionhabitacion objEntity = hospitalizacionhabitacionAssembler.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, 352), "HH");; objEntity.v_HospitalizacionHabitacionId = NewId; dbContext.AddTohospitalizacionhabitacion(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "ÁREA", "v_HospitalizacionHabitacionId=" + NewId.ToString(), Success.Ok, null); } 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, "ÁREA", "v_HospitalizacionHabitacionId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); } return(NewId); }
/// <summary> /// Converts this instance of <see cref="hospitalizacionhabitacion"/> to an instance of <see cref="hospitalizacionhabitacionDto"/>. /// </summary> /// <param name="entity"><see cref="hospitalizacionhabitacion"/> to convert.</param> public static hospitalizacionhabitacionDto ToDTO(this hospitalizacionhabitacion entity) { if (entity == null) { return(null); } var dto = new hospitalizacionhabitacionDto(); dto.v_HospitalizacionHabitacionId = entity.v_HospitalizacionHabitacionId; dto.v_HopitalizacionId = entity.v_HopitalizacionId; dto.i_HabitacionId = entity.i_HabitacionId; dto.d_StartDate = entity.d_StartDate; dto.d_EndDate = entity.d_EndDate; dto.d_Precio = entity.d_Precio; dto.i_ConCargoA = entity.i_ConCargoA; 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.d_SaldoPaciente = entity.d_SaldoPaciente; dto.d_SaldoAseguradora = entity.d_SaldoAseguradora; dto.v_ComentaryUpdate = entity.v_ComentaryUpdate; dto.i_EstateRoom = entity.i_EstateRoom; entity.OnDTO(dto); return(dto); }
/// <summary> /// Converts this instance of <see cref="hospitalizacionhabitacionDto"/> to an instance of <see cref="hospitalizacionhabitacion"/>. /// </summary> /// <param name="dto"><see cref="hospitalizacionhabitacionDto"/> to convert.</param> public static hospitalizacionhabitacion ToEntity(this hospitalizacionhabitacionDto dto) { if (dto == null) { return(null); } var entity = new hospitalizacionhabitacion(); entity.v_HospitalizacionHabitacionId = dto.v_HospitalizacionHabitacionId; entity.v_HopitalizacionId = dto.v_HopitalizacionId; entity.i_HabitacionId = dto.i_HabitacionId; entity.d_StartDate = dto.d_StartDate; entity.d_EndDate = dto.d_EndDate; entity.d_Precio = dto.d_Precio; entity.i_ConCargoA = dto.i_ConCargoA; 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.d_SaldoPaciente = dto.d_SaldoPaciente; entity.d_SaldoAseguradora = dto.d_SaldoAseguradora; entity.v_ComentaryUpdate = dto.v_ComentaryUpdate; entity.i_EstateRoom = dto.i_EstateRoom; dto.OnEntity(entity); return(entity); }
public void UpdateHospitalizacionHabitacion(ref OperationResult pobjOperationResult, hospitalizacionhabitacionDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.hospitalizacionhabitacion where a.v_HospitalizacionHabitacionId == pobjDtoEntity.v_HospitalizacionHabitacionId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); hospitalizacionhabitacion objEntity = hospitalizacionhabitacionAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.hospitalizacionhabitacion.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "ÁREA", "v_HospitalizacionHabitacionId=" + objEntity.v_HospitalizacionHabitacionId.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, "ÁREA", "v_HospitalizacionHabitacionId=" + pobjDtoEntity.v_HospitalizacionHabitacionId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="hospitalizacionhabitacion"/> converted from <see cref="hospitalizacionhabitacionDto"/>.</param> static partial void OnEntity(this hospitalizacionhabitacionDto dto, hospitalizacionhabitacion entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="hospitalizacionhabitacionDto"/> converted from <see cref="hospitalizacionhabitacion"/>.</param> static partial void OnDTO(this hospitalizacionhabitacion entity, hospitalizacionhabitacionDto dto);