protected void Page_Load(object sender, EventArgs e) { B_ARoleAuth.CheckEx(ZLEnum.Auth.content, "ContentMange"); if (!IsPostBack) { BindDrop(); if (string.IsNullOrEmpty(CAction) || CAction.Equals("Add")) { ddlC_ClassId.Visible = false; txtClassId.Visible = true; txtClassId.Enabled = false; txtClassId.Text = "无所属分类"; if (Cid > 0) { txtClassId.Text = examBll.GetSelect(Cid).C_ClassName; } } else if (CAction.Equals("Modify")) { this.ddlC_ClassId.Visible = true; this.txtClassId.Visible = false; M_Exam_Class examMod = examBll.GetSelect(Cid); if (examMod != null && examMod.C_id > 0) { txtClassName.Text = examMod.C_ClassName; ddlC_ClassId.Text = examMod.C_Classid.ToString(); txtC_OrderBy.Text = examMod.C_OrderBy.ToString(); C_ClassType.SelectedValue = examMod.C_ClassType.ToString(); } } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li> <li><a href='Papers_System_Manage.aspx'>教育模块</a></li> <li><a href='QuestionManage.aspx'>考试管理</a></li><li><a href='Question_Class_Manage.aspx'>分类管理</a></li><li>编辑分类</li>"); } }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { string action = Request.Form["action"]; string result = ""; switch (action) { case "getchild": DataTable dt = knowBll.Select_All(NodeID, DataConverter.CLng(Request.Form["nid"])); result = JsonConvert.SerializeObject(dt); break; default: break; } Response.Write(result); Response.Flush(); Response.End(); return; } //if (!buser.IsTeach() && !badmin.CheckLogin()) { function.WriteErrMsg("只有教师才能访问!"); } if (!IsPostBack) { if (NodeID < 1) { function.WriteErrMsg("未指定科目"); } MyBind(); M_Exam_Class nodeMod = nodeBll.GetSelect(NodeID); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li> <li><a href='Papers_System_Manage.aspx'>教育模块</a></li><li><a href='Question_Class_Manage.aspx'>分类管理</a></li><li>知识点管理 [" + nodeMod.C_ClassName + "] <a href='AddKnowledge.aspx?nid=" + NodeID + "'>[添加知识点]</a></li>"); } }
private string GetClassname(int classid) { M_Exam_Class mqc = bqclass.GetSelect(classid); if (mqc != null && mqc.C_id > 0) { return(mqc.C_ClassName); } else { return(""); } }
public string GetClass(string classid) { M_Exam_Class mqc = bqc.GetSelect(DataConverter.CLng(classid)); if (mqc != null && mqc.C_id > 0) { return(mqc.C_ClassName); } else { return(""); } }
public string GetClass(string classid) { M_Exam_Class mquestion = bqclass.GetSelect(DataConverter.CLng(classid)); if (mquestion != null && mquestion.C_id > 0) { return(mquestion.C_ClassName); } else { return("无分类"); } }
//取类别 public string GetClass(string classid) { int id = DataConverter.CLng(classid); M_Exam_Class mec = nodeBll.GetSelect(id); if (mec != null && mec.C_id > 0) { return(mec.C_ClassName); } else { return(""); } }
public ActionResult AddQuestion_Class() { M_Exam_Class classMod = classBll.GetSelect(Mid); if (classMod.C_id < 1) { classMod.C_Classid = DataConverter.CLng(Request.QueryString["pid"]); } DataTable dt = classBll.Select_All(); DataRow dr = dt.NewRow(); dr["C_ClassName"] = "请选择"; dr["C_id"] = 0; dt.Rows.InsertAt(dr, 0); ViewBag.clist = MVCHelper.ToSelectList(dt, "C_ClassName", "C_id", classMod.C_Classid.ToString()); return(View(classMod)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["menu"] != null && Request.QueryString["menu"] != "") { string menu = Request.QueryString["menu"].ToString(); if (menu.Equals("Edit")) //修改知识点 { this.Label2.Text = "修改知识点"; this.Label1.Text = "修改知识点"; GetClassList(); int kid = DataConverter.CLng(Request.QueryString["k_id"]); bqk = new B_ExamPoint(); M_ExamPoint mqk = bqk.GetSelect(kid); if (mqk != null && mqk.ID > 0) { this.txtK_Name.Text = mqk.TestPoint; this.txtK_OrderBy.Text = mqk.OrderBy.ToString(); this.txtClassId.Visible = false; ddlC_ClassId.Visible = true; ddlC_ClassId.SelectedValue = mqk.ID.ToString(); } } if (menu.Equals("Add")) //添加知识点 { this.Label2.Text = "添加知识点"; this.Label1.Text = "添加知识点"; if (Request.QueryString["C_id"] != null && Request.QueryString["C_id"] != "") { int c_id = DataConverter.CLng(Request.QueryString["C_id"]); bqc = new B_Exam_Class(); M_Exam_Class mqc = bqc.GetSelect(c_id); if (mqc != null && mqc.C_id > 0) { txtClassId.Text = mqc.C_ClassName; this.txtClassId.Enabled = false; ddlC_ClassId.Visible = false; } } } Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>知识点管理</li><li>" + Label2.Text + "</li>"); } } }
//保存 protected void EBtnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(CAction) || CAction.Equals("Add")) { M_Exam_Class mqc = examBll.GetSelectByCName(this.txtClassName.Text.Trim()); if (mqc != null && mqc.C_id > 0) { function.WriteErrMsg("已存在该分类,请重新添加!"); } mqc.C_ClassName = this.txtClassName.Text.Trim(); mqc.C_Classid = Cid; mqc.C_OrderBy = txtC_OrderBy.Text == "" ? 0 : DataConverter.CLng(txtC_OrderBy.Text.Trim()); mqc.C_ClassType = DataConverter.CLng(this.C_ClassType.SelectedValue); int resu = examBll.GetInsert(mqc); if (resu > 0) { function.WriteSuccessMsg("添加成功!", "/Admin/Exam/Question_Class_Manage.aspx"); } else { function.WriteErrMsg("添加失败!"); } } else if (CAction.Equals("Modify")) { M_Exam_Class mqc = examBll.GetSelectByCName(this.txtClassName.Text.Trim()); M_Exam_Class model = examBll.GetSelect(Cid); if ((mqc != null && mqc.C_id > 0) && !model.C_ClassName.Equals(mqc.C_ClassName)) { function.WriteErrMsg("已存在该分类,请重新修改!"); } model.C_ClassName = txtClassName.Text.Trim(); model.C_Classid = DataConverter.CLng(ddlC_ClassId.SelectedValue); model.C_OrderBy = txtC_OrderBy.Text == "" ? 0 : DataConverter.CLng(txtC_OrderBy.Text.Trim()); bool resu = examBll.GetUpdate(model); //更新 if (resu) { function.WriteSuccessMsg("更新成功!", "/Admin/Exam/Question_Class_Manage.aspx"); } else { function.WriteErrMsg("更新失败!"); } } }
public void Question_Class_Add() { M_Exam_Class classMod = classBll.GetSelectByCName(Request.Form["C_ClassName"].Trim(' ')); if (classMod.C_id > 0 && classMod.C_id != Mid) { function.WriteErrMsg("已存在该分类,请重新修改!"); return; } else if (classMod.C_id > 0 && Mid == 0) { function.WriteErrMsg("已存在该分类,请重新添加!"); return; } M_Exam_Class model = classBll.GetSelect(Mid); model.C_ClassName = Request.Form["C_ClassName"].Trim(' '); model.C_Classid = DataConverter.CLng(Request.Form["C_Classid"]); model.C_OrderBy = DataConverter.CLng(Request.Form["C_OrderBy"]); if (model.C_id > 0) { bool resu = classBll.GetUpdate(model); //更新 if (resu) { function.WriteSuccessMsg("更新成功!", "Question_Class_Manage"); return; } else { function.WriteErrMsg("更新失败!"); return; } } else { model.C_ClassType = DataConverter.CLng(Request.Form["C_ClassType"]); int resu = classBll.GetInsert(model); if (resu > 0) { function.WriteSuccessMsg("添加成功!", "Question_Class_Manage"); return; } else { function.WriteErrMsg("添加失败!"); return; } } }
//行绑定 protected void gvPapers_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HyperLink hlName = e.Row.FindControl("hlName") as HyperLink; //标题 HyperLink hlQuestions = e.Row.FindControl("hlQuestions") as HyperLink; //浏览试题 HyperLink hlUpdate = e.Row.FindControl("hlUpdate") as HyperLink; //修改试卷 Label lblClassId = e.Row.FindControl("lblClassId") as Label; //分类 HiddenField hfClassId = e.Row.FindControl("hfClassId") as HiddenField; //分类ID int Classid = DataConverter.CLng(hfClassId.Value); bqc = new B_Exam_Class(); M_Exam_Class mqc = bqc.GetSelect(Classid); if (mqc != null && mqc.C_id > 0) { lblClassId.Text = mqc.C_ClassName; } } }
//文本改变 protected void txtClassName_TextChanged(object sender, EventArgs e) { examBll = new B_Exam_Class(); M_Exam_Class mqc = new M_Exam_Class(); int c_id = DataConverter.CLng(ViewState["Classid"]); examBll = new B_Exam_Class(); M_Exam_Class mqc1 = new M_Exam_Class(); mqc1 = examBll.GetSelect(c_id); mqc = examBll.GetSelectByCName(this.txtClassName.Text.Trim()); if (mqc != null && mqc.C_id > 0) //判断存在该分类 { function.WriteErrMsg("已存在该分类,请重新添加!"); this.EBtnSubmit.Enabled = false; } else { this.EBtnSubmit.Enabled = true; } }
private List <M_Exam_Class> GetSelectByDt(DataTable dt) { List <M_Exam_Class> mqc; if (dt != null && dt.Rows.Count > 0) { mqc = new List <M_Exam_Class>(); foreach (DataRow dr in dt.Rows) { M_Exam_Class mq = new M_Exam_Class(); mq.C_Classid = DataConverter.CLng(dr["C_ClassId"]); mq.C_id = DataConverter.CLng(dr["C_id"]); mq.C_OrderBy = DataConverter.CLng(dr["C_OrderBy"].ToString()); mq.C_ClassName = dr["c_ClassName"].ToString(); mqc.Add(mq); } return(mqc); } else { return(new List <M_Exam_Class>()); } }
public bool GetUpdate(M_Exam_Class model) { return(DBCenter.UpdateByID(model, model.C_Classid)); }
public int GetInsert(M_Exam_Class model) { return(DBCenter.Insert(model)); }
protected void Page_Load(object sender, EventArgs e) { Call.HideBread(Master); if (!IsPostBack) { if (NodeID > 0) { M_Exam_Class nodeMod = nodeBll.GetSelect(NodeID); CurNode_L.Text = "[" + nodeMod.C_ClassName + "]"; } else { nodetr.Style.Remove("display"); } if (Grade > 0) { CurNode_L.Text += "[" + B_GradeOption.GetGradeOption(Grade).GradeName + "]"; Grade_Radio.SelectedValue = Grade.ToString(); } //-------------- GetQuesType(); InitQuestGrade(); if (Mid > 0) { SaveNew_Btn.Visible = true; M_Exam_Sys_Questions questMod = questBll.GetSelect(Mid); if (questMod != null && questMod.p_id > 0) { txtP_title.Text = questMod.p_title; //rblDiff.SelectedValue = questMod.p_Difficulty.ToString(); Diffcult_T.Text = questMod.p_Difficulty.ToString("f2"); AnswerHtml_T.Text = questMod.p_shuming; Grade_Radio.SelectedValue = questMod.p_Views.ToString(); if (!string.IsNullOrEmpty(questMod.Tagkey)) { TagKey_T.Value = knowBll.GetNamesByIDS(questMod.Tagkey); } //TagKey_T.Text = questMod.Tagkey; NodeID_Hid.Value = questMod.p_Class.ToString(); txtP_Content.Text = questMod.p_Content; if (questMod.p_Type == 10) { txtP_Content.Text = questMod.LargeContent; } txtDefaSocre.Text = questMod.p_defaultScores.ToString(); Qinfo_Hid.Value = questMod.Qinfo; ddlNumber1.SelectedValue = questMod.p_ChoseNum.ToString(); Optioninfo_Hid.Value = SafeSC.ReadFileStr(questMod.GetOPDir()); Answer_T.Text = questMod.p_Answer; txtJiexi.Value = questMod.Jiexi; IsShare_Chk.Checked = questMod.IsShare == 1; Version_Rad.SelectedValue = questMod.Version.ToString(); function.Script(this, "SetRadVal('qtype_rad'," + questMod.p_Type + ");"); } } else { if (NodeID > 0) { NodeID_Hid.Value = NodeID.ToString(); } } } }