Example #1
0
        private void BindData()
        {
            this.page = RequestHelper.GetQueryInt("page", 1);

            DataTable dtids = new BLL.examination_question().GetViewList("View_ExaminationQuestion", " group_id = " + group + " and exa_id = " + exaid);
            string    ids   = string.Empty;

            foreach (DataRow item in dtids.Rows)
            {
                ids += Convert.ToInt32(item["id"]) + ",";
            }

            ids = Utils.DelLastComma(ids);

            string where = " group_id = " + this.group + " and data_id = " + this.chapter;
            if (!string.IsNullOrEmpty(ids))
            {
                where += " and id not in (" + ids + ") ";
            }

            BLL.common_questions bLL = new BLL.common_questions();
            DataTable            dt  = bLL.GetListByPage(where, "id", this.page, this.pageSize);

            this.rptList.DataSource = dt;
            this.rptList.DataBind();

            this.totalCount = bLL.GetRecordCount(where);

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("unselected_question.aspx", "exaid={0}&page={1}&group={2}", this.exaid + "", "__id__", this.group + "");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #2
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.examination_question bll = new BLL.examination_question();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_common_questions", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.examination_question bll = new BLL.examination_question();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(" exa_id = " + this.exaid + " and q_id = " + id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除已选题目信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", "");
            BindData();
        }
Example #4
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_examination_question", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.examination_question bll = new BLL.examination_question();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除试卷题目关联" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords));
        }
 private void BindInfo()
 {
     BLL.examination_question   bll   = new BLL.examination_question();
     Model.examination_question model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtexa_id.Text = model.exa_id + "";
     txtq_id.Text   = model.q_id + "";
 }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_examination_question", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.examination_question   bll   = new BLL.examination_question();
            Model.examination_question model = bll.GetModel(this.id);

            model.exa_id = Convert.ToInt32(txtexa_id.Text);
            model.q_id   = Convert.ToInt32(txtq_id.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改试卷题目关联信息,主键:" + id); //记录日志
                JscriptMsg("修改试卷题目关联信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_examination_question", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtexa_id.Text.Trim() == "" || txtexa_id.Text.Trim().Length > 4)
            {
                strError += "试卷ID为空或超出长度![br]";
            }
            if (txtq_id.Text.Trim() == "" || txtq_id.Text.Trim().Length > 4)
            {
                strError += "题目ID为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.examination_question model = new Model.examination_question();
            BLL.examination_question   bll   = new BLL.examination_question();

            model.exa_id = Convert.ToInt32(txtexa_id.Text);
            model.q_id   = Convert.ToInt32(txtq_id.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加试卷题目关联信息,主键:" + id); //记录日志
                JscriptMsg("添加试卷题目关联信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
        private void BindData()
        {
            this.page = RequestHelper.GetQueryInt("page", 1);

            BLL.examination_question bll = new BLL.examination_question();
            this.rptList.DataSource = bll.GetListByPage("*", "View_ExaminationQuestion", " exa_id = " + exaid, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid);
            int score        = bll.GetSumCount("score", "View_ExaminationQuestion", " exa_id = " + exaid);
            int singleSelete = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.单选题);
            int muliteSelete = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.多选题);
            int istrueth     = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.判断题);
            int input        = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.填空题);
            int subjective   = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.主观题);

            this.lblCount.Text = string.Format("共 {0} 道题目,总分 {1} 分。其中单选题 {2} 道,多选题 {3} 道,判断题 {4} 道,填空题 {5} 道,主观题 {6} 道。",
                                               this.totalCount, score, singleSelete, muliteSelete, istrueth, input, subjective);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("selected_question.aspx", "exaid={0}&page={1}", this.exaid + "", "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #9
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_common_questions", EnumCollection.ActionEnum.Add.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            string allid = hdfAllID.Value;

            string[] ids = allid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            BLL.examination_question bll = new BLL.examination_question();
            int id = 0;

            for (int i = 0; i < ids.Length; i++)
            {
                id = Convert.ToInt32(ids[i]);
                Model.examination_question model = bll.GetModel(" exa_id = " + this.exaid + " and q_id = " + id);
                if (model == null)
                {
                    //添加
                    model        = new Model.examination_question();
                    model.exa_id = this.exaid;
                    model.q_id   = id;

                    if (bll.Add(model) > 0)
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
                else
                {
                    errorCount += 1;
                }
            }

            hdfAllID.Value = "";
            //for (int i = 0; i < rptList.Items.Count; i++)
            //{
            //    int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            //    CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            //    if (cb.Checked)
            //    {
            //        Model.examination_question model = bll.GetModel(" group_id = " + this.group + " and exa_id = " + this.exaid + " and q_id = " + id);
            //        if (model == null)
            //        {
            //            //添加
            //            model = new Model.examination_question();
            //            model.exa_id = this.exaid;
            //            model.q_id = id;

            //            if (bll.Add(model) > 0)
            //            {
            //                sucCount += 1;
            //            }
            //            else
            //            {
            //                errorCount += 1;
            //            }
            //        }
            //        else
            //        {
            //            errorCount += 1;
            //        }
            //    }
            //}
            AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加未选题目信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("添加成功" + sucCount + "条,失败" + errorCount + "条!", "");
            BindData();
        }
Example #10
0
        private void BindData()
        {
            BLL.course_chapter   ccBll   = new BLL.course_chapter();
            Model.course_chapter chapter = ccBll.GetModel(this.chapter);
            if (chapter == null)
            {
                JscriptMsg("没有此节", "back");
                return;
            }

            this.chapter_name = chapter.name;
            Model.course_chapter pModel = ccBll.GetModel(chapter.parent_id);
            if (pModel == null)
            {
                JscriptMsg("没有此章", "back");
                return;
            }

            this.parent_name = pModel.name;
            Model.classroom_info ciModel = new BLL.classroom_info().GetModel(pModel.course_id);
            if (ciModel == null)
            {
                JscriptMsg("没有此课堂", "back");
                return;
            }

            this.class_name = ciModel.name;
            Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' ");
            if (user == null)
            {
                JscriptMsg("没有此教师", "back");
                return;
            }

            if (ciModel.user_id != user.id)
            {
                JscriptMsg("此课堂不属于你", "back");
                return;
            }

            Model.common_examination exaModel = new BLL.common_examination().GetModel(this.exa_id);
            if (exaModel == null)
            {
                JscriptMsg("没有此作业", "back");
                return;
            }

            this.examination = exaModel.name;
            #region 组装查询条件
            string whereStr = " 1 = 1 ";

            DataTable dtids = new BLL.examination_question().GetList(" exa_id = " + this.exa_id);
            string    ids   = string.Empty;
            foreach (DataRow item in dtids.Rows)
            {
                ids += Convert.ToInt32(item["q_id"]) + ",";
            }

            ids = Utils.DelLastComma(ids);

            if (!string.IsNullOrEmpty(ids))
            {
                whereStr += " and id in (" + ids + ") ";
            }


            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("currect_question_list.aspx", "keywords={0}", ""));
                    return;
                }
            }

            if (this.type > 0)
            {
                this.ddlType.SelectedValue = this.type + "";
                whereStr += " and type = " + this.type;
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_questions bll = new BLL.common_questions();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("currect_question_list.aspx", "keywords={0}&page={1}&type={2}", this.keywords, "__id__", this.type + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }