/// <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); } }
/// <summary> /// Process - run batch (common function) /// </summary> /// <param name="data"></param> /// <returns></returns> public List <int?> RunBatch(doBatchProcess data) { List <int?> result = new List <int?>(); try { //using (TransactionScope t = new TransactionScope()) //{ result = base.RunBatch(data.BatchCode, data.BatchName, data.BatchDescription, data.BatchLastResult, data.BatchStatus, data.Total, data.Complete, data.Failed, data.BatchJobName, data.BatchDate, data.BatchUser, BatchStatus.C_BATCH_STATUS_FAILED, BatchStatus.C_BATCH_STATUS_PROCESSING, BatchStatus.C_BATCH_STATUS_SUCCEEDED, EventType.C_EVENT_TYPE_INFORMATION, LogMessage.C_LOG_NIGHT_BATCH_ERROR); //t.Complete(); // commit //} return(result); } catch (Exception) { throw; } }