All Your Base

in #ita2 months ago

using System;

using System.Collections;

using System.Globalization;

static class Appointment

{

public static DateTime Schedule(string appointmentDateDescription)

{

  var cultureInfo = new CultureInfo("en-US");

  var dateTime = DateTime.Parse(appointmentDateDescription, cultureInfo);

  return dateTime;

}

public static bool HasPassed(DateTime appointmentDate)

{

  DateTime now = DateTime.Now;

  //bool comparison = now > appointmentDate;

  int comparison = DateTime.Compare(now, appointmentDate);

  return comparison>0;

}

public static bool IsAfternoonAppointment(DateTime appointmentDate)

{

   int hour = appointmentDate.Hour;

   if((hour >= 12) && (hour < 18)) 

       {return true;}

    else return false;

}

public static string Description(DateTime appointmentDate)

{

    return "You have an appointment on " + appointmentDate.ToString() +"."; 

    

}

public static DateTime AnniversaryDate()

{

    DateTime anniversary = new DateTime(DateTime.Now.Year, 9, 15, 0, 0, 0); 

    return anniversary; // guardare se mese e giorno coincidono

}

}