Advertisement
ramkesheoran

StartUpLogin Class

Dec 12th, 2011
2,904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XPP 1.84 KB | None | 0 0
  1. class StartUpLogin extends RunBase
  2. {
  3.     SMTPPassword            SMTPPassword;
  4.     SMTPUserName            SMTPUserName;
  5.     dialogfield              dlgUserName,dlgPassword;
  6.     DialogRunbase  dialog;
  7.     int i;
  8.     #define.CurrentVersion(1)
  9.     #define.Version1(1)
  10.     #localmacro.CurrentList
  11.          SMTPPassword,
  12.          SMTPUserName
  13.     #endmacro
  14. }
  15. Object dialog()
  16. {
  17.     ;
  18.      dialog = super();
  19.      dlgUserName = dialog.addField(typeId(SMTPUserName),'User Name');
  20.      dlgPassword = dialog.addField(typeId(SMTPPassword),'Password');//.passwordStyle(true);
  21.      return dialog;
  22. }
  23. public boolean  getFromDialog()
  24. {
  25.     SysUserInfo SysUserInfo;
  26.     ;
  27.     SMTPUserName = dlgUserName.value();
  28.     SMTPPassword =  dlgPassword.value();
  29.     select * from SysUserInfo where SysUserInfo.Password == SMTPPassword
  30.                                     && SysUserInfo.Id == curuserid();
  31.  
  32.    i++;
  33.    if(!SysUserInfo && i<3)
  34.    throw error("User not find");
  35.    if(i>=3)
  36.    this.shutdownAxapta();
  37.     return true;
  38. }
  39. public container pack()
  40. {
  41.     return [#CurrentVersion,#CurrentList];
  42. }
  43. public  void shutdownAxapta()
  44. {
  45.     SysGlobalCache cache = appl.globalCache();
  46.     info info;
  47.     ;
  48.     cache.set(classstr(info), identifierstr(Autologoff), true);
  49.     info=new info();
  50.     info.shutDown(true);
  51.     }
  52. void StartUpLoginMethod()
  53. {
  54.     StartUpLogin  StartUpLogin;
  55.     ;
  56.     StartUpLogin = new StartUpLogin();
  57.     if(StartUpLogin.prompt())
  58.     {
  59.  
  60.     }
  61.     else
  62.     {
  63.             this.shutdownAxapta();
  64.  
  65.     }
  66. }
  67. public boolean unpack(container packedClass)
  68. {
  69.     Version version = RunBase::getVersion(packedClass);
  70.     ;
  71.     switch (version)
  72.     {
  73.         case #CurrentVersion:
  74.             [version,#CurrentList] = packedClass;
  75.             break;
  76.         default:
  77.             return false;
  78.     }
  79.     return true;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement