public static bool NewPart4(Guid quizId) { bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); for (byte i = 0; i < 10; i++) { Int32 s = 70 + i * 3; //4 pairs of reading texts with 10 questions per pair var questionGroupId = Guid.NewGuid(); var groupId = bl_group.Create( quizId, 4, //Thay đổi đối với từng part (thứ tự part) String.Format("Part4.{0}-{1}", s + 1, s + 3), i, null, null); //Create 3 question each a group for (byte ord = 0; ord < 3; ord++) { bl_question.Create( groupId, //phải trả về đúng với group id phía trên quizId, (byte)(s + ord + 1), null, null, null, null, null, null, null, 0); } } return(true); }
public static bool NewPart6(Guid quizId) //Tất cả cái add đều phải có một cái quizId { bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); for (byte i = 0; i < 3; i++) { //3 pairs of reading texts with 4 questions per pair var questionGroupId = Guid.NewGuid(); var groupId = bl_group.Create( quizId, 6, //Thay đổi đối với từng part String.Format("Part6.{0}-{1}", 141 + i * 4, 144 + i * 4), i, null, null); //Create 4 question each a group for (byte ord = 0; ord < 4; ord++) { bl_question.Create( groupId, //phải trả về đúng với group id phía trên quizId, (byte)(141 + i * 4 + ord), null, null, null, null, null, null, null, 0); } } return(true); }
public static bool NewPart7(Guid quizId, byte numberOfGroup, List <byte> itemList) { bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); int tmp = 0; for (byte i = 0; i < itemList.Count; i++) { //4 pairs of reading texts with 5 questions per pair var questionGroupId = Guid.NewGuid(); var groupId = bl_group.Create( quizId, 7, //Thay đổi đối với từng part (thứ tự part) String.Format("Part7.{0}-{1}", 153 + tmp, 153 + tmp + itemList[i] - 1), i, null, null); for (byte ord = 0; ord < itemList[i]; ord++) { bl_question.Create( groupId, //phải trả về đúng với group id phía trên quizId, (byte)(153 + tmp + ord), //đúng thứ tự câu hỏi trong một bộ quiz null, null, null, null, null, null, null, 0); } tmp += itemList[i]; } return(true); }
public static bool NewPart5(Guid quizId) //Tất cả cái add đều phải có một cái quizId { bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); for (byte i = 0; i < 8; i++) { //8 pairs of reading texts with 5 questions per pair var groupId = bl_group.Create( quizId, 5, //Thay đổi đối với từng part String.Format("Part5.{0}-{1}", 101 + i * 5, 105 + i * 5), i, null, null); //Create 5 question each a group for (byte ord = 0; ord < 5; ord++) { bl_question.Create( groupId, quizId, (byte)(101 + i * 5 + ord), null, null, null, null, null, null, null, 0); } } return(true); }
//Cái hàm này như là hàm khởi tạo, chỉ chạy 1 lần mỗi khi tạo một quiz mới //Nhiệm vụ : Để insert vào database số lượng câu hỏi của từng questionGroup. //Sau đó chúng ta sẽ cập nhật lại để đảm bảo tính đúng đắn của bộ câu hỏi. //Có thể xem thêm "http://localhost:12347/Bq_TuCuong/UpdatePart8?groupId=c38d171e-524b-466e-b814-be1d78398f7c" //để hiểu nó hoạt động như thế nào public static bool NewPart8(Guid quizId) //Tất cả cái add đều phải có một cái quizId { bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); for (byte i = 0; i < 4; i++) { //4 pairs of reading texts with 5 questions per pair var groupId = bl_group.Create( quizId, 8, //Thay đổi đối với từng part (thứ tự part) String.Format("Part8.{0}-{1}", 181 + i * 5, 185 + i * 5), i, null, null); //Create 5 question each a group for (byte ord = 0; ord < 5; ord++) { bl_question.Create( groupId, //phải trả về đúng với group id phía trên quizId, (byte)(181 + i * 5 + ord), //đúng thứ tự câu hỏi trong một bộ quiz null, null, null, null, null, null, null, 0); } } return(true); }