public JsonResult createTask(string number, string projectId, string state, int total, int matching) { int count = 1; int value = Convert.ToInt32(number); HiveController hc = new HiveController(); while (count <= value) { string tProjectId = projectId; string tName = DateTime.Now.ToOADate() + "Name" + count; string tDes = DateTime.Now.ToOADate() + "Des" + count; string tState = state; int tTotal = total; int tMatching = matching; var task = Task.Run(async() => { await hc.CreateTask(tProjectId, tName, tDes, tState, tTotal, tMatching); }); task.Wait(); count++; task.Dispose(); } return(Json(new { aaData = "{ value:ok }" }, JsonRequestBehavior.AllowGet)); }
public JsonResult createAssignment(string number, string projectId, string task_id, string asset_ids, string user_id) { int count = 0; int value = Convert.ToInt32(number); string[] assetIds = asset_ids.Split('#'); HiveController hc = new HiveController(); foreach (var a in assetIds) { if (a != "") { string tProjectId = projectId; string task_Id = task_id; string userId = user_id; var task = Task.Run(async() => { await hc.CreateAssignment(tProjectId, task_Id, a, userId); }); task.Wait(); count++; task.Dispose(); } if (count == value) { break; } } return(Json(new { aaData = "{ value:ok }" }, JsonRequestBehavior.AllowGet)); }
public JsonResult createProject(string number) { int count = 1; int value = Convert.ToInt32(number); HiveController hc = new HiveController(); hc.ControllerContext = new ControllerContext(this.Request.RequestContext, hc); while (count <= value) { string projectId = DateTime.Now.ToOADate() + "Id" + count; string projectName = DateTime.Now.ToOADate() + "Name" + count; string projectDes = DateTime.Now.ToOADate() + "Des" + count; var task = Task.Run(async() => { await hc.CreateProject(projectId, projectName, projectDes); }); task.Wait(); count++; task.Dispose(); } return(Json(new { aaData = "{ value:ok }" }, JsonRequestBehavior.AllowGet)); }