//
// This is Event Handler for the request button which is located in the first floor.
//
private void down_Click(object sender, EventArgs e)
{// If the vertical location of the Elevator is equal to y = 95, the 'OpenDoor' timer will start. Otherwise, 'CloseDoor' timer will start.
if (Elevator.Top == 95)
{
drOpen = true;
// This insert command will be saved into string data type (Sqlcommand).
// Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is opening in first Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";
Connection();
OpenDoor.Start();// It will call the 'OpenDoor' Event Handler.
}
else
{
drClose = true;
button = false;
close = false;
lightOn = false;
// This insert command will be saved into string data type (Sqlcommand).
// Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is closing in first Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";
Connection();
CloseDoor.Start();// The 'CloseDoor' timer will start therefore, means it will call the 'CloseDoor' Event Handler.
}
}