Monday, September 30, 2013

KeyReplacement

static void Job1(Args _args)
{
    VendTable vendTable;
    DirPartyTable dirpartyTable;
    int myCount;
    DirPartyPostalAddressView   addressView;
    DirPartyLocation dirpartyLocation;
    str 100 strStreet;
    LogisticsLocation logisticsLocation;
    LogisticsPostalAddress logisticsPostalAddress;
    RecId   recID;

    /*
    while select forupdate * from dirPartyTable
        where dirpartyTable.Name == 'Admin UnemploymentCompensation'
    {
        myCount++;
    }
    info(strFmt("%1", myCount));

    changeCompany('LOG')
    {
    strStreet = 'State of Connecticut; Dept. of Labor # 4713 PO Box 2905';
    select * from addressView
       where addressView.Street == strLRTrim(strStreet);
    info(strFmt("%1", addressView.RecId));
    }
      */
changeCompany('VER')
    {
        //Admin UnemploymentCompensation
        while select forupdate * from dirPartyTable
            where dirpartyTable.Name == 'Admin UnemploymentCompensation'
        {
            if(dirpartyTable.RecId)
            {
               while select forupdate dirpartyLocation
                    where dirpartyLocation.Party == dirpartyTable.RecId
               {
                   
                   logisticsLocation = LogisticsLocation::find(dirpartyLocation.Location, true);
                   logisticsPostalAddress = LogisticsPostalAddress::findByLocation(logisticsLocation.RecId, true);
                     
                    ttsBegin;
                    logisticsPostalAddress.doDelete();
                    logisticsLocation.doDelete();
                    dirpartyLocation.doDelete();
                 
                    ttsCommit;
                 
               }
               
               select forupdate * from vendTable
               where vendTable.Party == dirpartyTable.RecId;
                if(vendTable.RecId)
                {
                    ttsBegin;
                    vendTable.doDelete();
                    dirpartyTable.delete();

                    ttsCommit;
                }
               
            }
        }

    }


}

No comments:

Post a Comment