number etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
number etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

23 Aralık 2015 Çarşamba

Axapta - Add date and time to XPO export dialog form

With this feature XPO files will be version controlled. I got this useful for backup code from Eren Polat .

Add these code parts to SysExportDialog forms methods:

classDeclaration:

str                     sDate, sTime, sDateTime;
str                     sMilliSeconds;
init:

    sMilliSeconds           = int2str(winApi::getTickCount());
    sDate                   = int2str(year(today())) + strReplace(num2str(mthofyr(today()),2,0,0,0), ' ', '0') + strReplace(num2str(dayofmth(today()),2,0,0,0), ' ', '0');
    sTime                   = strfmt("%1:%2", time2str(timeNow(),1,1), substr(sMilliSeconds, strlen(sMilliSeconds)-2,2));
    sTime                   = strReplace(sTime,":","");
    sDateTime               = strfmt("_%1%2",sDate,sTime);


run:
    //element.updateBox(fileNameNext(strfmt('%1%2_%3%4', filePath, preFix, treeNode.treeNodeName(), #xpo)));
    element.updateBox(fileNameNext(strfmt('%1%2_%3%4%5', filePath, preFix, treeNode.treeNodeName(), sDateTime, #xpo)));

5 Ağustos 2015 Çarşamba

AX 2009 - Consume web service with TC ID number test sample

I rewrite sample which I wrote for 2012. When I write the service I used Microsoft'un white page about consume web services in 2009. White page written for a web service which is not avaliable than but anyway worked.

First run AOT->References->Add service reference:

Write https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL to WSDL URL field.

I wrote TCSorgula to .NET code namespace field. I left reference name field with default written TCSorgula value.

After I wrote this method:

public server static boolean Sorgula(Int64 _TCID,str _name,str _surname, int _birthDate, boolean _interActive = false)
{
    TCSorgula.KPSPublicSoapClient  cl;
    boolean ret;
    System.Exception                      ex;

    str st;
    ;
    try
    {
        new InteropPermission(InteropKind::ClrInterop).assert();
        cl = new TCSorgula.KPSPublicSoapClient("KPSPublicSoap");
        ret = cl.TCKimlikNoDogrula(_TCID,_name,_surname,_dogumYili);
        CodeAccessPermission::revertAssert();
    }
    catch(Exception::CLRError)
    {
        exceptionTextFallThrough();
    }
    if (_interActive)
    {
        if (ret)
            info("TC ID verified!..");
        else
            warning("Failed TC ID verification!..");
    }
    return ret;
}



My job for run code:

static void TCKimlikTest(Args _args)
{
    ;
    TCKimlik::Sorgula(11111111111,"METİN","EMRE",1911,true);
}


 
 TC ID verification service returns false when name or birthdate is wrong in case invalid ID strangely run exception. I was catching this case in AX 2012 with search "T.C. Kimlik No alanına girdiğiniz değer geçerli bir T.C. Kimlik Numarası değildir" value in return error string. Unfortunately I failed this with 2009. So I can just catch correct ID or invalid ID/failed service.

If VS doesn't installed you can install .NET framework SDK.

2 Aralık 2011 Cuma

AXAPTA another way to get number sequence at create record with code

    ExtendedTypeId              id  = TypeID2ExtendedTypeId(TypeId(SMAServiceObjectId));
    NumberSeq                   num = NumberSeq::newGetNum(NumberSequenceReference::find(id));
    ;
...
...
    SMAServiceObjectTable.ServiceObjectId     = num.num();

30 Kasım 2011 Çarşamba

AXAPTA create sequential number

There is "Number Sequence class" for creating numbers for Axapta tables. But if you just want to create a "next number" function for just a string? Like "AB0001"->"AB0002". There isn't any built-in function in Axapta for that or I couldn't find. This is my number generator function:

Static str AutoNum(str Num)
{
    int i;
    int bas;
    str b;
    ;
    for (i=StrLen(num);i>=1;i--)
    {
        b=SubStr(num,i,1);
        if (b<"0" || b>"9")
        {
            bas=i+1;
            Break;
        }
        if (i==1)
            bas=1;
    }
    num=StrReplace(SubStr(num,1,bas-1)+
    Num2Str(Str2Num( SubStr(num,bas,StrLen(num) - bas + 1) )+1,
        StrLen(num) - bas + 1,0,1,0)," ","0");
    Return num;
}