private scheduledtask convertToDomainObject(ScheduledTaskDto taskModel) { scheduledtask task = null; if (taskModel is CustomExportOrderTaskDto) { task = Mapper.Map <customexportordertask>(taskModel as CustomExportOrderTaskDto); } else if (taskModel is GeneratePoTaskDto) { task = Mapper.Map <generatepotask>(taskModel as GeneratePoTaskDto); } else if (taskModel is MarketplaceInventoryTaskDto) { task = Mapper.Map <marketplaceinventorytask>(taskModel as MarketplaceInventoryTaskDto); } else if (taskModel is VendorProductFileInventoryTaskDto) { task = Mapper.Map <vendorproductfileinventorytask>(taskModel as VendorProductFileInventoryTaskDto); } else if (taskModel is CustomExportProductTaskDto) { task = Mapper.Map <customexportproducttask>(taskModel as CustomExportProductTaskDto); } else if (taskModel is CustomImportOrderTaskDto) { task = Mapper.Map <customimportordertask>(taskModel as CustomImportOrderTaskDto); } else { throw new InvalidCastException(string.Format("Unknown credential type \'{0}\' for casting!", task.TaskType)); } return(task); }
private TaskService _createTaskServiceInstance(scheduledtask task) { if (task.TaskType == ScheduledTaskType.GENERATE_PO) { return(new GeneratePoTaskService(task as generatepotask)); } else if (task.TaskType == ScheduledTaskType.CUSTOM_EXPORT_ORDER) { return(new CustomExportOrderTaskService(task as customexportordertask)); } else if (task.TaskType == ScheduledTaskType.MARKETPLACE_INVENTORY) { return(new MarketplaceInventoryTaskService(task as marketplaceinventorytask)); } else if (task.TaskType == ScheduledTaskType.VENDOR_PRODUCT_FILE_INVENTORY) { return(new VendorProductFileInventoryTaskService(task as vendorproductfileinventorytask)); } else if (task.TaskType == ScheduledTaskType.CUSTOM_EXPORT_PRODUCT) { return(new CustomExportProductTaskService(task as customexportproducttask)); } else if (task.TaskType == ScheduledTaskType.CUSTOM_IMPORT_ORDER) { return(new CustomImportOrderTaskService(task as customimportordertask)); } else { throw new ArgumentException("Unknown task type: " + task.TaskType); } }
private ScheduledTaskDto convertToModel(scheduledtask task) { ScheduledTaskDto model = null; if (task is customexportordertask) { model = Mapper.Map <CustomExportOrderTaskDto>(task as customexportordertask); } else if (task is generatepotask) { model = Mapper.Map <GeneratePoTaskDto>(task as generatepotask); } else if (task is marketplaceinventorytask) { model = Mapper.Map <MarketplaceInventoryTaskDto>(task as marketplaceinventorytask); } else if (task is vendorproductfileinventorytask) { model = Mapper.Map <VendorProductFileInventoryTaskDto>(task as vendorproductfileinventorytask); } else if (task is customexportproducttask) { model = Mapper.Map <CustomExportProductTaskDto>(task as customexportproducttask); } else if (task is customimportordertask) { model = Mapper.Map <CustomImportOrderTaskDto>(task as customimportordertask); } else { throw new InvalidCastException(string.Format("Unknown credential type \'{0}\' for casting!", task.TaskType)); } // create the datetime object for the StartTime var today = DateTime.Now; model.StartTimeDate = new DateTime(today.Year, today.Month, today.Day, task.StartTime.Hours, task.StartTime.Minutes, task.StartTime.Seconds); return(model); }