﻿Type.registerNamespace("CALENDAR_EVENTS");

var common = new COMMON.UIUtil();

var CALENDAR_EVENTSID = "CalendarEvents";

CALENDAR_EVENTS.UIManager = function() {
}

CALENDAR_EVENTS.UIManager.prototype = {


    LoadDynamicData: function() {
        var eventServiceClient = new ITICClients.eventServiceClient();
        eventServiceClient.getAllEventsPublic(this.getAllEvents_callback, this.callback_error, common.showwaitscreen, CALENDAR_EVENTSID);
    },
    getAllEvents_callback: function(result) {
        try {

            if (result.IsSuccess = "true") {
                $get(CALENDAR_EVENTSID).innerHTML = result.Result;
            }
            var navurl = new String(result.NavigateURL);
            if (navurl.trim() != "null" && navurl.trim() != "") {
                window.location = navurl;
            }
        }
        catch (e) {
        }
        finally {
        }
    },


    callback_error: function(result) {
//        var uiUtil = new COMMON.UIUtil();
//        uiUtil.showServiceException(result);
//        uiUtil.hidewaitscreen();
    },

    dispose: function() {
        //disposed
    }
}

CALENDAR_EVENTS.UIManager.registerClass('CALENDAR_EVENTS.UIManager', null, Sys.IDisposable)

//page load function
function pageLoad() {
    var uiManger = new CALENDAR_EVENTS.UIManager();
    uiManger.LoadDynamicData();
}

// Notify ScriptManager that this is the end of the script.
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();