using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Westwind.Tools;
using Westwind.Web.Controls;

using ScriptCallbacks.BusinessObjects;

public partial class SimpleMethodCallbacks : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int x = 10;
        x++;
    }

   
    [CallbackMethod]
    protected string HelloWorld(string Name)
    {
        return "Hello " + Name + ". Server Time: " + DateTime.Now.ToString();
    }

   
    [CallbackMethod]
    protected decimal AddNumbers(decimal x, decimal y)
    {
        return x + y;
    }

    [CallbackMethod]
    protected string ThrowException(string Value)
    {
        if (this.chkException.Checked)
        {
            if (Value == "")
               Value = "Ah c'mon, a little initiative, please!";
            else
               Value =  Value + "??? You're kidding right?";

            throw new ApplicationException(Value + "\r\n\r\n" +
                                       "Server generated Exception at: \r\n" + DateTime.Now.ToString());
        }

        if (Value == "")
            return "So, you're saying you have no imagination?";
        
        return "Ok, the text you entered isn't bad:\r\n\r\n" + 
               Value;
    }

    
    
}
