/// <summary> /// Process - execute all batch process /// </summary> public void RunProcessAll() { ILogHandler handLog = ServiceContainer.GetService <ILogHandler>() as ILogHandler; handLog.WriteWindowLog(EventType.C_EVENT_TYPE_INFORMATION, LogMessage.C_LOG_NIGHT_BATCH_START, EventID.C_EVENT_ID_BATCH_START); List <GetBatchProcessRunAll_Result> list = new List <GetBatchProcessRunAll_Result>(); List <BatchProcessRunAll_Result> jobList = new List <BatchProcessRunAll_Result>(); list = base.GetBatchProcessRunAll(); DateTime?batchDate = DateTime.Now; foreach (GetBatchProcessRunAll_Result p in list) { BatchProcessRunAll_Result r = CommonUtil.CloneObject <GetBatchProcessRunAll_Result, BatchProcessRunAll_Result>(p); r.BatchUser = CommonUtil.dsTransData.dtUserData.EmpNo; r.BatchDate = batchDate; jobList.Add(r); // Narupon 10-Sep-2012 base.UpdateBatchResult( p.BatchCode , BatchStatus.C_BATCH_STATUS_BE_PROCESSED , null , 0 , 0 , 0 , CommonUtil.dsTransData.dtUserData.EmpNo); } BatchWriteLogDel callback = new BatchWriteLogDel(this.BatchUpdateResult); BatchProcessUtil.RunBatchAll(jobList, callback, DateTime.Now); }
/// <summary> /// Process - execute process (common function) /// </summary> /// <param name="doBatchProcess"></param> public void RunProcess(doBatchProcess doBatchProcess) { try { ILogHandler handLog = ServiceContainer.GetService <ILogHandler>() as ILogHandler; handLog.WriteWindowLog(EventType.C_EVENT_TYPE_INFORMATION , "Night batch of " + doBatchProcess.BatchName + " is started", EventID.C_EVENT_ID_BATCH_START); base.UpdateBatchResult( doBatchProcess.BatchCode , BatchStatus.C_BATCH_STATUS_PROCESSING , null , 0 , 0 , 0 , doBatchProcess.BatchUser); BatchCallBackDel callback = new BatchCallBackDel(this.BatchUpdateStatus); BatchProcessRunAll_Result activeBatch = CommonUtil.CloneObject <doBatchProcess, BatchProcessRunAll_Result>(doBatchProcess); BatchProcessUtil.RunProcess(activeBatch, callback); } catch (Exception ex) { ILogHandler handLog = ServiceContainer.GetService <ILogHandler>() as ILogHandler; handLog.WriteWindowLog(EventType.C_EVENT_TYPE_INFORMATION , "Night batch of " + doBatchProcess.BatchName + " is Error", EventID.C_EVENT_ID_BATCH_ERROR); base.UpdateBatchResult( doBatchProcess.BatchCode , BatchStatus.C_BATCH_STATUS_FAILED , null , 0 , 0 , 0 , doBatchProcess.BatchUser); base.InsertTbt_BatchLog(doBatchProcess.BatchDate, doBatchProcess.BatchCode, ex.Message, FlagType.C_FLAG_ON, doBatchProcess.BatchUser); } }