Scenario 8: 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 Scenario8(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-2");
	//Add 2 freeze after first week;
	paymentPlan->Add(1, 2, true);
	//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