private void Button_Create_Click(object sender, EventArgs e) { var userIds = ExamDataHelper.GetUserIds().ToArray(); var rst = ExamDataHelper.SignUserToExam(new Guid("A36C9AF2-F522-4EB7-BB98-945BEBD51C21"), userIds); MessageBox.Show(rst); }
public void SignExcelUser(Guid examId, string fileName) { var userAccounts = ExcelHelper.GetWorkBookFromFile(fileName).GetUserAccounts().ToArray(); var userIds = ExamDataHelper.GetUserIdsByAccount(userAccounts).ToArray(); var rst = Parallel.For(0, userIds.Length / 5000, d => { ExamDataHelper.SignUserToExam(examId, userIds.Skip(d * 5000).Take(5000).ToArray()); }); while (!rst.IsCompleted) { } }