public int GetSingleTable(ErpTaskStep step, int actionId, DateTime date)
        {
            AxBaseException result = null;

            try
            {
                if (date == DateTime.MaxValue)
                {
                    DataWriter.TruncateSingleTable(step.DbTable);
                }
                result = TaskExecute.ExecuteTask(actionId, step, date);
            }
            catch (Exception e)
            {
                result = new AxBaseException {
                    ApplicationException = e
                };
            }
            finally
            {
                OnTaskCompleted(null, new ErpTaskCompletedArgs {
                    Exception = result, ActionId = actionId, Status = result == null ? 2 : 3
                });
            }
            return(actionId);
        }
        //public string GetDBScript(string entity)
        //{
        //    return ScriptGeneratorModule.GenerateScript(entity);
        //}
        public int TaskList(int actionId, ErpTask erpTasks, DateTime date, int?no_of_paralle_processes)
        {
            AxBaseException result = null;

            try
            {
                //DataWriter.TruncateTables(erpTasks.truncate_items, erpTasks.truncate_sales_trans_dump, erpTasks.truncate_sales_trans_refresh, erpTasks.truncate_locations_and_vendors,
                //    erpTasks.truncate_lookup_info, erpTasks.truncate_bom, erpTasks.truncate_po_to, erpTasks.truncate_price, erpTasks.truncate_attribute_refresh);
                TaskExecute exec = new TaskExecute(erpTasks.Steps, no_of_paralle_processes.HasValue ? no_of_paralle_processes.Value : 1, actionId, date);
                exec.Execute();

                //foreach (var erpStep in erpTasks.Steps)
                //{
                //    ExecuteTask(actionId, erpStep, date); // possible to do some parallel processing.
                //}
            }
            catch (Exception e)
            {
                result = new AxBaseException {
                    ApplicationException = e
                };
            }
            finally
            {
                OnTaskCompleted(null, new ErpTaskCompletedArgs {
                    Exception = result, ActionId = actionId, Status = result == null ? 2 : 3
                });
            }
            return(actionId);
        }