/// <summary> /// 获取票据 /// </summary> /// <returns></returns> public string getTicket() { CacheLib.Cookie cookie = new CacheLib.Cookie(); string encTicket = cookie.GetCookie("auth"); if (CommonLib.Common.Validate.IsNullString(encTicket) == "") return null; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encTicket); return ticket.UserData; }
public ActionResult ExamMenu() { JxLib.UserExamController userExamController = new JxLib.UserExamController(); JxLib.ExamController examController = new JxLib.ExamController(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string user_id = cookie.GetCookie("user_id"); System.Collections.Hashtable item = userExamController.getMySequenceExamLog(user_id); int count = examController.getAll().Count; ViewData["count"] = count; if (item == null) ViewData["exam_id"] = "1"; else ViewData["exam_id"] = item["ExamID"].ToString(); ViewData["title"] = "科目一考试练习"; return View(); }
public void Load() { CacheLib.Cache cache = new CacheLib.Cache(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string key = cookie.GetCookie("codes"); this._Codes = cache.Get<DataTable>(key); }
public ActionResult StudentEnterSave() { JxLib.StudentController studentController = new JxLib.StudentController(); DatabaseLib.Tools tools = new DatabaseLib.Tools(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string strParam = Request.Form.ToString(); System.Collections.Hashtable data = tools.paramToData(strParam); string user_id = cookie.GetCookie("user_id"); //深大驾校测试代码 data.Add("SchoolID", "1"); //data.Add("StudentID", "00001"); data.Add("StudentID", user_id); data.Add("EnterDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); studentController.save(data); studentController.saveEnter(data); if (studentController.Result) { return RedirectToRoute("enter-success"); } else { return RedirectToRoute("home"); } }
public ActionResult SimulateExamStart() { JxLib.ExamController examController = new JxLib.ExamController(); JxLib.UserExamController userExamController = new JxLib.UserExamController(); CacheLib.Cookie cookie = new CacheLib.Cookie(); System.Collections.Hashtable data = new System.Collections.Hashtable(); string user_id = cookie.GetCookie("user_id"); //深大驾校测试代码 //data.Add("SchoolID", "1"); //data.Add("StudentID", "00001"); data.Add("StudentID", user_id); //插入数据,考试结束 string strExamID = userExamController.ExamStart(data); List<System.Collections.Hashtable> list = examController.getTestExam(); System.Text.StringBuilder strExams = new System.Text.StringBuilder(); int index = 1; foreach (System.Collections.Hashtable item in list) { Models.ExamA exam_a = null; Models.ExamB exam_b = null; if (CommonLib.Common.Validate.IsNullString(item["OptionC"]) == "") { Models.Answer answerA = null; if (item["Answer"].ToString().IndexOf("A") > -1) { answerA = new Models.Answer { title = item["OptionA"].ToString(), correct = true }; } else { answerA = new Models.Answer { title = item["OptionA"].ToString(), correct = false }; } string strAnswerA = Newtonsoft.Json.JsonConvert.SerializeObject(answerA); Models.Answer answerB = null; if (item["Answer"].ToString().IndexOf("B") > -1) { answerB = new Models.Answer { title = item["OptionB"].ToString(), correct = true }; } else { answerB = new Models.Answer { title = item["OptionB"].ToString(), correct = false }; } Models.AnswersA answers = new Models.AnswersA { A = answerA, B = answerB }; exam_a = new Models.ExamA { no = index.ToString(), exam_id = item["ExamID"].ToString(), total = this.EXAMCOUNT.ToString(), title = item["ExamText"].ToString(), img = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["ImgUrl"]), video = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["VideoUrl"]), answers = answers }; if (index > 1) strExams.Append(","); strExams.Append(Newtonsoft.Json.JsonConvert.SerializeObject(exam_a)); } else { Models.Answer answerA = null; if (item["Answer"].ToString().IndexOf("A") > -1) { answerA = new Models.Answer { title = item["OptionA"].ToString(), correct = true }; } else { answerA = new Models.Answer { title = item["OptionA"].ToString(), correct = false }; } Models.Answer answerB = null; if (item["Answer"].ToString().IndexOf("B") > -1) { answerB = new Models.Answer { title = item["OptionB"].ToString(), correct = true }; } else { answerB = new Models.Answer { title = item["OptionB"].ToString(), correct = false }; } Models.Answer answerC = null; if (item["Answer"].ToString().IndexOf("C") > -1) { answerC = new Models.Answer { title = item["OptionC"].ToString(), correct = true }; } else { answerC = new Models.Answer { title = item["OptionC"].ToString(), correct = false }; } Models.Answer answerD = null; if (item["Answer"].ToString().IndexOf("D") > -1) { answerD = new Models.Answer { title = item["OptionD"].ToString(), correct = true }; } else { answerD = new Models.Answer { title = item["OptionD"].ToString(), correct = false }; } Models.AnswersB answers = new Models.AnswersB { A = answerA, B = answerB, C = answerC, D = answerD }; exam_b = new Models.ExamB { no = index.ToString(), exam_id = item["ExamID"].ToString(), total = this.EXAMCOUNT.ToString(), title = item["ExamText"].ToString(), img = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["ImgUrl"]), video = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["VideoUrl"]), answers = answers }; if (index > 1) strExams.Append(","); strExams.Append(Newtonsoft.Json.JsonConvert.SerializeObject(exam_b)); } index++; } string tmp = strExams.ToString().Replace("[", "{").Replace("]", "}"); ViewData["exams"] = tmp; ViewData["exam_id"] = strExamID; ViewData["title"] = "开始考试"; return View(); }
public ActionResult SequenceExam() { JxLib.ExamController examController = new JxLib.ExamController(); List<System.Collections.Hashtable> list = examController.getAll(); //System.Text.StringBuilder strExams = new System.Text.StringBuilder(); //int index = 1; //foreach (System.Collections.Hashtable item in list) //{ // Models.ExamA exam_a = null; // Models.ExamB exam_b = null; // if (CommonLib.Common.Validate.IsNullString(item["OptionC"]) == "") // { // Models.Answer answerA = null; // if (item["Answer"].ToString().IndexOf("A") > -1) // { // answerA = new Models.Answer // { // title = item["OptionA"].ToString(), // correct = true // }; // } // else // { // answerA = new Models.Answer // { // title = item["OptionA"].ToString(), // correct = false // }; // } // string strAnswerA = Newtonsoft.Json.JsonConvert.SerializeObject(answerA); // Models.Answer answerB = null; // if (item["Answer"].ToString().IndexOf("B") > -1) // { // answerB = new Models.Answer // { // title = item["OptionB"].ToString(), // correct = true // }; // } // else // { // answerB = new Models.Answer // { // title = item["OptionB"].ToString(), // correct = false // }; // } // Models.AnswersA answers = new Models.AnswersA // { // A = answerA, // B = answerB // }; // exam_a = new Models.ExamA // { // no = index.ToString(), // exam_id = item["ExamID"].ToString(), // total = list.Count.ToString(), // title = item["ExamText"].ToString(), // img = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["ImgUrl"]), // video = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["VideoUrl"]), // answers = answers // }; // if (index > 1) // strExams.Append(","); // strExams.Append(Newtonsoft.Json.JsonConvert.SerializeObject(exam_a)); // } // else // { // Models.Answer answerA = null; // if (item["Answer"].ToString().IndexOf("A") > -1) // { // answerA = new Models.Answer // { // title = item["OptionA"].ToString(), // correct = true // }; // } // else // { // answerA = new Models.Answer // { // title = item["OptionA"].ToString(), // correct = false // }; // } // Models.Answer answerB = null; // if (item["Answer"].ToString().IndexOf("B") > -1) // { // answerB = new Models.Answer // { // title = item["OptionB"].ToString(), // correct = true // }; // } // else // { // answerB = new Models.Answer // { // title = item["OptionB"].ToString(), // correct = false // }; // } // Models.Answer answerC = null; // if (item["Answer"].ToString().IndexOf("C") > -1) // { // answerC = new Models.Answer // { // title = item["OptionC"].ToString(), // correct = true // }; // } // else // { // answerC = new Models.Answer // { // title = item["OptionC"].ToString(), // correct = false // }; // } // Models.Answer answerD = null; // if (item["Answer"].ToString().IndexOf("D") > -1) // { // answerD = new Models.Answer // { // title = item["OptionD"].ToString(), // correct = true // }; // } // else // { // answerD = new Models.Answer // { // title = item["OptionD"].ToString(), // correct = false // }; // } // Models.AnswersB answers = new Models.AnswersB // { // A = answerA, // B = answerB, // C = answerC, // D = answerD // }; // exam_b = new Models.ExamB // { // no = index.ToString(), // exam_id = item["ExamID"].ToString(), // total = list.Count.ToString(), // title = item["ExamText"].ToString(), // img = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["ImgUrl"]), // video = CommonLib.Common.ConfigReader.Read("ResourceUrl") + CommonLib.Common.Validate.IsNullString(item["VideoUrl"]), // answers = answers // }; // if (index > 1) // strExams.Append(","); // strExams.Append(Newtonsoft.Json.JsonConvert.SerializeObject(exam_b)); // } // index++; //} //string tmp = strExams.ToString().Replace("[", "{").Replace("]", "}"); //ViewData["exams"] = tmp; CacheLib.Cookie cookie = new CacheLib.Cookie(); JxLib.UserExamController userExamController = new JxLib.UserExamController(); //实际运行代码 string user_id = cookie.GetCookie("user_id"); //开发测试代码 //string user_id = "00001"; //cookie.AddCookie("user_id", "00001"); System.Collections.Hashtable sequenceExamLog = userExamController.getMySequenceExamLog(user_id); string exam_id = "1"; if (sequenceExamLog != null) { exam_id = sequenceExamLog["ExamID"].ToString(); } ViewData["index"] = exam_id; ViewData["count"] = list.Count; ViewData["title"] = "训练习题"; return View(); }
public ActionResult MyIndex() { JxLib.StudentController studentController = new JxLib.StudentController(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string user_id = cookie.GetCookie("user_id"); ViewData["data"] = studentController.load(user_id); ViewData["user_id"] = user_id; ViewData["title"] = "我的首页"; return View(); }
public ActionResult MyExam() { JxLib.UserExamController userExamController = new JxLib.UserExamController(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string user_id = cookie.GetCookie("user_id"); List<System.Collections.Hashtable> list = userExamController.getMyExam(user_id); ViewData["data"] = list; int ok_count = 0; foreach (System.Collections.Hashtable item in list) { string score = CommonLib.Common.Validate.IsNullString(item["Score"]); if (score == "") continue; if (Int32.Parse(score) > this.PASSSCORE) { ok_count++; } } ViewData["need_count"] = 3 - ok_count; ViewData["ok_count"] = ok_count; ViewData["title"] = "我的成绩"; return View(); }
public ActionResult MyCoupon() { JxLib.CouponController couponController = new JxLib.CouponController(); DatabaseLib.Tools tools = new DatabaseLib.Tools(); CacheLib.Cookie cookie = new CacheLib.Cookie(); string user_id = cookie.GetCookie("user_id"); List<System.Collections.Hashtable> list = couponController.getByStuentId(user_id); ViewData["data"] = list; ViewData["title"] = "我的优惠卷"; return View(); }