Example of Process Class
Snippet of a process class is as follows
/********************************************************
*Project Name : VAT
*Class Name : SalaryIncrement
*Purpose : apply 10% increment to all employee on basic salary
*Class Used : SvrProcess
*Chronological Development
*Raghu 03-Nov-2014
******************************************************/
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VAdvantage.DataBase;
using VAdvantage.Logging;
using VAdvantage.ProcessEngine;
using VAdvantage.SqlExec;
using VAdvantage.Utility;
using ViennaAdvantageSvc.Model;
namespace VATSvc.Process
{
publicclassSalaryIncrement : SvrProcess
{
int _hra = 0;
string grade = "";
///<summary>
/// Prepare - e.g., get Parameters.
///</summary>
protectedoverridevoid Prepare()
{
ProcessInfoParameter[] para = GetParameter();
foreach (ProcessInfoParameter element in para)
{
String name = element.GetParameterName();
if (element.GetParameter() == null)
{
;
}
if (name.Equals("VAT_HRA"))
_hra = element.GetParameterAsInt();
elseif (name.Equals("VAT_EmployeeGrade"))
{
grade = Convert.ToString(element.GetParameter());
}
else
log.Log(Level.SEVERE, "Unknown Parameter: " + name);
}
}
///<summary>
/// Perrform process.
///</summary>
///<returns>Message to be translated</returns>
protectedoverridestring DoIt()
{
http://log.Info ("Increment on HRA=" + _hra);
int amount = _hra + _hra / 100 * 10;
//By sql query
string sql = "";
string result = "";
try
{
sql = "UPDATE VAT_EMPLOYEE SET vat_hra=" + amount + " WHERE VAT_EMPLOYEEGRADE='" + grade + "'";
int outPut = DB.ExecuteQuery(sql, null, null);
if (outPut > 0)
result = "Record updated sucessfully";
else
result = "Error while saving the record";
}
catch (Exception e)
{
log.Log(Level.SEVERE, sql, e);
}
return result;
}
}
}
If you want to add Process class in module project then you have to add this class in ‘ViennaAdvantageSvc
A process class must inherit from SvrProcess and contain two Override functions Prepare and DoIt