Blog Listem

5 Kasım 2013 Salı

AXAPTA - Tabloda password field

Bu konuyu yazarken Greg on Dynamics AX blogundan yararlandım.

Öncelikle tablomuzda tipi container olan bir password field açıyor ve extended data tipini CryptoBlob olarak seçiyoruz.

Password alanı için edit metodumuz:

edit Password edtPassword(boolean _set = false, Password _pwd = '')
{
    CryptoBlob cryptoBlob = connull();
    ;
    if (_set)
    {
        this.Password = WinapiServer::cryptProtectData(str2cryptoblob(_pwd));
    }
    return (this.Password == connull()) ? '' : 'xxxxxxxx';
}


Kodla passwordü okumak için metodumuz:
Password getPassword()
{
    CryptoBlob cryptoBlob;
    ;
    cryptoBlob = this.Password;
    return (cryptoBlob == connull()) ? '' :
        cryptoblob2str(WinapiServer::cryptUnProtectData(cryptoBlob));
}


Kodla passwordü yazmak için metodumuz:

void setPassword(Password _pwd = '')
{
    CryptoBlob cryptoBlob = connull();
    ;
    this.Password = WinapiServer::cryptProtectData(str2cryptoblob(_pwd));
}

Ekranda okuturken ilgili kontrolün PasswordStyle değerini Yes yapmayı unutmayın.

Hiç yorum yok:

Yorum Gönder