Scenario 6: Visual C++.NET

From Intrannuity

Jump to: navigation, search

Download Source File

#include "stdafx.h"
 
using namespace System;
using namespace System::Collections::Generic;
using namespace iBilling::Client;
 
int Scenario6(array<System::String ^> ^args)
{
	//Set up clients' settings;
	Dictionary<String^, Object^>^ config = gcnew Dictionary<String^, Object^>();
	config[SessionConnection::PROCESSOR_HOST] = "http://server.ibillingclient.org/ibilling/xmlhttps";
	config["debug"] = true;
	//Login;
	Session^ session = Session::Login(2000, "welcome", config);
	//Find payment plan;
	PaymentPlan^ paymentPlan = session->LoadPaymentPlan("cpp.pp-1");
	//Execute delete last 6 charges;
	paymentPlan->RemoveRange(5, 6);
	//Mark object for persistence;
	session->Save(paymentPlan);
	//Synchronize changes with the server;
	try{
		session->Synchronize();
	}
	catch(Exception^ ex){
		//Be sure to properly handle exception, this is just a sample solution;
		Console::WriteLine(ex->Message);
		return 0;
	}
	//Logout;
	session->Logout();
return 0;
}
Personal tools