﻿/// <reference path="jquery.min-vsdoc2.js" /> 

/*******************************************************************************************
*    WSUpdateProductCount
*       - Calls page method responsible for updating product count
********************************************************************************************/
function WSUpdateProductCount(EventProductID,QTY) {
    if (isNaN(QTY) == true) {
        alert('Invalid Number');
    }
    else {
        	//Call page method to create batch
        PageMethods.UpdateDesiredProductCount(EventProductID,
									   QTY,
									   on_DesiredQtyUpdate_Succeeded,
									   on_DesiredQtyUpdate_Failed)
    }


}

/*******************************************************************************************
*    on_DesiredQtyUpdate_Succeeded
*       - Handle on_DesiredQtyUpdate_Succeeded Succeeded Event 
********************************************************************************************/
function on_DesiredQtyUpdate_Succeeded(result, userContext, methodName) {
    // Do nothing
}

/*******************************************************************************************
*    on_DesiredQtyUpdate_Failed
*       - Handle on_DesiredQtyUpdate_Failed Failed Event 
********************************************************************************************/
function on_DesiredQtyUpdate_Failed(error, userContext, methodName) {
	//
	alert('Error: Desired quantity not updated');
}



/*******************************************************************************************
*    WSUpdateProductCount
*       - Calls page method responsible for updating product count
********************************************************************************************/
function WSUpdateDynamicText(EventProductID, ProductOptionID, DynamicText) {
    if (DynamicText == '') {
        alert('Invalid Text');
    }
    else {
        //Call page method to create batch
        PageMethods.UpdateDynamicText(EventProductID,
									   ProductOptionID,
									   DynamicText,
									   on_DesiredQtyUpdate_Succeeded,
									   on_DesiredQtyUpdate_Failed)
    }


}

/*******************************************************************************************
*    on_UpdateDynamicText_Succeeded
*       - Handle on_UpdateDynamicText_Succeeded Succeeded Event 
********************************************************************************************/
function on_UpdateDynamicText_Succeeded(result, userContext, methodName) {
    // Do nothing
}

/*******************************************************************************************
*    on_UpdateDynamicText_Failed
*       - Handle on_UpdateDynamicText_Failed Failed Event 
********************************************************************************************/
function on_UpdateDynamicText_Failed(error, userContext, methodName) {
    //
    alert('Error: Text not updated');
}



//Update Cart User Input
function WSUpdateCartUserInput(CartProductID, ProductOptionID, UserInput) {
    if (UserInput == '') {
        alert('Invalid Text');
    }
    else {
        //Call page method to create batch
        PageMethods.UpdateCartUserInput(CartProductID,
									   ProductOptionID,
									   UserInput,
									   on_DesiredQtyUpdate_Succeeded,
									   on_DesiredQtyUpdate_Failed)
    }

}

function on_UpdateCartUserInput_Succeeded(result, userContext, methodName) {
    // Do nothing
}

function on_UpdateCartUserInput_Failed(error, userContext, methodName) {
    //
    alert('Error: Text not updated');
}
