Friday, 23 September 2016

Run base batch framework SendmailBatch

 Run base batch framework SendmailBatch

//Class Declaration the  class should Extend RunBaseBatch

class sendmailBatch extends RunBaseBatch
{
    Name                name;
    DialogField         dialogfield;

    #define.CurrentVersion(1)
    #define.CurrentList(1)
    #define.Version(1)
    #define.ImageSysTestProjcet(1)
    #define.MainBalance(1)
    #localmacro.CurrentList
   


        MainBalance
    #endmacro

}

the method must be overloaded in situations where a class must be selectable for a batchJournal

public boolean conGoBatchJournal()
{
    return true;
}


This  is used to populate/add the fields to Dialog

public  Object dialog()
{
    DialogRunbase    dialog =super();
    #resAppl

    dialog.addImage(#ImageSysTestProjcet);
    //dialogfield = dialog.addFieldValue(extendedTypeStr(name),MainBalance);


    return dialog;
}


This  will get the  Values form the  dialog a used to populate into Fields


public boolean GetfromDialog()
{
    mainBalance = dialogfield.value();

    return super();

}

This is  used to initialize any  variables


public  boolean init()
{
    return true;
}

Constructer

protected void new()
{
    super();
}


public container pack()
{


    return [#currentVersion,#CurrentList];
}


public void Run()
{
    SysMailer  sysmailer;
    EmployeeTable       employeeTable;
    QueryRun                qr;

    str                 mailMessage;

    InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
    permission.assert();
    try
    {
        sysmailer = new SysMailer();
        employeeTable = qr.getNo(1);

        while select  employeeTable where employeeTable.Name>= name
        {
            mailMessage =strFmt("Dear Customer, your balancein in the is%1.please call us for further query",
            employeeTable.Age);

            //sysmailer.quickSend("",
            //employeeTable.Age,"Account Age",
            //mailMessage);
            //
            info("notification Mail sent");
        }
    }
    //{
        catch(Exception::Error)
        {
            info("Error due to maill configuration.chcek and run again");
        }

    }



public boolean validate(Object _CalledFrom = null)
{

    //if(name <=0)

    return checkFailed("Error!invaild value in minimun balance field");

    return true;
}

static ClassDescription Description()
{
    return "send mail Batch";
}



server static sendmailBatch construct()
{
    return new sendmailBatch();
}


static void Main(Args args)
{
    sendmailBatch       sendmailBatch;
    sendmailBatch = sendmailBatch::construct();
    if(sendmailBatch.prompt())
        sendmailBatch.run();

}