if(typeof(X2O.X2OBaseItem) == 'undefined')
{
	throw('Cannot use this file unless you have included Base.js');
}
X2O.RecipeIngredientCollectionVO = function(){};
X2O.RecipeIngredientCollectionVO.Inherits(X2O.X2OBaseCollection);
	X2O.RecipeIngredientCollectionVO = function()
	{
		this.Inherits(X2O.X2OBaseCollection,'X2O.RecipeIngredientCollectionVO', 'X2O.RecipeIngredientVO', 'RecipeIngredients');
		
		/*PUBLIC METHODS*/
				this.loadAll = function(startIndex, endIndex, bLoadDeep)
		{
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&LoadDeep=' + bLoadDeep.toString();
			}
			if(typeof(startIndex) != 'undefined')
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt(startIndex.toString());
			}
			else
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			if(typeof(endIndex) != 'undefined')
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt(endIndex.toString());
			}
			else
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			
			
			if(typeof("LoadAll") != 'undefined')
{
request_vars += '&Action=' + X2O.X2ORequest.encrypt("LoadAll");
}

			
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from loadAll: ' + error);
			}
		}

		this.loadAllWhereIDInList = function(IDListCommaSeparated, bLoadDeep)
		{
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&LoadDeep=' + bLoadDeep.toString();
			}
			if(typeof(startIndex) != 'undefined')
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt(startIndex.toString());
			}
			else
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			if(typeof(endIndex) != 'undefined')
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt(endIndex.toString());
			}
			else
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			
			
			if(typeof("LoadAllWherePKInList") != 'undefined')
{
request_vars += '&Action=' + X2O.X2ORequest.encrypt("LoadAllWherePKInList");
}
if(typeof(IDListCommaSeparated) != 'undefined')
{
request_vars += '&PKInList=' + X2O.X2ORequest.encrypt(IDListCommaSeparated);
}

			
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from loadAllWhereIDInList: ' + error);
			}
		}

		this.loadAllByRelatedIngredientItemIDDeep = function(RelatedIngredientID, startIndex, endIndex, bLoadDeep)
		{
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&LoadDeep=' + bLoadDeep.toString();
			}
			if(typeof(startIndex) != 'undefined')
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt(startIndex.toString());
			}
			else
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			if(typeof(endIndex) != 'undefined')
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt(endIndex.toString());
			}
			else
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			
			
			if(typeof(RelatedIngredientID) != 'undefined')
{
request_vars += '&RelatedIngredientID=' + X2O.X2ORequest.encrypt(RelatedIngredientID);
}
if(typeof("LoadAllByRelatedIngredientItemFKDeep") != 'undefined')
{
request_vars += '&Action=' + X2O.X2ORequest.encrypt("LoadAllByRelatedIngredientItemFKDeep");
}

			
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from loadAllByRelatedIngredientItemIDDeep: ' + error);
			}
		}

		this.loadAllByRelatedRecipeItemIDDeep = function(RelatedRecipeID, startIndex, endIndex, bLoadDeep)
		{
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&LoadDeep=' + bLoadDeep.toString();
			}
			if(typeof(startIndex) != 'undefined')
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt(startIndex.toString());
			}
			else
			{
				request_vars += '&X2O_StartIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			if(typeof(endIndex) != 'undefined')
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt(endIndex.toString());
			}
			else
			{
				request_vars += '&X2O_EndIndex=' + X2O.X2ORequest.encrypt("-1");
			}
			
			
			if(typeof(RelatedRecipeID) != 'undefined')
{
request_vars += '&RelatedRecipeID=' + X2O.X2ORequest.encrypt(RelatedRecipeID);
}
if(typeof("LoadAllByRelatedRecipeItemFKDeep") != 'undefined')
{
request_vars += '&Action=' + X2O.X2ORequest.encrypt("LoadAllByRelatedRecipeItemFKDeep");
}

			
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from loadAllByRelatedRecipeItemIDDeep: ' + error);
			}
		}


	}
X2O.RecipeIngredientVO = function(){};
X2O.RecipeIngredientVO.Inherits(X2O.X2OBaseItem);	
X2O.RecipeIngredientVO = function(Amount)
{
	/*private vars*/
	var _ID;
var _Amount;
var _RelatedIngredientID;
var _RelatedRecipeID;

	
	/*checks for empty constructor/missing args*/
		if(typeof(Amount) == 'undefined')
	{
		Amount = null;
	}

	
	this.Inherits(X2O.X2OBaseItem, 'X2O.RecipeIngredientVO', 'RecipeIngredients',{'RelatedIngredientItem': 'X2O.IngredientVO','RelatedRecipeItem': 'X2O.RecipeVO'});
		
	
	/*getter and setter methods*/
	this.getID= function() { return _ID; }
this.setID = function(_val)
{
		if(_val == null)
	{
		throw('ID is required.');
	}
	
	if(typeof(_val) == 'number'
	&&
	parseFloat(_val) == parseInt(_val)
	&&
	_val > 0)
	{
		_ID = _val;
	}
	else throw('ID must be an integer greater than zero.');
}
this.getAmount= function() { return _Amount; }
this.setAmount = function(_val)
{
		if(_val == null)
	{
		throw('Amount is required.');
	}
	
	if(typeof(_val) == 'string')
	{
		if(_val.length <= 255)
		{
			_Amount = _val;
		}
		else throw('Amount cannot be longer than 255 characters.');
	}
	else throw('Cannot set Amount to a non-string value.');
}
this.getRelatedIngredientID= function() { return _RelatedIngredientID; }
this.setRelatedIngredientID = function(_val)
{
		if(_val == null)
	{
		throw('RelatedIngredientID is required.');
	}
	
	if(typeof(_val) == 'number'
	&&
	parseFloat(_val) == parseInt(_val)
	&&
	_val > 0)
	{
		_RelatedIngredientID = _val;
	}
	else throw('RelatedIngredientID must be an integer greater than zero.');
}
this.getRelatedRecipeID= function() { return _RelatedRecipeID; }
this.setRelatedRecipeID = function(_val)
{
		if(_val == null)
	{
		throw('RelatedRecipeID is required.');
	}
	
	if(typeof(_val) == 'number'
	&&
	parseFloat(_val) == parseInt(_val)
	&&
	_val > 0)
	{
		_RelatedRecipeID = _val;
	}
	else throw('RelatedRecipeID must be an integer greater than zero.');
}

	
	/*service calls*/
	this.loadByID = function(ID, bLoadDeep)
		{
			
						var validation_errors = '';
			
						if(typeof(ID) == 'undefined' || ID == null)
			{
				validation_errors += "ID is required.\n";
			}


			
			if(validation_errors != "")
			{
				throw(validation_errors);
			}
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			
			request_vars += '&Action=' + X2O.X2ORequest.encrypt('LoadByPK');
request_vars += '&ID=' + X2O.X2ORequest.encrypt(ID);

			
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&LoadDeep=' + bLoadDeep.toString();
			}
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from loadByID: ' + error);
			}
		}
this.insertVO = function(bLoadDeep)
		{
						var validation_errors = '';
			
						if(typeof(_Amount) == 'undefined' || _Amount == null)
			{
				validation_errors += "_Amount is required.\n";
			}

			if(typeof(_RelatedIngredientID) == 'undefined' || _RelatedIngredientID == null)
			{
				validation_errors += "_RelatedIngredientID is required.\n";
			}

			if(typeof(_RelatedRecipeID) == 'undefined' || _RelatedRecipeID == null)
			{
				validation_errors += "_RelatedRecipeID is required.\n";
			}


			
			if(validation_errors != "")
			{
				throw(validation_errors);
			}
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			request_vars += '&Action=' + X2O.X2ORequest.encrypt('Insert');
			if(typeof(_Amount) != 'undefined' && _Amount != null)
{
	request_vars += '&Amount=' + X2O.X2ORequest.encrypt(_Amount);
}

if(typeof(_RelatedIngredientID) != 'undefined' && _RelatedIngredientID != null)
{
	request_vars += '&RelatedIngredientID=' + X2O.X2ORequest.encrypt(_RelatedIngredientID);
}

if(typeof(_RelatedRecipeID) != 'undefined' && _RelatedRecipeID != null)
{
	request_vars += '&RelatedRecipeID=' + X2O.X2ORequest.encrypt(_RelatedRecipeID);
}


			
			if(typeof(bLoadDeep) != 'undefined')
	{
		request_vars += '&ReturnDeepLoad=' + bLoadDeep.toString();
	}
			service_uri += request_vars;
			
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from insertVO: ' + error);
			}
		}
