/// <summary>
        /// 2017年3月23日 14:01:24
        /// 查询当年所有通过通过审核的论题
        /// </summary>
        /// <returns>对象数组</returns>
        public ActionResult QueryAllPassExamineThesis()
        {
            int year   = Convert.ToInt32(HttpContext.Application["userYear"]);
            var result = new ThesisDal().QueryAllPassExamineThesis("QueryAllPassThesis", year);

            return(Json(result));
        }
        /// <summary>
        /// 查询指定年份教师拟定的论题
        /// </summary>
        /// <returns></returns>
        public ActionResult QueryAllThesisOfTeacher()
        {
            int    year      = Convert.ToInt32(HttpContext.Application["userYear"]);
            string teacherid = Convert.ToString(Session["Account"]);
            var    result    = new ThesisDal().QueryAllThesisOfTeacher(teacherid, year);

            return(Json(result));
        }
        /// <summary>
        /// 查询选了指导老师非自拟题学生的学号、姓名、课题号、课题名
        /// </summary>
        /// <param name="proc">存储过程名称</param>
        /// <param name="parameters">存储过程占位符参数,主要有@year、@teacherId、@isagree</param>
        /// <returns></returns>
        public List <ChooseTeacherThesis> QueryChooseTeacherThesisInfo(string proc, Object[] parameters)
        {
            var          chooseThesisDal    = new ThesisDal();
            SqlParameter yearParameter      = new SqlParameter("@year", parameters[0]);
            SqlParameter teacherIdParameter = new SqlParameter("@teacherId", parameters[1]);
            SqlParameter isAgreeParameter   = new SqlParameter("@isagree", parameters[2]);

            SqlParameter[] args = new[] { yearParameter, teacherIdParameter, isAgreeParameter };
            return(chooseThesisDal.QueryChooseTeacherThesisInfo(proc, args));
        }
        /// <summary>
        /// 审题页面点击审查按钮跳转到题目详细子页面
        /// </summary>
        /// <param name="id">论题id号</param>
        /// <returns></returns>
        public ActionResult ThesisDetail(long id)
        {
            Thesis        thesis          = (Thesis)DbOperation.QueryById(typeof(Thesis), id, "thesis");
            List <string> suggestionsList = new ThesisDal().QueryInspectThesisSuggestionById(id);

            ViewBag.name          = thesis.topicTitle;
            ViewBag.status        = thesis.topicStatus;
            ViewBag.content       = thesis.topicContext;
            ViewBag.type          = thesis.topicType;
            ViewBag.suggestion    = suggestionsList;
            ViewBag.suggestionNum = suggestionsList.Count;
            return(View());
        }
        /// <summary>
        /// 教师同意学生选定自己做导师
        /// </summary>
        /// <param name="proc"></param>
        /// <param name="teacherid"></param>
        /// <param name="other">other为SnoAndThesis的集合,集合中每一个元素存放学号和课题号</param>
        /// <returns></returns>
        public bool ExecuteTeacherChooseStudentTran(string proc, string teacherid, List <SnoAndThesis> other)
        {
            int count = 0;

            foreach (SnoAndThesis o in other)
            {
                SqlParameter sno                = new SqlParameter("@student_no", o.sno);
                SqlParameter thesisid           = new SqlParameter("@thesis_no", Convert.ToInt64(o.thesisid));
                SqlParameter teacheridParameter = new SqlParameter("@tutor_no", teacherid);
                count = new ThesisDal().ExecuteChooseStudentTran(proc,
                                                                 new SqlParameter[] { sno, teacheridParameter, thesisid })
                    ? count + 1
                    : count;
            }
            return(count == other.Count ? true : false);
        }
        public ActionResult Teacher()
        {
            string              teacherid           = (string)Session["Account"];
            int                 usingYear           = Convert.ToInt32(HttpContext.Application["userYear"]);
            ThesisDal           thesisInit          = new ThesisDal();
            List <PartOfThesis> unPassExamineThesis = thesisInit.QueryAllNotPassExamineTesis(usingYear);

            ViewBag.unExamineThesisId       = unPassExamineThesis.Select(a => a.topicId).ToArray();
            ViewBag.unExamineThesisMaker    = unPassExamineThesis.Select(a => a.makerName).ToArray();
            ViewBag.unExamineThesisTitle    = unPassExamineThesis.Select(a => a.topicTitle).ToArray();
            ViewBag.unExamineThesisSource   = unPassExamineThesis.Select(a => a.topicSources).ToArray();
            ViewBag.unExamineThesisType     = unPassExamineThesis.Select(a => a.topicType).ToArray();
            ViewBag.unExamineThesisMaxCount = unPassExamineThesis.Select(a => a.maxOptionalNumber).ToArray();

            List <StudentMakeThesis> studentMakeThesesList = thesisInit.QueryStudentMakeThesisInfo(teacherid, usingYear);

            ViewBag.snoArray          = studentMakeThesesList.Select(s => s.sno).ToArray();
            ViewBag.nameArray         = studentMakeThesesList.Select(s => s.name).ToArray();
            ViewBag.thesisIdArray     = studentMakeThesesList.Select(s => s.thesis_id).ToArray();
            ViewBag.thesisNameArray   = studentMakeThesesList.Select(s => s.thesis_name).ToArray();
            ViewBag.thesisStatusArray = studentMakeThesesList.Select(s => s.thesis_status).ToArray();
            return(View());
        }