Beispiel #1
0
        public ActionResult Select()
        {
            //格式:key:方向  value:对应排序
            //无法直接将json转换为int,int做了个过渡操作
            int    x, y;
            string jsonText = "{'4':'2','2':'1'}";
            var    user     = StuIsLoginIn.GetUser();
            JavaScriptSerializer        sa        = new JavaScriptSerializer();
            Dictionary <int, int>       jsonData2 = new Dictionary <int, int>();
            Dictionary <string, string> JsonData1 = sa.Deserialize <Dictionary <string, string> >(jsonText);

            foreach (var n in JsonData1)
            {
                x = int.Parse(n.Key);
                y = int.Parse(n.Value);
                jsonData2.Add(x, y);
            }
            if (d.SelectDirection(user.LoginName, jsonData2))
            {
                user.IsCompleted = true;
                s.AddStudent(user);
                return(Content("<script>alert('选择成功!');window.location.href='../Choice/Index';</script>"));
            }
            return(Content("<script>alert('选择失败!');window.location.href='../Choice/Index';</script>"));
        }
Beispiel #2
0
        // GET: Choice
        public ActionResult Index()
        {
            var user = StuIsLoginIn.GetUser();

            ViewData["iscompleted"] = user.IsCompleted;
            return(View());
        }
Beispiel #3
0
        public ActionResult ChangePwd(Student stu)
        {
            var user = StuIsLoginIn.GetUser();

            user.Pwd = stu.Pwd;
            s.AddStudent(user);
            return(Content("<script>alert('修改密码成功');window.location.href='../Choice/Index';</script>"));
        }