public ActionResult SoftDownList() { int UserID = int.Parse(TakeCookie.GetCookie("userId")); Tb_ApplyTable modelTable = (Tb_ApplyTable)mHelp.GetModelBy <Tb_ApplyTable>(m => m.UserID == UserID); if (modelTable != null) { List <Tb_ApplySoftList> list = mHelp.GetListBy <Tb_ApplySoftList>(m => m.ApplyID == modelTable.ApplyID); if (list != null) { List <Tb_SoftList> listSoft = new List <Tb_SoftList>(); foreach (Tb_ApplySoftList item in list) { Tb_SoftList soft = (Tb_SoftList)mHelp.GetModelBy <Tb_SoftList>(m => m.SoftID == item.SoftID); if (soft != null) { listSoft.Add(soft); } } if (listSoft != null) { ViewBag.listSoft = listSoft; return(View()); } } } return(View("index")); //List<Tb_SoftList> listSoft = mHelp.GetAll<Tb_SoftList>(); }
public ActionResult ChangePass(int id) { if (id != 0) { Tb_ApplyTable modelTable = db.Tb_ApplyTable.Find(id); modelTable.IsPass = 1; db.SaveChanges(); } return(RedirectToAction("ApplyList")); }
// // GET: public ActionResult EditApplyTable(int id = 0) { Tb_ApplyTable tb_applytable = db.Tb_ApplyTable.Find(id); if (tb_applytable == null) { return(HttpNotFound()); } return(View(tb_applytable)); }
public ActionResult ApplySuccess() { int id = int.Parse(TakeCookie.GetCookie("userId")); Tb_ApplyTable model = (Tb_ApplyTable)mHelp.GetModelBy <Tb_ApplyTable>(m => m.UserID == id); if (model != null) { ViewBag.appID = model.ApplyID; } return(View()); }
public ActionResult EditApplyTable(Tb_ApplyTable tb_applytable) { //对于不能由用户填写的字段手动赋值 tb_applytable.RecordTime = DateTime.Now; tb_applytable.IsPass = 0; tb_applytable.UserID = int.Parse(TakeCookie.GetCookie("userId")); //判断模型状态是否验证通过 if (ModelState.IsValid) { db.Entry(tb_applytable).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ApplySuccess")); } return(RedirectToAction("ApplySuccess", "SoftDown")); }
//[Common.Skip] public ActionResult Index(Tb_SoftUser userModel) { //根据页面传来的值,调用GetUser方法 Tb_SoftUser user = GetUser(userModel); if (user == null) { return(View()); } else { //保存user 到cookie TakeCookie.SetCookie("userId", user.UserID.ToString()); if (user.UserType == 0)//普通用户 { TakeCookie.SetCookie("userRole", "user"); Tb_ApplyTable modelTable = (Tb_ApplyTable)mHelp.GetModelBy <Tb_ApplyTable>(m => m.UserID == user.UserID); if (modelTable != null) //如果已经有过申请,不得再次申请 { if (modelTable.IsPass == 0) //如果申请未通过,则进入未通过界面 { return(RedirectToAction("ApplySuccess")); } else//如果通过,则进入软件下载界面 { return(RedirectToAction("SoftDownList")); } } else//如果没有申请,进入申请界面 { return(View("ApplyTable")); } } else//管理员用户 { TakeCookie.SetCookie("userRole", "admin"); return(RedirectToAction("ApplyList")); } } //跳转到ApplyList方法 }
/// <summary> /// 显示某申请表的详细信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult AdminApplyDetail(int id) { //用于显示申请表的信息 Tb_ApplyTable applyTableModel = db.Tb_ApplyTable.Where(c => c.ApplyID == id).FirstOrDefault(); //用于显示申请的软件列表的信息 var queryApplySoftList = from n in db.Tb_ApplySoftList where n.ApplyID == id select n; ViewBag.ApplySoftList = queryApplySoftList; //用于显示课程设置列表的信息 var querySoftCourseList = from n in db.Tb_SoftCourse where n.ApplyID == id select n; ViewBag.SoftCourseList = querySoftCourseList; return(View(applyTableModel)); }
public ActionResult ApplyTable(Tb_ApplyTable ApplyTable) { ApplyTable.RecordTime = DateTime.Today; ApplyTable.UserID = int.Parse(TakeCookie.GetCookie("userId")); ApplyTable.IsPass = 0; //ModelState.IsValid用于 if (ModelState.IsValid) { if (mHelp.Add <Tb_ApplyTable>(ApplyTable) > 0) { Session["ApplyID"] = ApplyTable.ApplyID; return(RedirectToAction("SoftList", new { id = ApplyTable.ApplyID })); } else { return(View()); } } return(View("index")); }