this.updateVO = function(bLoadDeep)
		{
						var validation_errors = '';
			
						if(typeof(_ID) == 'undefined' || _ID == null)
			{
				validation_errors += "_ID is required.\n";
			}

			if(typeof(_Amount) == 'undefined' || _Amount == null)
			{
				validation_errors += "_Amount is required.\n";
			}

			if(typeof(_RelatedIngredientID) == 'undefined' || _RelatedIngredientID == null)
			{
				validation_errors += "_RelatedIngredientID is required.\n";
			}

			if(typeof(_RelatedRecipeID) == 'undefined' || _RelatedRecipeID == null)
			{
				validation_errors += "_RelatedRecipeID is required.\n";
			}


			
			if(validation_errors != "")
			{
				throw(validation_errors);
			}
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			request_vars += '&Action=' + X2O.X2ORequest.encrypt('Update');
			if(typeof(_ID) != 'undefined' && _ID != null)
{
	request_vars += '&ID=' + X2O.X2ORequest.encrypt(_ID);
}

if(typeof(_Amount) != 'undefined' && _Amount != null)
{
	request_vars += '&Amount=' + X2O.X2ORequest.encrypt(_Amount);
}

if(typeof(_RelatedIngredientID) != 'undefined' && _RelatedIngredientID != null)
{
	request_vars += '&RelatedIngredientID=' + X2O.X2ORequest.encrypt(_RelatedIngredientID);
}

if(typeof(_RelatedRecipeID) != 'undefined' && _RelatedRecipeID != null)
{
	request_vars += '&RelatedRecipeID=' + X2O.X2ORequest.encrypt(_RelatedRecipeID);
}


			
			if(typeof(bLoadDeep) != 'undefined')
			{
				request_vars += '&ReturnDeepLoad=' + bLoadDeep.toString();
			}
			service_uri += request_vars;
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from updateVO: ' + error);
			}
		}
this.deleteVO = function()
		{
						var validation_errors = '';
			
						if(typeof(_ID) == 'undefined' || _ID == null)
			{
				validation_errors += "_ID is required.\n";
			}


			
			if(validation_errors != "")
			{
				throw(validation_errors);
			}
			
			var service_uri = X2O.X2OManager.hostURL + this.serviceName + ".x2o?jsid=" + this.getUID();

			var request_vars = '&x2o_token=' + X2O.X2ORequest.getEncryptedRequestToken();
			request_vars += '&Action=' + X2O.X2ORequest.encrypt('E2LS029SQ9V3');
			if(typeof(_ID) != 'undefined' && _ID != null)
{
	request_vars += '&ID=' + X2O.X2ORequest.encrypt(_ID);
}


			
			
			service_uri += request_vars;
			
			
			try
			{
				this.jsonRequester = new JSONscriptRequest(service_uri);
				this.jsonRequester.buildScriptTag();
				this.jsonRequester.addScriptTag(); //make the call
			}
			catch (error)
			{
				this.callFaultHandler('A fault was dispatched from deleteVO: ' + error);
			}
		}

	
	/*relationship objects*/
	this.RelatedIngredientItem = null;
this.RelatedRecipeItem = null;

	
	
	
	/*set internal members according to passed in constructor variables*/
	if(Amount != null)
{
	this.setAmount(Amount);
}
}
		

