﻿CountVideosService = function() { }

CountVideosService.prototype.OnComplete = function(result) { }

CountVideosService.prototype.OnCompleteNoAction = function(result) { }

CountVideosService.prototype.OnTimeOut = function(result) { }

CountVideosService.prototype.OnError = function(result) { alert(result); }

CountVideosService.prototype.GetVideoViewedCount = function(videoId)
{    
    try
    {
        var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
    
        Type.registerNamespace('NetMatch.Zoover.Web.Services.Binaries');
        if (NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService == undefined){
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService = gtc("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.registerClass("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
        }
        NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.GetVideoViewedCount(videoId, this.OnComplete, this.OnTimeOut, null);
    }
    catch(e)
    {
        this.OnError(e);
    }
}

CountVideosService.prototype.MarkVideoAsViewed = function(videoId)
{
    try
    {
        var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
    
        Type.registerNamespace('NetMatch.Zoover.Web.Services.Binaries');
        if (NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService == undefined){
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService = gtc("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.registerClass("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
        }
        NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.MarkVideoAsViewed(videoId, this.OnCompleteNoAction, this.OnTimeOut,null);
    }
    catch(e)
    {
        this.OnError(e);
    }
}

CountVideosService.prototype.MarkDeletedIfDead = function(videoId, cubFilePath) {
    try {
        var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;

        Type.registerNamespace('NetMatch.Zoover.Web.Services.Binaries');
        if (NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService == undefined) {
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService = gtc("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
            NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.registerClass("NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService");
        }
        NetMatch.Zoover.Web.Services.Binaries.VideoStatisticsService.MarkDeletedIfDead(videoId, cubFilePath, this.OnCompleteNoAction, this.OnTimeOut, null);
    }
    catch (e) {
        this.OnError(e);
    }
}

function GetVideoViewedCount(videoId)
{
    var service = new CountVideosService();
    service.GetVideoViewedCount(videoId);
}

function MarkVideoAsViewed(videoId)
{
	var service = new CountVideosService();
    service.MarkVideoAsViewed(videoId);
}

function MarkDeletedIfDead(videoId, cubFilePath) {
    var service = new CountVideosService();
    service.MarkDeletedIfDead(videoId, cubFilePath);
}