この
public static bool canCancel(string date)
{
DateTime booking = Convert.ToDateTime(date);
DateTime ending = booking.AddHours(23).AddMinutes(59).AddSeconds(59);
var n = DateTime.Compare(ending, DateTime.Now);
if(n == -1)
{
// within 24 hour from booking
// so can not cancel
return false;
}
else
{
// greater than 24 hour
// so can cancel
return true;
}
}
のような方法が、その後
public static string Date(int c)
{
string a;
OleDbConnection myconn = DBConn();
string myQ = "SELECT DateTime FROM Booking WHERE movie_ID=" + c;
OleDbCommand myCmd = new OleDbCommand(myQ, myconn);
try
{
myconn.Open();
a = myCmd.ExecuteScalar().ToString();
var can_cancel = canCancel(a);
return a;
}
catch (Exception ex)
{
Console.WriteLine("Exception in DBHandler", ex);
return null;
}
finally
{
myconn.Close();
}
}
それを呼び出す作ります
シェアコード何を試してみましたか – Mostafiz
ok私は – Mostafiz