if(typeof(X2O.X2OBaseItem) == 'undefined')
{
	throw('Cannot use this file unless you have included Base.js');
}
X2O.IngredientCollectionVO = function(){};
X2O.IngredientCollectionVO.Inherits(X2O.X2OBaseCollection);
	X2O.IngredientCollectionVO = function()
	{
		this.Inherits(X2O.X2OBaseCollection,'X2O.IngredientCollectionVO', 'X2O.IngredientVO', 'Ingredients');
		
		/*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);
			}
		}


	}
X2O.IngredientVO = function(){};
X2O.IngredientVO.Inherits(X2O.X2OBaseItem);	
X2O.IngredientVO = function(Name)
{
	/*private vars*/
	var _ID;
var _Name;

	
	/*checks for empty constructor/missing args*/
		if(typeof(Name) == 'undefined')
	{
		Name = null;
	}

	
	this.Inherits(X2O.X2OBaseItem, 'X2O.IngredientVO', 'Ingredients',{'RelatedRecipeIngredientsCollection': 'X2O.RecipeIngredientCollectionVO'});
		
	
	/*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.getName= function() { return _Name; }
this.setName = function(_val)
{
		if(_val == null)
	{
		throw('Name is required.');
	}
	
	if(typeof(_val) == 'string')
	{
		if(_val.length <= 255)
		{
			_Name = _val;
		}
		else throw('Name cannot be longer than 255 characters.');
	}
	else throw('Cannot set Name to a non-string value.');
}

	
	/*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(_Name) == 'undefined' || _Name == null)
			{
				validation_errors += "_Name 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(_Name) != 'undefined' && _Name != null)
{
	request_vars += '&Name=' + X2O.X2ORequest.encrypt(_Name);
}


			
			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(_Name) == 'undefined' || _Name == null)
			{
				validation_errors += "_Name 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(_Name) != 'undefined' && _Name != null)
{
	request_vars += '&Name=' + X2O.X2ORequest.encrypt(_Name);
}


			
			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.RelatedRecipeIngredientsCollection = null;

	
	/*set internal members according to passed in constructor variables*/
	if(Name != null)
{
	this.setName(Name);
}
}
		
