[
SysEntryPointAttribute(true),
AifCollectionTypeAttribute(“_hrOnBoardingDependentContractList”,Types::Class,classStr(FCC_HROnBoardingDependentContract)),
AifCollectionTypeAttribute(“return”,Types::String),
AifCollectionTypeAttribute(“_update”,Types::Integer)
]
public str createUpdateDependentEmpList(List _hrOnBoardingDependentContractList)
{
DirPartyRelationship dirPartyRelationShip;
NoYes noyes;
HcmPersonPrivateDetails personPrivateDetails;
RecId person,recid,person1;
dirRelationshipTypeId dirRelationshipTypeId;
HcmWorker hcmWorkerLocal;
DirPersonName dirPersonName;
DirSystemRelationshipType dirSystemRelationshipType;
HcmIdentificationType identificationType;
RecId newPartyRecId;
str msg;
HcmWorker hcmWorker;
DirPerson dirPerson;
DirPersonName dirPersonNameLocal;
DirPartyTable dirPartyTable;
FirstName firstName;
MiddleName middleName;
LastName lastName;
FCC_HROnBoardingDependentContract dependentContract;
ListEnumerator listEnum = _hrOnBoardingDependentContractList.getEnumerator();
try
{
ttsBegin;
if (!_hrOnBoardingDependentContractList.empty())
{
while (listEnum.moveNext())
{
dependentContract = listEnum.current();
if (dependentContract)
{
while select dirPartyTable
join dirPerson
where dirPartyTable.RecId == dirPerson.RecId
join dirPersonNameLocal
where dirPerson.RecId == dirPersonNameLocal.Person
join hcmWorker
where dirPerson.RecId == hcmWorker.Person
&& hcmWorker.PersonnelNumber == dependentContract.parmDependentEmployee()
{
firstName = dirPersonNameLocal.FirstName;
middleName = dirPersonNameLocal.MiddleName;
lastName = dirPersonNameLocal.LastName;
}
hcmWorkerLocal = HcmWorker::findByPersonnelNumber(dependentContract.parmPersonnelNumber());
person = hcmWorkerLocal.Person;
recid = hcmWorkerLocal.RecId;
select dirPersonName
where dirPersonName.FirstName == firstName;
if(!dirPersonName)
{
dirPersonName.FirstName = firstName;
dirPersonName.MiddleName = middleName;
dirPersonName.LastName = lastName;
newPartyRecId = HcmPersonalContacts::createPersonContact(dirPersonName,person);
dirRelationshipTypeId = DirRelationshipTypeTable::FCC_findByTypeId(dependentContract.parmRelationShipType()).RelationshipTypeId;
DirPartyRelationship = DirPartyRelationship::find(dirRelationshipTypeId, Person, newPartyRecId, true);
if (!DirPartyRelationship)
{
select forUpdate DirPartyRelationship
where DirPartyRelationship.ChildParty == newPartyRecId
&& DirPartyRelationship.ParentParty == Person;
ttsBegin;
DirPartyRelationship.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
DirPartyRelationship.RelationshipTypeId = DirRelationshipTypeTable::findBySystemType(str2enum(DirSystemRelationshipType , dependentContract.parmRelationShipType())).RelationshipTypeId;
DirPartyRelationship.update();
ttsCommit;
}
personPrivateDetails.Person = dirPersonName.Person;
personPrivateDetails.FCC_RelativeInEPG = NoYes::Yes;
personPrivateDetails.FCC_IsRelativeInEPG = dependentContract.parmDependentEmployee();
personPrivateDetails.insert();
msg =’successfully : Inserted’;
}
else
{
select forUpdate dirPersonName
where dirPersonName.FirstName == firstName;
dirPersonName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
ttsBegin;
dirPersonName.FirstName = firstName;
dirPersonName.MiddleName = middleName;
dirPersonName.LastName = lastName;
dirPersonName.update();
ttsCommit;
newPartyRecId = HcmPersonalContacts::createPersonContact(dirPersonName,person);
dirRelationshipTypeId = DirRelationshipTypeTable::FCC_findByTypeId(dependentContract.parmRelationShipType()).RelationshipTypeId;
DirPartyRelationship = DirPartyRelationship::find(dirRelationshipTypeId, Person, newPartyRecId, true);
if (!DirPartyRelationship)
{
select forUpdate DirPartyRelationship
where DirPartyRelationship.ChildParty == newPartyRecId
&& DirPartyRelationship.ParentParty == Person;
ttsBegin;
DirPartyRelationship.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
DirPartyRelationship.RelationshipTypeId = DirRelationshipTypeTable::findBySystemType(str2enum(DirSystemRelationshipType , dependentContract.parmRelationShipType())).RelationshipTypeId;
DirPartyRelationship.update();
ttsCommit;
}
select forUpdate personPrivateDetails
where personPrivateDetails.Person == dirPersonName.Person;
ttsBegin;
personPrivateDetails.Person = dirPersonName.Person;
personPrivateDetails.FCC_RelativeInEPG = NoYes::Yes;
personPrivateDetails.FCC_IsRelativeInEPG = dependentContract.parmDependentEmployee();
personPrivateDetails.update();
ttsCommit;
msg =’successfully : Updated’;
}
}
}
}
else
{
throw error(“Error:Empty contract”);
}
ttsCommit;
}
catch
{
msg = infolog.text(infologLine());
infolog.clear();
}
return msg;
}
SysEntryPointAttribute(true),
AifCollectionTypeAttribute(“_hrOnBoardingDependentContractList”,Types::Class,classStr(FCC_HROnBoardingDependentContract)),
AifCollectionTypeAttribute(“return”,Types::String),
AifCollectionTypeAttribute(“_update”,Types::Integer)
]
public str createUpdateDependentEmpList(List _hrOnBoardingDependentContractList)
{
DirPartyRelationship dirPartyRelationShip;
NoYes noyes;
HcmPersonPrivateDetails personPrivateDetails;
RecId person,recid,person1;
dirRelationshipTypeId dirRelationshipTypeId;
HcmWorker hcmWorkerLocal;
DirPersonName dirPersonName;
DirSystemRelationshipType dirSystemRelationshipType;
HcmIdentificationType identificationType;
RecId newPartyRecId;
str msg;
HcmWorker hcmWorker;
DirPerson dirPerson;
DirPersonName dirPersonNameLocal;
DirPartyTable dirPartyTable;
FirstName firstName;
MiddleName middleName;
LastName lastName;
FCC_HROnBoardingDependentContract dependentContract;
ListEnumerator listEnum = _hrOnBoardingDependentContractList.getEnumerator();
try
{
ttsBegin;
if (!_hrOnBoardingDependentContractList.empty())
{
while (listEnum.moveNext())
{
dependentContract = listEnum.current();
if (dependentContract)
{
while select dirPartyTable
join dirPerson
where dirPartyTable.RecId == dirPerson.RecId
join dirPersonNameLocal
where dirPerson.RecId == dirPersonNameLocal.Person
join hcmWorker
where dirPerson.RecId == hcmWorker.Person
&& hcmWorker.PersonnelNumber == dependentContract.parmDependentEmployee()
{
firstName = dirPersonNameLocal.FirstName;
middleName = dirPersonNameLocal.MiddleName;
lastName = dirPersonNameLocal.LastName;
}
hcmWorkerLocal = HcmWorker::findByPersonnelNumber(dependentContract.parmPersonnelNumber());
person = hcmWorkerLocal.Person;
recid = hcmWorkerLocal.RecId;
select dirPersonName
where dirPersonName.FirstName == firstName;
if(!dirPersonName)
{
dirPersonName.FirstName = firstName;
dirPersonName.MiddleName = middleName;
dirPersonName.LastName = lastName;
newPartyRecId = HcmPersonalContacts::createPersonContact(dirPersonName,person);
dirRelationshipTypeId = DirRelationshipTypeTable::FCC_findByTypeId(dependentContract.parmRelationShipType()).RelationshipTypeId;
DirPartyRelationship = DirPartyRelationship::find(dirRelationshipTypeId, Person, newPartyRecId, true);
if (!DirPartyRelationship)
{
select forUpdate DirPartyRelationship
where DirPartyRelationship.ChildParty == newPartyRecId
&& DirPartyRelationship.ParentParty == Person;
ttsBegin;
DirPartyRelationship.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
DirPartyRelationship.RelationshipTypeId = DirRelationshipTypeTable::findBySystemType(str2enum(DirSystemRelationshipType , dependentContract.parmRelationShipType())).RelationshipTypeId;
DirPartyRelationship.update();
ttsCommit;
}
personPrivateDetails.Person = dirPersonName.Person;
personPrivateDetails.FCC_RelativeInEPG = NoYes::Yes;
personPrivateDetails.FCC_IsRelativeInEPG = dependentContract.parmDependentEmployee();
personPrivateDetails.insert();
msg =’successfully : Inserted’;
}
else
{
select forUpdate dirPersonName
where dirPersonName.FirstName == firstName;
dirPersonName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
ttsBegin;
dirPersonName.FirstName = firstName;
dirPersonName.MiddleName = middleName;
dirPersonName.LastName = lastName;
dirPersonName.update();
ttsCommit;
newPartyRecId = HcmPersonalContacts::createPersonContact(dirPersonName,person);
dirRelationshipTypeId = DirRelationshipTypeTable::FCC_findByTypeId(dependentContract.parmRelationShipType()).RelationshipTypeId;
DirPartyRelationship = DirPartyRelationship::find(dirRelationshipTypeId, Person, newPartyRecId, true);
if (!DirPartyRelationship)
{
select forUpdate DirPartyRelationship
where DirPartyRelationship.ChildParty == newPartyRecId
&& DirPartyRelationship.ParentParty == Person;
ttsBegin;
DirPartyRelationship.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
DirPartyRelationship.RelationshipTypeId = DirRelationshipTypeTable::findBySystemType(str2enum(DirSystemRelationshipType , dependentContract.parmRelationShipType())).RelationshipTypeId;
DirPartyRelationship.update();
ttsCommit;
}
select forUpdate personPrivateDetails
where personPrivateDetails.Person == dirPersonName.Person;
ttsBegin;
personPrivateDetails.Person = dirPersonName.Person;
personPrivateDetails.FCC_RelativeInEPG = NoYes::Yes;
personPrivateDetails.FCC_IsRelativeInEPG = dependentContract.parmDependentEmployee();
personPrivateDetails.update();
ttsCommit;
msg =’successfully : Updated’;
}
}
}
}
else
{
throw error(“Error:Empty contract”);
}
ttsCommit;
}
catch
{
msg = infolog.text(infologLine());
infolog.clear();
}
return msg;
}
No comments:
Post a Comment