예제 #1
0
        private void DelSelectedData()
        {
            var obj = new
            {
                code = 0,
                msg  = ""
            };

            try
            {
                string data     = Request.Form["data"];
                var    dataList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.userInfo> >(data);
                var    bll      = new BLL.userInfoBLL();
                foreach (var dd in dataList)
                {
                    bll.Delete(dd);
                }
            }
            catch (Exception ex)
            {
                obj = new
                {
                    code = 99,
                    msg  = ex.ToString()
                };
            }
            ResponseJson(obj);
        }
예제 #2
0
        private void QueryUserInfo()
        {
            StringBuilder s_wherClause      = new StringBuilder();
            string        code              = Request.QueryString["code"];
            string        name              = Request.QueryString["name"];
            string        userType          = Request.QueryString["userType"];
            int           limit             = Request.QueryString["limit"].AsInt();
            int           page              = Request.QueryString["page"].AsInt();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(code))
            {
                s_wherClause.AppendAnd("code=@code");
                dic.Add("code", code);
            }
            if (!string.IsNullOrEmpty(name))
            {
                s_wherClause.AppendAnd("name like @name");
                dic.Add("name", "%" + name + "%");
            }
            if (!string.IsNullOrEmpty(userType))
            {
                s_wherClause.AppendAnd("userType=@userType");
                dic.Add("userType", userType);
            }

            List <Models.userInfo> dataList = new BLL.userInfoBLL().Query(s_wherClause.ToString(), dic);
            int count = dataList.Count;

            dataList = dataList.OrderBy(a => a.code).Skip((page - 1) * limit).Take(limit).ToList();
            var obj = new
            {
                code = 0,
                msg  = "",
                count,
                data = dataList
            };

            ResponseJson(obj);
        }
예제 #3
0
        private void QueryStudent()
        {
            StringBuilder s_wherClause      = new StringBuilder();
            Dictionary <string, object> dic = new Dictionary <string, object>();
            string code       = Request.QueryString["code"];
            string name       = Request.QueryString["name"];
            int    examDescId = Request.QueryString["examDescription_id"].AsInt();

            if (!string.IsNullOrEmpty(code))
            {
                s_wherClause.AppendAnd("code=@code");
                dic.Add("code", code);
            }
            if (!string.IsNullOrEmpty(name))
            {
                s_wherClause.AppendAnd("name like @name");
                dic.Add("name", "%" + name + "%");
            }


            s_wherClause.AppendAnd("userType=@userType");
            dic.Add("userType", "学生");


            s_wherClause.AppendAnd("not exists(select 1 from v_examStudent where code=scode and examDescription_id=@examDescription_id)");
            dic.Add("examDescription_id", examDescId);
            List <Models.userInfo> dataList = new BLL.userInfoBLL().Query(s_wherClause.ToString(), dic);
            int count = dataList.Count;
            var obj   = new
            {
                code = 0,
                msg  = "",
                count,
                data = dataList
            };

            ResponseJson(obj);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (action)
            {
            case "HandInExam":
                HandInExam();
                break;
            }
            if (!string.IsNullOrEmpty(action))
            {
                return;
            }
            //ID
            int exam_des_id = Request.QueryString["exam_des_id"].AsInt();
            //编码
            string scode = Request.QueryString["scode"];

            //查询用户信息
            UserInfo = new BLL.userInfoBLL().SingleQuery(new object[] { scode });
            //查询用户考试试卷
            ExamResult = new BLL.examResultBLL().SingleQueryByCode(scode);
            //查询试卷信息
            ExamDesc = new BLL.examDescriptionBLL().SingleQuery(new object[] { exam_des_id });
            //校验
            if (UserInfo == null)
            {
                ResponseAlert("考生信息不存在", "/Exam/Login.aspx");
            }
            if (ExamDesc == null)
            {
                ResponseAlert("未找到试卷信息,请联系管理员", "/Exam/Login.aspx");
            }
            if (ExamResult == null)
            {
                ResponseAlert("考生未安排考试", "/Exam/Login.aspx");
            }
            else
            {
                if (ExamResult.kszt == "已考")
                {
                    ResponseAlert("考生已完成考试,不允许重复考试", "/Exam/Login.aspx");
                }
                if (ExamResult.kszt == "缺考")
                {
                    ResponseAlert("考生已完成考试,不允许重复考试", "/Exam/Login.aspx");
                }
                if (ExamResult.kszt == "考试中")
                {
                    if (ExamResult.kssj.Value.AddMinutes(ExamDesc.costTime) < DateTime.Now)
                    {
                        ExamResult.jssj = DateTime.Now;
                        ExamResult.kszt = "缺考";
                        new BLL.examResultBLL().Edit(ExamResult);
                        ResponseAlert("考试已结束,您的本次考试将视为缺考", "/Exam/Login.aspx");
                    }
                }
            }

            if (ExamResult.kszt == "待考")
            {
                ExamResult.kssj = DateTime.Now;
                ExamResult.kszt = "考试中";
            }
            new BLL.examResultBLL().Edit(ExamResult);
        }