Import multiple customer with multiple addresses and multiple purpose

Dear All

I have wrtitten this code to update multiple customer for multiple addresses by importing EXcel file into this code execution.

when we will open a particular customer details this code will assign same purpose for a every customer but how can i change this code to update different - different purpose for a single customer and multiple customer.

------------------------------------------------*-----------------------------------------------------

static

void

updateCustomerMultipleNewAddress(Args _args)

{

CommaIO csvFile;

LogisticsLocationRole logisticsLocationRole;

DirPartyLocationRole partyLocationRole;

DirPartyLocation location;

container

readCon;

counter icount,inserted;

Dialog dialog;

DialogField dfFileName;

DirPartyRecId partyRecId;

Name name;

DirPartyView dirpartyview;

CustAccount custAccount;

CustTable custtable;

FileName fileName;

DirPartyPostalAddressView addressView;

DirParty dirParty;

DirPartyTable dirPartyTable;

LogisticsPostalAddress address;

DirPartyAddressLocationRoleNames names;

inserted =

0

;

#File

dialog =

new Dialog(“Pick the file”

);

dfFileName = dialog.addField(

extendedTypeStr

(FileNameOpen));

dialog.filenameLookupFilter([

“All files”

, #AllFiles]);

if

(dialog.run())

{

filename = dfFileName.value();

}

csvFile =

new CommaIO(filename, ‘r’

);

if

(csvFile)

{

readCon = csvFile.read();

ttsbegin

;

while

(csvFile.status() == IO_Status::OK)

{

readCon = csvFile.read();

icount++;

if

(readCon)

{

name =

strUpr(conPeek(readCon,2

));

custAccount =

conPeek(readCon,1

);

custtable = CustTable::find(custAccount);

// Important logic

partyRecId = custtable.Party;

dirPartyTable = DirPartyTable::findRec(partyRecId ,

true

);

select

dirPartyTable join firstOnly location wheredirPartyTable.RecId == location.Party

join partyLocationRole where location.RecId == partyLocationRole.PartyLocation

join logisticsLocationRole where partyLocationRole.LocationRole == logisticsLocationRole.RecId;

address.CountryRegionId =

strUpr(strLRTrim(conPeek(readCon,3

)));

addressView.State =

strUpr(strLRTrim(conPeek(readCon,5

)));

address.ZipCode =

strUpr(strLRTrim(conPeek(readCon,4

)));

address.Stree