Exemplo n.º 1
0
        /// <summary>
        /// 查询学生已选的论题信息
        /// </summary>
        /// <param name="sno"></param>
        /// <returns></returns>
        public PersonalThesis QueryThesisInfo(string sno)
        {
            SqlParameter   snoParameter = new SqlParameter("@sno", sno);
            PersonalThesis pt           = new PersonalThesis();
            DataTable      dt           = SqlHelper.ExecuteDataTableProc("QueryThesisOfStudent", new SqlParameter[] { snoParameter });

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            else
            {
                #region 查询结果非空
                Object[] values = new object[dt.Columns.Count];
                foreach (DataRow row in dt.Rows)
                {
                    int index = 0;
                    foreach (DataColumn column in dt.Columns)
                    {
                        values[index++] = row[column];
                    }
                    break;
                }
                try
                {
                    pt.thesisId = Convert.ToInt64(values[0]);
                    pt.name     = Convert.ToString(values[1]);
                    pt.type     = Convert.ToString(values[2]);
                    pt.content  = Convert.ToString(values[3]);
                    pt.response = Convert.ToString(values[4]);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    throw e;
                }
                #endregion
                return(pt);
            }
        }
        /// <summary>
        /// 返回一个学生选题主页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var            bll      = new StudentBll();
            string         account  = Session["account"].ToString();
            long           thesisid = bll.QueryThesisId(account);
            List <string>  list     = bll.QueryTeacherOpinionBll(account, thesisid);
            PersonalThesis thesis   = bll.QueryThesisInfo(account);

            thesis = thesis ?? new PersonalThesis(-1, "", "", "", "");
            int[] weight     = bll.QueryThesisStatus(thesisid);
            int   passWeight = Convert.ToInt32(HttpContext.Application["pastWeight"]);

            #region 论题状态判断
            string thesisStatus = "";
            if (weight[0] < 1)
            {
                thesisStatus = "暂时没有课题信息";
            }
            else if (weight[0] > 0 && weight[1] < passWeight)
            {
                thesisStatus = "课题审核中";
            }
            else if (weight[1] >= passWeight)
            {
                thesisStatus = "课题审核通过";
            }
            else if (weight[0] == passWeight && weight[1] < passWeight)
            {
                thesisStatus = "审核不通过";
            }
            #endregion
            ViewBag.status     = thesisStatus;
            ViewBag.thesisInfo = thesis;
            ViewBag.advertise  = list;
            ViewBag.username   = bll.GetName(account);
            ViewBag.sno        = account;
            return(View());
        }