Untitled

 avatar
unknown
plain_text
2 months ago
825 B
2
Indexable
protected override async void OnAppearing()
{
    base.OnAppearing();

    try
    {
        var timeEntry = await _firebaseHelper.GetTodaysTimeEntryAsync(
            _currentInstructors.ID, 
            SubjectCodeLabel.Text
        );

        if (timeEntry != null)
        {
            TimeInLabel.Text = $"Time In: {timeEntry.TimeIn:g}";
            TimeOutLabel.Text = timeEntry.TimeOut.HasValue 
                ? $"Time Out: {timeEntry.TimeOut.Value:g}" 
                : "Time Out: Not yet logged";
        }
        else
        {
            TimeInLabel.Text = "Time In: No entry today";
            TimeOutLabel.Text = "Time Out: No entry today";
        }
    }
    catch (Exception ex)
    {
        await DisplayAlert("Error", $"An error occurred: {ex.Message}", "OK");
    }
}
Leave a Comment