using AGI;
using InHouse;
using System;
public class Open
{
    public static void Main()
    {

        string connString = "Server=localhost;Port=5432;User Id=admin;Password=secret;Database=main-db;";
        int employeeID = 500;
        bool punchedIn;
        string variable = null;

        // KeyPad is an enum with the keys on a phone pad.
        KeyPad kp;

        // Creating a new MonoTone object...
        MonoTone monoTone = new MonoTone();

        // Using a class from existing inhouse code...
        TimeClock timeClock = new TimeClock(connString);

        // Let me see what connection string is being used...
        monoTone.Output(connString);

        // Call the IspunchedIn to see if Employee with the ID of 500 is clocked in...
        punchedIn = timeClock.IsPunchedIn(employeeID);
        if (punchedIn)
        {
            // If he is punched in say "one."
            monoTone.SayDigits("1", "", out kp);
        }
        else
        {
            // If he is punched out say "zero."
            monoTone.SayDigits("0", "", out kp);
        }

        // Set a variable in Asterisk...
        monoTone.SetVariable("TESTER","Asterisk Rules!");

        // Turn on the debug info...
        monoTone.Debug = true;

        // Get that variable back and give var the value of it...
        monoTone.GetVariable("TESTER", out variable);

        // Turn off the debug info...
        monoTone.Debug = false;

        // Write the value of var to see if it is right...
        monoTone.Output(variable);

        // All done here...
        monoTone.HangUp();
    }
}