| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using NEducation.Code;
- using NEducation.Models;
- namespace NEducation.Controllers
- {
- public class IndividualController : Controller
- {
- // GET: Individual
- public ActionResult Index(String courseType)
- {
- Session["navitab"] = "Individual";
- try
- {
- if (CheckAuthToken())
- {
- System.Diagnostics.Debug.WriteLine(" individual courseType: " + courseType);
- // save courseType
- if (courseType == null || Session["individual_courseType"] == null) Session["individual_courseType"] = "1";
- else Session["individual_courseType"] = courseType;
- IndividualModel model = new IndividualModel();
- model.profileDetail = Session["profile"] as UserProfile;
- // get history
- UserRequest userRequest = new UserRequest();
- userRequest.msisdn = Session["msisdn"] as String;
- userRequest.users = Session["msisdn"] as String;
- userRequest.categoryCode = UtilsController.GetCategoryCode(courseType);
- // get vocabulary history
- string rs = UtilsController.SendPost(userRequest, Session.SessionID, UtilsController.WsType.GetCourseHis);
- System.Diagnostics.Debug.WriteLine("individual res: " + rs);
- UserActionResult res = new UserActionResult(rs);
- if (res.status == UtilsController.Constant.SUCCESS)
- {
- History history = new History(rs);
- model.history = history;
- Session["model"] = model;
- return View("Index", model);
- }
- else
- {
- return Redirect("/Common/Error");
- }
- }
- else
- {
- Session.Clear();
- return Redirect("/Home/Index");
- }
- }
- catch (Exception ex)
- {
- return Redirect("/Common/Error");
- }
- }
- private bool CheckAuthToken()
- {
- if (Session["AuthToken"] != null && Request.Cookies["AuthToken"] != null)
- {
- if (!Session["AuthToken"].ToString().Equals(Request.Cookies["AuthToken"].Value))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- }
- }
- }
|