[Form]
public class DTCreateRetailCustomerForm extends FormRun
{
/// <summary>
///
/// </summary>
public void closeOk()
{
super();
CustTable custTable;
NumberSeq numberSeq;
Name name = DTCustomerName.valueStr();
DirParty dirParty;
DirPartyPostalAddressView dirPartyPostalAddressView;
DirPartyContactInfoView dirPartyContactInfo,dirPartyContactInfoLoc;
CustParameters custParameters;
;
/* Marks the beginning of a transaction.
Necessary to utilize the method numRefCustAccount() */
ttsBegin;
custTable.initValue();
try
{
//CustTable
numberSeq = NumberSeq::newGetNum(CustParameters::numRefCustAccount());
custTable.AccountNum = numberSeq.num();
select CustGroup,DlvMode,TaxGroup from custParameters;
custTable.CustGroup = CustParameters.CustGroup;
custTable.DlvMode = CustParameters.DlvMode;
custTable.TaxGroup = CustParameters.TaxGroup;
custTable.insert(DirPartyType::Organization, name);
custTable.validateWrite();
dirParty = DirParty::constructFromCommon(custTable);
dirPartyPostalAddressView.LocationName ='';
dirPartyPostalAddressView.City ='';
dirPartyPostalAddressView.Street ='';
dirPartyPostalAddressView.StreetNumber ='';
dirPartyPostalAddressView.CountryRegionId ='PAK';
dirPartyPostalAddressView.State ='';
dirPartyPostalAddressView.IsPrimary = NoYes::Yes;
// Fill address
dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
dirPartyContactInfo.LocationName ='Email Address';
dirPartyContactInfo.Locator = DTCustomerEmail.valueStr();
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Email;
dirPartyContactInfo.IsPrimary = NoYes::Yes;
while select LocationName,Locator from dirPartyContactInfoLoc
where dirPartyContactInfoLoc.LocationName == 'Email Address'
{
if(dirPartyContactInfo.Locator == dirPartyContactInfoLoc.Locator)
{
throw Error('Email already exist');
}
else
{
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
}
}
dirPartyContactInfo.LocationName ='Mobile Number';
dirPartyContactInfo.Locator = DTCustomerPhone.valueStr();
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfo.IsPrimary = NoYes::Yes;
while select LocationName,Locator from dirPartyContactInfoLoc
where dirPartyContactInfoLoc.LocationName == 'Mobile Number'
{
if(dirPartyContactInfo.Locator == dirPartyContactInfoLoc.Locator)
{
throw Error('Mobile Number already exist');
}
else
{
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
}
}
// Marks the end of transaction.
ttsCommit;
}
}
}
[Form]
public class DTCreateRetailCustomerForm extends FormRun
{
/// <summary>
///
/// </summary>
public void closeOk()
{
super();
CustTable custTable;
NumberSeq numberSeq;
Name name = DTCustomerName.valueStr();
DirParty dirParty;
DirPartyPostalAddressView dirPartyPostalAddressView;
DirPartyContactInfoView dirPartyContactInfo;
;
/* Marks the beginning of a transaction.
Necessary to utilize the method numRefCustAccount() */
ttsBegin;
custTable.initValue();
try
{
//CustTable
numberSeq = NumberSeq::newGetNum(CustParameters::numRefCustAccount());
custTable.AccountNum = numberSeq.num();
custTable.CustGroup = CustParameters::find().CustGroup;
custTable.DlvMode = CustParameters::find().DlvMode;
custTable.PaymTermId = CustParameters::find().TaxGroup;
custTable.PaymMode ='CHEQUE-01';
custTable.insert(DirPartyType::Organization, name);
dirPartyContactInfo.LocationName ='Email Address';
dirPartyContactInfo.Locator = DTCustomerEmail.valueStr();
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Email;
dirPartyContactInfo.IsPrimary = NoYes::Yes;
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
dirPartyContactInfo.LocationName ='Mobile Number';
dirPartyContactInfo.Locator = DTCustomerPhone.valueStr();
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfo.IsPrimary = NoYes::Yes;
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
// Marks the end of transaction.
ttsCommit;
}
catch(Exception::Error)
{
ttsAbort;
throw Exception::Error;
}
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,963 Most Valuable Professional
nmaenpaa 101,156