Ejemplo n.º 1
0
 public ActionResult Register(string act = "")
 {
     ViewData["grads"] = CategroyService.FindByParent(0);
     ViewData["cates"] = CategroyService.FindByParent(1);
     if (act == "teacher")
     {
         return(View("RegisterTeacher"));
     }
     return(View());
 }
Ejemplo n.º 2
0
 public ActionResult Info()
 {
     ViewData["grads"] = CategroyService.FindByParent(0);
     ViewData["cates"] = CategroyService.FindByParent(1);
     if (base.CurrentUser.roleName == UsersService._STUDENT)
     {
         return(View(base.CurrentUser));
     }
     else
     {
         return(View("InfoTeacher", base.CurrentUser));
     }
 }
Ejemplo n.º 3
0
        public ActionResult Register(string name, string pwd, string phone, string validateCode, string roleName, string grad,
                                     //教师属性
                                     string email, int categoryId, string degree, string experience)
        {
            ViewData["grads"] = CategroyService.FindByParent(0);
            ViewData["cates"] = CategroyService.FindByParent(1);
            Users student = new Users
            {
                name       = name,
                pwd        = pwd,
                phone      = phone,
                roleName   = roleName,
                grad       = grad,
                email      = email,
                categoryId = categoryId,
                degree     = degree,
                experience = experience
            };

            if (validateCode != base.GetSessionByKey("ValidateCode"))
            {
                ViewData["resp"] = base.RespResult(false, "验证码错误");
            }
            else
            {
                string message = string.Empty;
                Users  user    = LoginService.Register(student, ref message);
                if (string.IsNullOrEmpty(message))
                {
                    FormsAuthent(user);
                    ViewData["resp"] = base.RespResult(true, "注册成功!");
                }
                else
                {
                    ViewData["resp"] = base.RespResult(false, message);
                }
            }

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult Info(string phone, string grad, string school, string parentName, string parentPhone,
                                 //教师属性
                                 string email, int categoryId, string degree, string experience)
        {
            ViewData["grads"] = CategroyService.FindByParent(0);
            ViewData["cates"] = CategroyService.FindByParent(1);
            Users user = base.CurrentUser;

            user.phone       = phone;
            user.grad        = grad;
            user.school      = school;
            user.parentName  = parentName;
            user.parentPhone = parentPhone;
            user.email       = email;
            user.categoryId  = categoryId;
            user.degree      = degree;
            user.experience  = experience;

            bool success = UsersService.Edit(user);

            if (success)
            {
                FormsAuthent(user);
                ViewData["resp"] = base.RespResult(true, "资料更新成功!");
            }
            else
            {
                ViewData["resp"] = base.RespResult(false, "操作失败请稍后重试!");
            }

            if (base.CurrentUser.roleName == UsersService._STUDENT)
            {
                return(View(user));
            }
            else
            {
                return(View("InfoTeacher", user));
            }
        }
Ejemplo n.º 5
0
        //
        // GET: /Course/

        public ActionResult Index(string g = "", string c = "", string key = "")
        {
            ViewData["grads"] = CategroyService.FindByParent(0);
            ViewData["cates"] = CategroyService.FindByParent(1);

            ViewData["g"]   = g;
            ViewData["c"]   = c;
            ViewData["key"] = key;
            IList <Course> list = CourseService.RetrievesAll();

            if (!string.IsNullOrEmpty(g))
            {
                list = list.Where(m => m.grad == g).ToList();
            }
            if (!string.IsNullOrEmpty(c))
            {
                list = list.Where(m => m.categoryName == c).ToList();
            }
            if (!string.IsNullOrEmpty(key))
            {
                list = list.Where(m => m.title.Contains(key)).ToList();
            }
            return(View(list));
        }