// // GET: /UserProblems/Create public ActionResult Create() { string tid = "1"; string cid = "1"; UserProfileModel userprofile = GetMyProfile(); ViewBag.showAssignTo = userprofile.Department; Department clsDepartment = new Department(); Category clsCategory = new Category(); ViewData["CategoryID"] = new SelectList(clsCategory.getFCategoryList(tid, "", " -- "), "CateId", "CateName", cid); Problems clsProblems = new Problems(); ViewBag.UserNewQuestion = clsProblems.UserNewQuestion(User.Identity.Name); ViewBag.UserSolveQuestion = clsProblems.UserSolveQuestion(User.Identity.Name); return View(); }
/// <summary> /// 问题列表 /// </summary> public ActionResult AdminProblems(int? pageNo, int? tid, int? layer, int? cid, string sort, string order) { Problems clsProblems = new Problems(); Category clsCategory = new Category(); Pager pager = new Pager(); int typeid = tid ?? 0; int layerid = layer ?? 0; int cateid = cid ?? 0; pager.PageNo = pageNo ?? 1; pager.PageSize = 10; if (cateid > 0) pager = clsProblems.GetReplyPaging(pager, clsCategory.GetCategoryIds(cateid), sort, string.IsNullOrWhiteSpace(order) ? "desc" : order); else pager = clsProblems.GetReplyPaging(pager, cateid, sort, string.IsNullOrWhiteSpace(order) ? "desc" : order); ViewBag.PageNo = pageNo ?? 1;//页码 ViewBag.PageCount = pager.PageCount;//总页数 ViewBag.TypeId = typeid; ViewBag.LayerId = layerid; ViewBag.Cid = cateid; ViewBag.Sort = sort; ViewBag.Order = order; List<CategoryModel> catelist = clsCategory.getFCategoryList(typeid.ToString(), "", " -- "); catelist.Insert(0, new CategoryModel { CateId = "0", CateName = res.SelectSubcategories }); ViewBag.CurrentItem = layerid > 0 ? "l" + layerid.ToString() : "t" + typeid.ToString(); ViewData["CateId"] = new SelectList(catelist, "CateId", "CateName", cateid); return View(pager.Entity); }
public ActionResult QuestionCount() { Problems clsProblems = new Problems(); ViewBag.MyReplayCount = clsProblems.MyReplayQuestionCount(User.Identity.Name); ViewBag.NewQuestion = clsProblems.NewQuestionsCount(); ViewBag.QuestionCount = clsProblems.QuestionCount(); ViewBag.SolvedQuestionCount = clsProblems.SolvedQuestionCount(); ViewBag.MySolvedQuestionCount = clsProblems.MYSolvedQuestionCount(User.Identity.Name); return PartialView("_Console"); }
//问题列表 // GET: /Problems/ public ViewResult Index(int? pageNo, int? cid, string sort, string order) { Problems clsProblems = new Problems(); Category clsCategory = new Category(); Pager pager = new Pager(); int cateid = cid ?? 0; pager.PageNo = pageNo ?? 1; pager.PageSize = 20; if (cateid > 0) pager = clsProblems.GetReplyPaging(pager, clsCategory.GetCategoryIds(cateid), sort, string.IsNullOrWhiteSpace(order) ? "desc" : order, User.Identity.Name); else pager = clsProblems.GetReplyPaging(pager, cateid, sort, string.IsNullOrWhiteSpace(order) ? "desc" : order, User.Identity.Name); ViewBag.PageNo = pageNo ?? 1;//页码 ViewBag.PageCount = pager.PageCount;//总页数 ViewBag.Cid = cateid; ViewBag.Sort = sort; ViewBag.Order = order; List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); catelist.Insert(0, new CategoryModel { CateId = "0", CateName = res.SelectSubcategories }); ViewData["CateId"] = new SelectList(catelist, "CateId", "CateName", cateid); return View(pager.Entity); }
// // GET: /Problems/Details/5 public ViewResult Details(Guid id) { var NewRecords = (from d in db.Pts_Records where d.ProblemID == id orderby d.CreateTime descending select d).First(); Category clsCategory = new Category(); UserProfileModel userprofile = GetMyProfile(); List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.CategoryID = catelist.Find(c => c.CateId.ToString() == clsPts_Problems.CategoryID.ToString()).CateName.ToString(); Department clsDepartment = new Department(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); ViewBag.Department = userprofile.Department; //显示修改按钮相关 Problems clsProblems = new Problems(); ViewBag.Edit = NewRecords.ProblemStateID.ToString() == "9c3f96c9-1869-41c4-92f5-f81c5f3e6e5c" ? "1" : "0"; return View(clsPts_Problems); }
// // GET: /UserProblems/Details/5 public ViewResult Details(Guid id) { var NewRecords = (from d in db.Pts_Records where d.ProblemID == id orderby d.CreateTime descending select d).First(); Category clsCategory = new Category(); UserProfileModel userprofile = GetMyProfile(); List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.CategoryID = catelist.Find(c => c.CateId.ToString() == clsPts_Problems.CategoryID.ToString()).CateName.ToString(); Department clsDepartment = new Department(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); ViewBag.Department = userprofile.Department; //显示修改按钮相关 Problems clsProblems = new Problems(); ViewBag.UserNewQuestion = clsProblems.UserNewQuestion(User.Identity.Name); ViewBag.UserSolveQuestion = clsProblems.UserSolveQuestion(User.Identity.Name); return View(clsPts_Problems); }