Function

Functie : getProxyObject


private client static CLRObject getProxyObject(URL websiteUrl)
{
    URL serverUrl;
    CLRObject clrUserGroup;
    CLRObject clrCreds;
    CLRObject clrServerUrl;

    serverUrl = websiteUrl + #ServiceSuffix;
    clrServerUrl = CLRInterop::getObjectForAnyType(serverUrl);

    clrUserGroup = new CLRObject(#ServiceName);
    clrUserGroup.set_Url(clrServerUrl);

    clrCreds = CLRInterop::staticInvoke(#CredentialsCache, #DefaultCreds);
    clrUserGroup.set_Credentials(clrCreds);

    return clrUserGroup;
}

Function

Exemplu: creaza folder pe server


static void Job17(Args _args)
{
    str tempSubDirectory = 'c:\\t2'; //      \\\\172.72.72.78\\t\1
    InteropPermission permission;
    ;


        permission = new InteropPermission(InteropKind::ClrInterop);
        permission.assert();

        System.IO.Directory::CreateDirectory(tempSubDirectory);

        CodeAccessPermission::revertAssert();
}

Function

Functie: view file


public void viewFile()
{
    #WinApi
    #define.Command('cmd')
    #define.Notepad('/c notepad \%1')

;
    if (WinAPI::fileExists(this.fileName()))
        WinAPI::shellExecute(#Command,strfmt(#Notepad,this.fileName()),'',#ShellExeOpen,#SW_HIDE);
    else
        error(strfmt("@SYS19312", this.fileName()));
}

Exemplu

Exemplue: Jump ref


public static client void jumpRefProfileTable(DDT_ProfileID _profileID, Object _caller)
{
    Args    args;
    FormRun fr;
    DDT_ProfileTable profileTable = DDT_ProfileTable::find(_profileID);
    ;

    args = new Args(menuitemdisplaystr(DDT_ProfileTable));
    args.caller(_caller);

    fr = classfactory.formRunClass(args);
    if(fr)
    {
        fr.init();
        fr.run();
        fr.dataSource().findRecord(profileTable);
        fr.detach();
    }
}

Fără categorie

SalesFormLetter – nu facturez liniile cu valoare zero


protected boolean  createParmLine(SalesLine         _salesLineOrig,
                                  TradeLineRefId    _tableRef       = '')
{
    PurchParmLine   purchParmLine;
    SalesParmLine   localSalesParmLine;
    boolean         lineCreated = false;
    // <GIN>
    RealBase        factor;
    // </GIN>

    boolean         createLine;
    ;
    if (_salesLineOrig.RecId && this.checkCreateParmLine(_salesLineOrig))
    {
        this.interCompanyUpdateSalesPrice(_salesLineOrig);

        localSalesParmLine.clear();

        if (interCompanyParmId
        && !this.interCompanyParmSelectFromJournal())
        {
            localSalesParmLine.Closed = this.interCompanyParmLineClosed(_salesLineOrig);
            [localSalesParmLine.DeliverNow, localSalesParmLine.RemainBefore      , localSalesParmLine.RemainAfter]        = this.qtySales  (_salesLineOrig, this.interCompanyParmLineQty(_salesLineOrig));
            [localSalesParmLine.InventNow , localSalesParmLine.RemainBeforeInvent, localSalesParmLine.RemainAfterInvent]  = this.qtyInvent (_salesLineOrig, this.interCompanyParmLineQty(_salesLineOrig, true));
            salesLine.SalesDeliverNow = localSalesParmLine.DeliverNow;
            salesLine.setInventDeliverNow();
            if (localSalesParmLine.Closed)
            {
                localSalesParmLine.RemainAfter = 0;
                localSalesParmLine.setRemainAfterInvent();
            }
        }
        else
        {
            [localSalesParmLine.DeliverNow, localSalesParmLine.RemainBefore      , localSalesParmLine.RemainAfter      ]   = this.qtySales  (_salesLineOrig, naReal());
            [localSalesParmLine.InventNow , localSalesParmLine.RemainBeforeInvent, localSalesParmLine.RemainAfterInvent]   = this.qtyInvent (_salesLineOrig, naReal());

            if ((_salesLineOrig.DeliveryType == TradeLineDlvType::DropShip) && parmIdSynched)
            {
                purchParmLine = PurchParmLine::findInventTransId(parmIdSynched,_salesLineOrig.InventRefTransId);

                if (purchParmLine.Closed)
                {
                    localSalesParmLine.Closed = purchParmLine.Closed;
                    localSalesParmLine.RemainAfter = 0;
                    localSalesParmLine.setRemainAfterInvent();
                }

            }
        }

        // Kumon: Invoice layout - begin
        // For mexic invoice: don't show the sales lines with amount zero
        if(KUMParameters::useInvoiceLayouts() && (CompanyInfo::invoiceFormat() == KUMInvoiceFormat::Mexic))
        {
            createLine = ((localSalesParmLine.DeliverNow || (localSalesParmLine.RemainBefore && backorder)) && _salesLineOrig.LineAmount);
        }
        else
        {
            createLine = (localSalesParmLine.DeliverNow || (localSalesParmLine.RemainBefore && backorder));
        }

        // Delete original condition
        //  if (localSalesParmLine.DeliverNow || (localSalesParmLine.RemainBefore && backorder))
        if(createLine)
        // Kumon: Invoice layout - end

        {
            localSalesParmLine.ParmId     = salesParmUpdate.ParmId;
            localSalesParmLine.initFromSalesLine(_salesLineOrig);
            localSalesParmLine.setLineAmount(_salesLineOrig);
            localSalesParmLine.calcPackingUnitQty();
            localSalesParmLine.TableRefId = _tableRef;

            // <GIN>
            if (TaxParameters::checkTaxParameters_IN())
            {
                if (_salesLineOrig.SalesQty != 0)
                {
                    factor = _salesLineOrig.AssessableValue_IN / _salesLineOrig.SalesQty;
                    localSalesParmLine.AssessableValue_IN = factor * localSalesParmLine.DeliverNow;
                }
            }
            // </GIN>

//RecId is needed if salesParmSubLines is going to be created.
            localSalesParmLine.RecId  = systemSequence.reserveValues(1,tablenum(SalesParmLine));

            salesParmLineMap.insert(this.salesParmLineMapKey(localSalesParmLine.OrigSalesId,localSalesParmLine.InventTransId),localSalesParmLine);
            recordInsertSalesParmLine.add(localSalesParmLine);

            lineCreated = true;

            this.allowCreateParmTable(true);

            #if.never //#Speedtest
            if (speedExecute_Sales)
                speedExecute_Sales.timing(SpeedSalesTiming::ParmLineInsert, strfmt(salesParmLine.parmId, salesParmLine.itemId));
            #endif
        }
    }

    return lineCreated;
}

Fără categorie

Uncheck::TableSecurityPermission


static server void updateAllFromPartyId(DirPartyId _partyId)
{
    DirPartyTable             dirPartyTable;
    DirParty                  dirParty;
    ;
    unchecked(Uncheck::TableSecurityPermission)
    {
        ttsbegin;
        // Select DirPartyTable with pessimisticLock, this will act like a mutex
        select pessimisticLock firstonly dirPartyTable where dirPartyTable.PartyId == _partyId;

        if (dirPartyTable)
        {
            dirParty     = DirParty::constructFromPartyId(_partyId);
            if (dirParty)
            {
                dirParty.parmPartyId(_partyId);

                // Push info from Dirparty to rel tables other than DirParty.tableId
                dirParty.updateRelsFromDirparty();

                // push address info from DirParty to DirPartyAddressRelations/Address
                // Update primary addresses
                dirParty.updateAddressFromDirParty();
            }
        }
        ttscommit;
    }
}

Function

getSyncServiceDomainAccount


//
// This method will return the Synchronization Service
// Account information from the User
// table.  The returned value is in format
// <domain>\<alias> (or a blank value if
// there is no record)
//
public static str getSyncServiceDomainAccount()
{
    str accountInformation = ”;
    str domain;
    str alias;
    Map userMap;
    ;

    userMap = AxaptaUserManager::getSyncServiceUserDetails();

    if(!userMap.empty())
    {
        domain = userMap.lookup(#NetworkDomain);
        alias = userMap.lookup(#NetworkAlias);
        accountInformation =  domain + ‘\\’ + alias;
    }

    return accountInformation;
}

Function

JOB draft : verifica daca exista cont user in Active Directory


static void Job13(Args _args)
{
boolean             ret;
    int                 len;
    sid                 userSID;
    boolean             isValidUser = false;
    xAxaptaUserManager  axUsrManager;
    xAxaptaUserDetails  axUsrDetails;
    ;

    // Check if the alias and domain name specify an authenticated user.
      {
        // Instantiate AxaptaUserManager and get user’s details
        axUsrManager = new xAxaptaUserManager();
       // axUsrDetails = axUsrManager.getDomainUser(this.NetworkDomain, this.NetworkAlias);
          axUsrDetails = axUsrManager.getDomainUser(‘Kumon’, ‘liviu.stoica’);

        try
        {
            if(axUsrDetails && axUsrDetails.getUserCount() > 0)
            {
                userSID = axUsrDetails.getUserSid(0);
                if (userSID != ”)
                {
                    isValidUser = true;
                    //this.NetworkDomain = axUsrDetails.getUserDomain(0);
                }
            }
        }
        catch(Exception::Error)
        {
            len = infolog.line();
            if(len > 0)
            {
                infolog.clear(len – 1);
            }
        }
    }

    if (!isValidUser)
    {
        Box::stop(‘@SYS90055’);

      //  return false;
    }
    else
    {
     Box::stop(‘BUN’);
    }

   }

Fără categorie

getDomainMap


public static Map getDomainMap()
{
    str domain = ”;
    Map domainMap;
    container domains;
    str fqdn = ”;
    int i = 0;
    xAxaptaUserManager m = new xAxaptaUserManager();
    str netBIOSName = ”;
    int numberOfDomains = 0;
    ;

    //Create a map to hold the domain names.
    domainMap = new Map(Types::String, Types::String);

    //Iterate through the domains and build the map.
    domains = m.enumerateDomains(”);
    numberOfDomains = conlen(domains);
    for (i = 1; i <= numberOfDomains; i++)
    {
        domain = conpeek(domains, i);

        if (domain != ”)
        {
            netBIOSName = SRSNameTranslator::fqdn2NetBIOS(domain);

            //Add the domain names to the map.
            if (netBIOSName != ”)
                domainMap.insert(domain, netBIOSName);
        }
    }

    return domainMap;
}