I am facing this issue when clicking on import button. What is the best solution
clicked method is given below
void clicked()
{
#define.count1(10)
#AviFiles
System.Exception ex;
SLJmgAttendanceDataImport attendanceDataImport = new SLJmgAttendanceDataImport();
//ImportUtility.Import importObj;
ImportUtilityZKK.Import importObj;
int rowsAffected = 0;
Filename fileName;
SLTimeImportTable slTimeImportTable;
SLJmgAttendanceImport slAttendanceImport;
SLAIFTimesheetImport slAifAttendanceImport;
//super();
PRLPayrollParameters payrollParameters = PRLPayrollParameters::find();
NoYes useOldEmployeeId = NoYes::No;
SysOperationProgress progress = new SysOperationProgress(1, true);
progress.setCaption("Attendance import is in progress");
progress.setAnimation(#AviUpdate);
progress.setTotal(#count1);
try
{
if ((PayrollPayCycleLookup.valueStr() != "" && PayrollPayPeriodLookup.value() != 0 ) || MultiplePayCycleCheckBox.value())//&& JmgProfileId.valueStr() != "")
{
if (ImportFromUtility.value() == true)
{
useOldEmployeeId = payrollParameters.SLUseOldEmployeeIdOnImport;
slAifAttendanceImport = new SLAIFTimesheetImport();
slAifAttendanceImport.setMultiParms(PayrollPayPeriodLookup.value(),
fileName,
LocationBased.selection(),
MultiplePayCycleCheckBox.value(),
useOldEmployeeId);
slAifAttendanceImport.importAndParseAttendanceFromUtility();
rowsAffected = slAifAttendanceImport.transferImportTableIntoExcelData();
info(strFmt("%1 records imported Successfully!", rowsAffected));
/*
importObj = new ImportUtilityZKK.Import();
fileName = importObj.ReadImportConfig(curext(), sessionId(), curUserId());
if (fileName != "")
{
delete_from slTimeImportTable
where slTimeImportTable.UserId == curUserId()
|| slTimeImportTable.SessionId == sessionId();
//where slTimeImportTable.SessionId == sessionId();
progress.setCount(10);
importObj.ParseAttendanceFile();
//rowsAffected =importObj.InsertIntoAX(PayrollPayPeriodLookup.value());
rowsAffected = SLAIFTimesheetImport::ImportAttendance(PayrollPayPeriodLookup.value(), fileName, LocationBased.selection(), curUserId(), MultiplePayCycleCheckBox.value(), payrollParameters.SLUseOldEmployeeIdOnImport);
delete_from slTimeImportTable
where slTimeImportTable.UserId == curUserId()
|| slTimeImportTable.SessionId == sessionId();
info(strFmt("%1 records imported Successfully!", rowsAffected));
}
else
{
info("Failed to import records!");
}
*/
}
else
{
attendanceDataImport.parmFileName(SLJmgAttendanceImportFile.Filename);
attendanceDataImport.parmAttendanceFileInfo(SLJmgAttendanceImportFile);
attendanceDataImport.parmPayPeriod(SLJmgAttendanceImportFile.PayPeriod);
//
attendanceDataImport.parmLocationBased(LocationBased.selection());
////
attendanceDataImport.parmMultiplePayCycle(MultiplePayCycleCheckBox.value());
attendanceDataImport.run();
//super();
}
}
}
catch(Exception::Info)
{
ex = CLRInterop::getLastException();
info(ex.ToString());
}
//SLJmgAttendanceExcelData_ds.executeQuery();
//element.updateDesign();
}