public static void createProcess(String name, String description, decimal userId) { try { ProcessDAL.insert(name, description, DateTime.Now, userId); } catch (Exception e) { throw e; } }
public static void start(decimal id, decimal userId) { try { var template = TemplateDAL.fetchAll().Where(x => x.id == id).FirstOrDefault(); var tasks = TemplateTaskDAL.fetchAll().Where(x => x.template_id == template.id).ToList(); decimal processId = ProcessDAL.insert(template.name, template.description, DateTime.Now, userId); foreach (templates_tasks ts in tasks) { tasks model = new tasks(); model.name = ts.name; model.description = ts.description; model.date_end = ts.end_date; model.task_status = ts.task_status_code; model.creator_user_id = decimal.Parse(userId + ""); model.process_id = processId; TaskDAL.createTask(model); } } catch (Exception e) { throw e; } }