public ActionResult Index() { int courseid = int.Parse(Request.Form["course"]); bool succeed = true; LearningPlatformEntities lpfe = new LearningPlatformEntities(); int userId; //if (Session["userId"] != null) //{ // userId = Convert.ToInt32(Session["userId"]); //} //else //{ // userId = 1; //} var uid = User.Identity.GetUserId(); userId = lpfe.AspNetUsers.Single<AspNetUsers>(m => m.Id == uid).NewId; try { using (TransactionScope ts = new TransactionScope()) { var num = lpfe.Order.Count<Order>(m => m.theCourse == courseid && m.theUser == userId); if (num == 0) { Order or = lpfe.Order.Add(new Order()); or.theUser = userId; or.theCourse = int.Parse(Request.Form["course"]); or.Totalprice = int.Parse(Request.Form["price"]); or.Orderstate = 0; } lpfe.SaveChanges(); ts.Complete(); } } catch { succeed = false; Response.Write("<script> alert('数据未成功保存,请重新尝试!');</script> "); } if (succeed) { string paymentUrl = "http://10.0.138.11:8801/default.aspx", paymentMethod = "0"; string merchantId = "Team05"; string returnUrl = "http://" + Request.Url.Authority + Url.Action("Result", "Payment"); string amtStr = Request.Form["price"]; var orderid = lpfe.Order.Single<Order>(m => m.theCourse == courseid && m.theUser == userId).Id; string merTransId = orderid.ToString(); RemotePost.PaymentPost(paymentUrl, merchantId, returnUrl, paymentMethod, amtStr, merTransId); } pvm.courses = new List<Course>(); var course = lpfe.Course.Single<Course>(m => m.Id == courseid); pvm.courses.Add(course); return View(pvm); }
// GET: Payment public ActionResult Index(string Id) { LearningPlatformEntities lpfe = new LearningPlatformEntities(); pvm.courses = new List<Course>(); int id = Convert.ToInt32(Id); //var num = lpfe.Course.Count<Course>(m => m.Id == id); //if (num > 0) //{ // var course = lpfe.Course.Single<Course>(m => m.Id == id); // pvm.courses.Add(course); //} //else //{ // var course = lpfe.Course.Single<Course>(m => m.Id == 1); // pvm.courses.Add(course); //} var course = lpfe.Course.Single<Course>(m => m.Id == id); pvm.courses.Add(course); return View(pvm); }
//获取题目 public ActionResult _title(string chapterSectionId, string courseId, int ability) { LearningPlatformEntities lpe = new LearningPlatformEntities(); //var uid = User.Identity.GetUserId(); //var userId = lpe.AspNetUsers.Single<AspNetUsers>(m => m.Id == uid).NewId; //var ability = lpe.LearnerBookmarker.Single<LearnerBookmarker>(m => m.theLearner == userId).theLearnerAbility; LearningViewModels lvm = new LearningViewModels(); lvm.chapterSection = new List<ChapterSection>(); lvm.exerciseSet = new List<ExerciseSet>(); lvm.testSet = new List<TestSet>(); lvm.singleSelections = new List<SingleSelections>(); lvm.fillBlanks = new List<FillBlanks>(); lvm.programProblems = new List<ProgramProblems>(); lvm.setCapacity = new List<SetCapacity>(); var id = Convert.ToInt32(chapterSectionId); var cs = lpe.ChapterSection.Single(m => m.Id == id); lvm.chapterSection.Add(cs); if (cs.SectionType == 1) { var es = lpe.ExerciseSet.Where(m => m.theChapterSection == cs.Id).ToList(); foreach (var exe in es) { var capactiy = lpe.SetCapacity.Single(m => m.theExerciseSet == exe.Id && m.theLearnerAbility == ability); var num = capactiy.Capacity; switch (exe.SetType) { case 1: var ssl = lpe.SingleSelections.Where(m => m.theSet == exe.Id && m.ForTest == 0).ToList(); { int[] ord = NorepeatRandom.Random(ssl.Count); for (int i = 0; i < num; i++) { lvm.singleSelections.Add(ssl[ord[i]]); } } break; case 2: var fbl = lpe.FillBlanks.Where(m => m.theSet == exe.Id && m.ForTest == 0).ToList(); { int[] ord = NorepeatRandom.Random(fbl.Count); for (int i = 0; i < num; i++) { lvm.fillBlanks.Add(fbl[ord[i]]); } } break; case 3: break; case 4: var ppb = lpe.ProgramProblems.Where(m => m.theSet == exe.Id && m.ForTest == 0).ToList(); { int[] ord = NorepeatRandom.Random(ppb.Count); for (int i = 0; i < num; i++) { lvm.programProblems.Add(ppb[ord[i]]); } } break; } lvm.exerciseSet.Add(exe); } } else { var ts = lpe.TestSet.Where(m => m.theChapterSection == cs.Id).ToList(); foreach (var tss in ts) { var ssl = lpe.SingleSelections.Where(m => m.theSet == tss.Id && m.ForTest == 1).ToList(); { foreach (var ss in ssl) { lvm.singleSelections.Add(ss); } } var fbl = lpe.FillBlanks.Where(m => m.theSet == tss.Id && m.ForTest == 1).ToList(); { foreach (var fb in fbl) { lvm.fillBlanks.Add(fb); } } var ppb = lpe.ProgramProblems.Where(m => m.theSet == tss.Id && m.ForTest == 1).ToList(); { foreach (var pp in ppb) { lvm.programProblems.Add(pp); } } lvm.testSet.Add(tss); } } return View(lvm); }
//重现题目 public ActionResult _showtitle(string chapterSectionId) { var id = Convert.ToInt32(chapterSectionId); LearningPlatformEntities lpfe = new LearningPlatformEntities(); LearningViewModels lvm = new LearningViewModels(); var uid = User.Identity.GetUserId(); var userId = lpfe.AspNetUsers.Single(m => m.Id == uid).NewId; lvm.chapterSection = new List<ChapterSection>(); lvm.singleSelections = new List<SingleSelections>(); lvm.exerciseProblems = new List<ExerciseProblems>(); lvm.exerciseSetTracking = new List<ExerciseSetTracking>(); lvm.fillBlanks = new List<FillBlanks>(); lvm.testProblems = new List<TestProblems>(); lvm.testSetTracking = new List<TestSetTracking>(); lvm.exerciseSet = new List<ExerciseSet>(); lvm.testSet = new List<TestSet>(); var cs = lpfe.ChapterSection.Single(m => m.Id == id); lvm.chapterSection.Add(cs); if (cs.SectionType == 1) { var es = lpfe.ExerciseSet.Where(m => m.theChapterSection == cs.Id).ToList(); foreach (var ess in es) { switch (ess.SetType) { case 1: var temp1 = lpfe.ExerciseSetTracking.Where(m => m.theExerciseSet == ess.Id&m.theLearner==userId).ToList().Max(m => m.TryOrd); var est1 = lpfe.ExerciseSetTracking.Single(m => m.theExerciseSet == ess.Id & m.TryOrd == temp1 & m.theLearner == userId); var ep1 = lpfe.ExerciseProblems.Where(m => m.theExecriseSetTracking == est1.Id).ToList(); foreach (var epp in ep1) { var num1 = lpfe.SingleSelections.Count(m => m.Id == epp.ProblemOrd); if (num1 > 0) { var ss = lpfe.SingleSelections.Single(m => m.Id == epp.ProblemOrd); lvm.singleSelections.Add(ss); lvm.exerciseProblems.Add(epp); } } lvm.exerciseSetTracking.Add(est1); break; case 2: var temp2 = lpfe.ExerciseSetTracking.Where(m => m.theExerciseSet == ess.Id & m.theLearner == userId).ToList().Max(m => m.TryOrd); var est2 = lpfe.ExerciseSetTracking.Single(m => m.theExerciseSet == ess.Id & m.TryOrd == temp2 & m.theLearner == userId); var ep2 = lpfe.ExerciseProblems.Where(m => m.theExecriseSetTracking == est2.Id).ToList(); foreach (var epp in ep2) { var num2 = lpfe.FillBlanks.Count(m => m.Id == epp.ProblemOrd); if (num2 > 0) { var fb = lpfe.FillBlanks.Single(m => m.Id == epp.ProblemOrd); lvm.fillBlanks.Add(fb); lvm.exerciseProblems.Add(epp); } } lvm.exerciseSetTracking.Add(est2); break; case 3: break; case 4: break; default: break; } lvm.exerciseSet.Add(ess); } } else { var ts = lpfe.TestSet.Where(m => m.theChapterSection == cs.Id).ToList(); foreach (var tss in ts) { switch (tss.SetType) { case 1: var est1 = lpfe.TestSetTracking.Single(m => m.theTestSet == tss.Id&m.theLearner==userId); var ep1 = lpfe.TestProblems.Where(m => m.theTestSetTracking == est1.Id).ToList(); foreach (var epp in ep1) { var num1 = lpfe.SingleSelections.Count(m => m.Id == epp.ProblemOrd); if (num1 > 0) { var ss = lpfe.SingleSelections.Single(m => m.Id == epp.ProblemOrd); lvm.singleSelections.Add(ss); lvm.testProblems.Add(epp); } } lvm.testSetTracking.Add(est1); break; case 2: var est2 = lpfe.TestSetTracking.Single(m => m.theTestSet == tss.Id&m.theLearner==userId); var ep2 = lpfe.TestProblems.Where(m => m.theTestSetTracking == est2.Id).ToList(); foreach (var epp in ep2) { var num2 = lpfe.FillBlanks.Count(m => m.Id == epp.ProblemOrd); if (num2 > 0) { var fb = lpfe.FillBlanks.Single(m => m.Id == epp.ProblemOrd); lvm.fillBlanks.Add(fb); lvm.testProblems.Add(epp); } } lvm.testSetTracking.Add(est2); break; case 3: break; case 4: break; default: break; } lvm.testSet.Add(tss); } } return View(lvm); }
public void UpdateChaperLog(int courseid,int chapter, int section) { var uid = User.Identity.GetUserId(); //using (TransactionScope sc = new TransactionScope()) //{ // try // { // using (LearningPlatformEntities lpfe = new LearningPlatformEntities()) // { // var Id = lpfe.AspNetUsers.Single(m => m.Id == uid).NewId; // var pp = lpfe.ChapterLearning.Count(m => m.theLearner == Id); // if (pp > 0) // { // ChapterLearning cl = lpfe.ChapterLearning.Single(m => m.theLearner == Id); // cl.theChapter = chapter; // SectionLearning sl = lpfe.SectionLearning.Single(m => m.theLearner == Id); // sl.theSection = section; // } // else // { // ChapterLearning cc = lpfe.ChapterLearning.Add(new ChapterLearning()); // cc.theChapter = chapter; // cc.theLearner = Id; // cc.theLearningState = 1; // lpfe.SaveChanges(); // SectionLearning ss = lpfe.SectionLearning.Add(new SectionLearning()); // ss.theSection = section; // ss.theLearner = Id; // ss.theLearningState = 1; // } // lpfe.SaveChanges(); // } // sc.Complete(); // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //} try { using (TransactionScope ts = new TransactionScope()) { using (LearningPlatformEntities lpfe = new LearningPlatformEntities()) { var Id = lpfe.AspNetUsers.Single(m => m.Id == uid).NewId; var pp = lpfe.ChapterLearning.Count(m => m.theLearner == Id); var chap = lpfe.CourseChapter.Single(m => m.theCourse == courseid & m.SequenceType == chapter).Id; var s = section.ToString(); var sec = lpfe.ChapterSection.Single(m => m.theCourseChapter == chap & m.SectionOrd == s).Id; if (pp > 0) { ChapterLearning cl = lpfe.ChapterLearning.Single(m => m.theLearner == Id); cl.theChapter = chap; SectionLearning sl = lpfe.SectionLearning.Single(m => m.theLearner == Id); sl.theSection = sec; } else { ChapterLearning cc = lpfe.ChapterLearning.Add(new ChapterLearning()); cc.theChapter = chap; cc.theLearner = Id; cc.theLearningState = 1; SectionLearning ss = lpfe.SectionLearning.Add(new SectionLearning()); ss.theSection = sec; ss.theLearner = Id; ss.theLearningState = 1; } lpfe.SaveChanges(); } ts.Complete(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void saveProblem() { LearningPlatformEntities lpfe = new LearningPlatformEntities(); var realcontent = Request["content"]; var realanswer = Request["ranswer"]; var trueanswer = Request["tanswer"]; var iscorrect = Convert.ToInt32(Request["correct"]); var ord = Convert.ToInt32(Request["ord"]); var setType = Convert.ToInt32(Request["type"]); var trackId = Convert.ToInt32(Request["trackId"]); if (setType == 0) { using (TransactionScope ts = new TransactionScope()) { ExerciseProblems ep = lpfe.ExerciseProblems.Add(new ExerciseProblems()); ep.ProblemOrd = ord; ep.RealContent = realcontent; ep.RealAnswer = realanswer; ep.TrueAnswer = trueanswer; ep.IsCorrect = iscorrect; ep.theExecriseSetTracking = trackId; lpfe.SaveChanges(); ts.Complete(); } } else { var tpnum = lpfe.TestProblems.Count(m => m.theTestSetTracking == trackId & m.ProblemOrd == ord); if (tpnum != 0) { using (TransactionScope ts = new TransactionScope()) { TestProblems tp = lpfe.TestProblems.Single(m => m.theTestSetTracking == trackId & m.ProblemOrd == ord); lpfe.TestProblems.Remove(tp); lpfe.SaveChanges(); ts.Complete(); } } using (TransactionScope ts = new TransactionScope()) { TestProblems tp = lpfe.TestProblems.Add(new TestProblems()); tp.ProblemOrd = ord; tp.RealContent = realcontent; tp.RealAnswer = realanswer; tp.TrueAnswer = trueanswer; tp.IsCorrect = iscorrect; tp.theTestSetTracking = trackId; lpfe.SaveChanges(); ts.Complete(); } } }
public JsonResult LearnTopic(string sectionOrd, string sectionDes) { if (sectionDes == "" || sectionOrd == "") { return Json(""); } var obj = sectionDes.Trim().ToString(); LearningPlatformEntities lpfe = new LearningPlatformEntities(); var section = lpfe.ChapterSection.Single<ChapterSection>(m => m.SectionOrd == sectionOrd && m.SectionDesc == obj); var date = "{SectionOrd: \"" + section.SectionOrd + "\", SectionDesc: \"" + section.SectionDesc + "\", SectionType: \"" + section.SectionType + "\"}"; return Json(new { OrdId = section.SectionOrd, Name = section.SectionDesc, Id = section.Id, Content = section.ContentFile }, "text/html", JsonRequestBehavior.AllowGet); }
public int createTrack() { LearningPlatformEntities lpfe = new LearningPlatformEntities(); var uid = User.Identity.GetUserId(); var userId = lpfe.AspNetUsers.Single(m => m.Id == uid).NewId; int setType = Convert.ToInt32(Request["type"]); int flag = Convert.ToInt32(Request["flag"]); int? num = Convert.ToInt32(Request["num"]); int setId = Convert.ToInt32(Request["setId"]); int? trackId = Convert.ToInt32(Request["trackId"]); if (flag == 0) { if (setType == 0) { var tryord = 0; using (TransactionScope ts = new TransactionScope()) { //var tryord = 0; if (lpfe.ExerciseSetTracking.Count(m => m.theExerciseSet == setId & m.theLearner == userId) > 0) { var temp = lpfe.ExerciseSetTracking.Where(m => m.theExerciseSet == setId & m.theLearner == userId).ToList(); tryord = temp.Max(m => m.TryOrd); } ExerciseSetTracking st = lpfe.ExerciseSetTracking.Add(new ExerciseSetTracking()); st.theLearner = userId; st.theExerciseSet = setId; st.theLearningState = 1; st.TryOrd = tryord + 1; st.CorrectNum = 0; lpfe.SaveChanges(); ts.Complete(); tryord += 1; } trackId = lpfe.ExerciseSetTracking.Single(m => m.theExerciseSet == setId & m.theLearner == userId & m.TryOrd == tryord).Id; } else { var stnum = lpfe.TestSetTracking.Count(m => m.theLearner == userId & m.theTestSet == setId); if (stnum == 0) { using (TransactionScope ts = new TransactionScope()) { TestSetTracking st = lpfe.TestSetTracking.Add(new TestSetTracking()); st.theLearner = userId; st.theTestSet = setId; st.theLearningState = 1; st.CorrectNum = 0; lpfe.SaveChanges(); ts.Complete(); } trackId = lpfe.TestSetTracking.Single(m => m.theTestSet == setId & m.theLearner == userId).Id; } else { var stt = lpfe.TestSetTracking.Single(m => m.theTestSet == setId & m.theLearner == userId); using (TransactionScope ts = new TransactionScope()) { stt.CorrectNum = 0; lpfe.SaveChanges(); ts.Complete(); } trackId = stt.Id; } } } else { if (setType == 0) { using (TransactionScope ts = new TransactionScope()) { ExerciseSetTracking st = lpfe.ExerciseSetTracking.Single(m => m.Id == trackId); st.CorrectNum += 1; lpfe.SaveChanges(); ts.Complete(); } } else { using (TransactionScope ts = new TransactionScope()) { TestSetTracking st = lpfe.TestSetTracking.Single(m => m.Id == trackId); st.CorrectNum += 1; lpfe.SaveChanges(); ts.Complete(); } } } var tempId = Convert.ToInt32(trackId); return tempId; }
// // GET: /Learn/ public ActionResult Learn(string Id="1") { int id = Convert.ToInt32(Id); LearningPlatformEntities lpfe = new LearningPlatformEntities(); var uid = User.Identity.GetUserId(); var userId = lpfe.AspNetUsers.Single<AspNetUsers>(m => m.Id == uid).NewId; var flag = lpfe.Order.Count(m => m.theUser == userId & m.theCourse == id & m.Orderstate == 1); if (flag == 1) { LearningViewModels lvm = new LearningViewModels(); lvm.courseChapter = new List<CourseChapter>(); lvm.chapterSection = new List<ChapterSection>(); lvm.courses = new List<Course>(); //获取该门课程的数据 lvm.courses.Add(lpfe.Course.Single<Course>(m => m.Id == id)); //获取课程下面的章和节 var CourseChapter = lpfe.CourseChapter.Where<CourseChapter>(m => m.theCourse == id).ToList(); foreach (var cc in CourseChapter) { var result = lpfe.ChapterSection.Where<ChapterSection>(m => m.theCourseChapter == cc.Id).ToList(); foreach (var cs in result) { lvm.chapterSection.Add(cs); } lvm.courseChapter.Add(cc); } //var num = lpfe.ChapterLearning.Count(m => m.Id == id && m.theLearner == userId); //if (num > 0) //{ // var chapterLearning = lpfe.ChapterLearning.Single(m => m.Id == id && m.theLearner == userId); // lvm.chapterLearning = chapterLearning.theChapter; // var sectionLearning = lpfe.SectionLearning.Single(m => m.Id == id && m.theLearner == userId); // lvm.sectionLearning = sectionLearning.theSection; //} //else //{ // lvm.chapterLearning = 1; // lvm.sectionLearning = 1; //} var num = 0; var chapid = lpfe.CourseChapter.Where(m => m.theCourse == id).ToList(); foreach (var chid in chapid) { num = lpfe.ChapterLearning.Count(m => m.theLearner == userId & m.theChapter == chid.Id); if (num == 1) { num = 1; break; } } if (num > 0) { var chapterid = lpfe.ChapterLearning.Where(m => m.theLearner == userId).ToList(); foreach (var c in chapterid) { var cid = lpfe.CourseChapter.Single(m => m.Id == c.theChapter); if (id == cid.theCourse) { lvm.chapterLearning = cid.SequenceType; var sectionid = lpfe.SectionLearning.Where(m => m.theLearner == userId).ToList(); foreach (var st in sectionid) { var sid = lpfe.ChapterSection.Single(m => m.Id == st.theSection); if (sid.theCourseChapter == cid.Id) { lvm.sectionLearning = Convert.ToInt32(sid.SectionOrd); } } num = 1; break; } else { num = 0; } } } if(num<=0) { var cl = lpfe.CourseChapter.Single(m => m.theCourse == id & m.SequenceType == 1); var sl = lpfe.ChapterSection.Single(m => m.theCourseChapter == cl.Id & m.SectionOrd == "1"); lvm.chapterLearning = cl.SequenceType; lvm.sectionLearning = Convert.ToInt32(sl.SectionOrd); } return View(lvm); } else { return Redirect("~/Payment/Index/" + Id); } //LearningPlatformEntities lpfe = new LearningPlatformEntities(); //LearningViewModels lvm = new LearningViewModels(); //lvm.courseChapter = new List<CourseChapter>(); //lvm.chapterSection = new List<ChapterSection>(); //lvm.courses = new List<Course>(); //lvm.courses.Add(lpfe.Course.Single<Course>(m => m.Id == 1)); //var CourseChapter = lpfe.CourseChapter.Where<CourseChapter>(m => m.theCourse==1).ToList(); //foreach (var cc in CourseChapter) //{ // var result = lpfe.ChapterSection.Where<ChapterSection>(m => m.theCourseChapter == cc.Id).ToList(); // foreach (var cs in result) // { // lvm.chapterSection.Add(cs); // } // lvm.courseChapter.Add(cc); //} //var lbm = lpfe.LearnerBookmarker.Single(m => m.theCourse == 1); //if (lbm.theExerciseSet == null && lbm.theTestSet != null) //{ // var cChapter = lpfe.TestSet.Single(m => m.Id == lbm.theTestSet); // var cSection = lpfe.ChapterSection.Single(m => m.Id == cChapter.theChapterSection); // lvm.courseChap = cSection.theCourseChapter; // lvm.chapterSec = Convert.ToInt32(cSection.SectionOrd.ToString()); //} //else if (lbm.theExerciseSet != null && lbm.theTestSet == null) //{ // var cChapter = lpfe.ExerciseSet.Single(m => m.Id == lbm.theExerciseSet); // var cSection = lpfe.ChapterSection.Single(m => m.Id == cChapter.theChapterSection); // lvm.courseChap = cSection.theCourseChapter; // lvm.chapterSec = Convert.ToInt32(cSection.SectionOrd.ToString().Trim()); //} //return View(lvm); }
public int judge(string chapterSectionId) { LearningPlatformEntities lpfe = new LearningPlatformEntities(); var cid = Convert.ToInt32(chapterSectionId); var uid = User.Identity.GetUserId(); var userId = lpfe.AspNetUsers.Single(m => m.Id == uid).NewId; var type = lpfe.ChapterSection.Single(m => m.Id == cid).SectionType; var count = 0; if (type == 1) { var es = lpfe.ExerciseSet.Where(m => m.theChapterSection == cid).ToList(); foreach (var e in es) { count = lpfe.ExerciseSetTracking.Count(m => m.theExerciseSet == e.Id & m.theLearner == userId); if (count == 1) { break; } } } else { var ts = lpfe.TestSet.Where(m => m.theChapterSection == cid).ToList(); foreach (var t in ts) { count = lpfe.TestSetTracking.Count(m => m.theTestSet == t.Id & m.theLearner == userId); if (count == 1) { break; } } } return count; }
public ActionResult Result() { string merId, amt, merTransId, transId, transTime; LearningPlatformEntities lpfe = new LearningPlatformEntities(); if (RemotePost.PaymentVerify(Request, out merId, out amt, out merTransId, out transId, out transTime) && merId == "Team05") { int orderid = Convert.ToInt32(merTransId); var coursid = 0; var ord = lpfe.Order.Single(m => m.Id == orderid); try { using (TransactionScope ts = new TransactionScope()) { //add learnerbookmarker LearnerBookmarker lbm = lpfe.LearnerBookmarker.Add(new LearnerBookmarker()); lbm.theLearner = ord.theUser; lbm.theCourse = ord.theCourse; lbm.theLearnerCourseState = 1; lbm.LearningTime = 0; lbm.theCourseObject = 1; lbm.theLearnerType = 1; lbm.theLearnerAbility = 1; lbm.RegiseterDate = DateTime.Now; //update order ord.Orderstate = 1; coursid = ord.theCourse; //initial learning //var cha = lpfe.CourseChapter.Single(m => m.theCourse == coursid&m.SequenceType==1).Id; //var sec = lpfe.ChapterSection.Single(m => m.theCourseChapter == cha&m.SectionOrd=="1").Id; //ChapterLearning cl = lpfe.ChapterLearning.Add(new ChapterLearning()); //cl.theChapter = cha; //cl.theLearner = ord.theUser; //cl.theLearningState = 0; //SectionLearning sl = lpfe.SectionLearning.Add(new SectionLearning()); //sl.theLearner = ord.theUser; //sl.theLearningState = 0; //sl.theSection = sec; lpfe.SaveChanges(); ts.Complete(); } ViewBag.paymentstate = 1; ViewBag.paymentMsg = "付款成功! 付款号:" + merTransId.ToString() + "; 金额:" + amt.ToString() + "元。";//付款成功!显示付款信息作为测试。 } catch (Exception ex) { ViewBag.paymentstate = 0; ViewBag.paymentMsg = "付款失败!请重试" + ex.Message; } ViewBag.courseid = coursid; } return View(); }