コード例 #1
0
 public ActionResult TestSearch(CSearch cs)
 {
     ViewBag.Title   = "搜索试题:" + cs.Key;
     ViewBag.Type    = cs.Type;
     ViewBag.Key     = cs.Key;
     ViewBag.Grade   = string.IsNullOrEmpty(cs.Grade) ? "全部" : cs.Grade;
     ViewBag.Subject = string.IsNullOrEmpty(cs.Subject) ? "全部" : cs.Subject;
     ViewBag.Topic   = string.IsNullOrEmpty(cs.Topic) ? "全部" : cs.Topic;
     return(View());
 }
コード例 #2
0
 public ActionResult PaperSearch(CSearch cs)
 {
     ViewBag.Title    = "搜索试卷:" + cs.Key;
     ViewBag.Type     = cs.Type;
     ViewBag.Key      = cs.Key;
     ViewBag.Grade    = string.IsNullOrEmpty(cs.Grade) ? "全部" : cs.Grade;
     ViewBag.Year     = string.IsNullOrEmpty(cs.Year) ? "全部" : cs.Year;
     ViewBag.Kind     = string.IsNullOrEmpty(cs.Kind) ? "全部" : cs.Kind;
     ViewBag.Province = string.IsNullOrEmpty(cs.Province) ? "全部" : cs.Province;
     ViewBag.Subject  = string.IsNullOrEmpty(cs.Subject) ? "全部" : cs.Subject;
     ViewBag.Years    = DateTime.Now.Year;
     return(View());
 }
コード例 #3
0
        public ActionResult Search(CSearch cs)
        {
            EODB eodb = new EODB();

            if (cs.Type == "试题")
            {
                List <QuestionInfo> questioninfo = new List <QuestionInfo>();
                questioninfo = (from i in eodb.questioninfo
                                where (i.Question_Title.Contains(cs.Key)) && (i.Question_Grade == ((cs.Grade == "全部") ? i.Question_Grade : cs.Grade)) && (i.Question_Subject == ((cs.Subject == "全部") ? i.Question_Subject : cs.Subject)) && (i.Question_Topic == ((cs.Topic == "全部") ? i.Question_Topic : cs.Topic))
                                select i).ToList <QuestionInfo>();
                return(Json(questioninfo));
            }
            else
            {
                List <PaperInfo> paperinfo = new List <PaperInfo>();
                paperinfo = (from i in eodb.paperinfo
                             where (i.Paper_Grade == ((cs.Grade == "全部") ? i.Paper_Grade : cs.Grade)) && (i.Paper_Year == ((cs.Year == "全部") ? i.Paper_Year : cs.Year)) && (i.Paper_Kind == ((cs.Kind == "全部") ? i.Paper_Kind : cs.Kind)) && (i.Paper_Province == ((cs.Province == "全部") ? i.Paper_Province : cs.Province)) && (i.Paper_Subject == ((cs.Subject == "全部") ? i.Paper_Subject : cs.Subject)) && (i.Paper_Name.Contains(cs.Key))
                             select i).ToList <PaperInfo>();
                return(Json(paperinfo));
            }
        }