viewEntry method

Future<WaterLineFieldDto> viewEntry(
  1. int id,
  2. int table_field_id
)

Implementation

Future<WaterLineFieldDto> viewEntry(int id, int table_field_id) async {
  if (!initialized) throw ArgumentError(AbstractDao.C_MUST_INIT);
  bool change = false;
  try {
    waterLineFieldDto = await waterLineFieldDao.getWaterLineFieldDtoByUnique(
        id, table_field_id, ChangeType.NOTIFY, WaterLineFieldDto.C_USER_ID_NONE);
    if (waterLineFieldDto.ui_type != UiType.IN_LIST) {
      if (waterLineFieldDto.ui_type != UiType.VIEWED) change = true;
    }
    if (waterLineFieldDto.notify_state_enum != NotifyState.CLIENT_UP_TO_DATE) {
      if (waterLineFieldDto.notify_state_enum != NotifyState.CLIENT_OUT_OF_DATE)
        change = true;
    }
  } on SqlException catch (e) {
    if (e.sqlExceptionEnum == SqlExceptionEnum.ENTRY_NOT_FOUND ||
        e.sqlExceptionEnum == SqlExceptionEnum.FAILED_SELECT) {
      change = true;
    }
  }
  if (change) {
    waterLineFieldDto = await setWaterLineField(
        id,
        table_field_id,
        ChangeType.NOTIFY,
        WaterLineFieldDto.C_USER_ID_NONE,
        NotifyState.CLIENT_OUT_OF_DATE,
        null,
        UiType.VIEWED,
        null);
  }
  return waterLineFieldDto;
}