[求助]C#数形目录代码解析
平行指标创建(群众评价指标) //初始化树 public void inittree() { evaluation_index_manage.evaluation_index_manage index = new evaluation_index_manage.evaluation_index_manage(); SqlDataReader reader = index.studentindex_Select(); while(reader.Read()) { TreeNode nd = new TreeNode(); nd.Text = reader["Content"].ToString(); nd.ID = reader["Student_index_ID"].ToString(); this.TreeView1.Nodes.Add(nd); } reader.Close(); } private void Toolbar1_ButtonClick(object sender, System.EventArgs e) { Microsoft.Web.UI.WebControls.ToolbarButton btn = (Microsoft.Web.UI.WebControls.ToolbarButton)sender; evaluation_index_manage.evaluation_index_manage index = new evaluation_index_manage.evaluation_index_manage(); switch(btn.ID) { case "add": this.Table2.Visible=true; this.TextBox1.Text=""; this.bt_addindex.Visible = true; this.bt_update.Visible = false; this.Table3.Visible = false; break; case "del": if(this.lb_index.Text=="") { Response.Write("<scr"+"ipt>alert('请先在树上选择一个操作对象!')</scr"+"ipt>"); } else { if(index.studentindex_Delete(id)) { //Attributes.Add("onclick","if(confirm('您确信要删除吗?')){}else{return false}"); this.TreeView1.Nodes.Clear(); this.inittree(); Response.Write("<scr"+"ipt>alert('删除成功!')</scr"+"ipt>"); } } break; case "add1": this.Table3.Visible = true; this.Table2.Visible = false; break; } } private void bt_addindex_Click(object sender, System.EventArgs e) { if(this.TextBox1.Text=="") Response.Write("<scr"+"ipt>alert('群众评价指标内容不能为空!')</scr"+"ipt>"); else { evaluation_index_manage.evaluation_index_manage index = new evaluation_index_manage.evaluation_index_manage(); if(index.studentindex_Create(this.TextBox1.Text)) { this.TreeView1.Nodes.Clear(); this.inittree(); Response.Write("<scr"+"ipt>alert('群众评价指标内容添加成功!')</scr"+"ipt>"); } else { Response.Write("<scr"+"ipt>alert('添加时出错,请联系系统管理员!')</scr"+"ipt>"); } } } private void bt_additem_Click(object sender, System.EventArgs e) { evaluation_index_manage.evaluation_index_manage index = new evaluation_index_manage.evaluation_index_manage(); if(this.lb_index.Text=="") { Response.Write("<scr"+"ipt>alert('请先在树上选择一个操作对象!')</scr"+"ipt>"); } else { if(this.tb_itemcontent.Text==""||this.tb_score.Text=="") { Response.Write("<scr"+"ipt>alert('请输入完整!')</scr"+"ipt>"); } else { try { if(index.studentindexitem_Create(id,this.tb_itemcontent.Text,System.Int32.Parse(this.tb_score.Text))) { this.binddatagrid(id); Response.Write("<scr"+"ipt>alert('添加成功!')</scr"+"ipt>"); } else { Response.Write("<scr"+"ipt>alert('添加时出错,请联系系统管理员!')</scr"+"ipt>"); } } catch { Response.Write("<scr"+"ipt>alert('添加时出错,检查是否输入出错,或者你也可以联系系统管理员!')</scr"+"ipt>"); } } } } private void bt_update_Click(object sender, System.EventArgs e) { if(this.TextBox1.Text=="") Response.Write("<scr"+"ipt>alert('群众评价指标内容不能为空!')</scr"+"ipt>"); else { evaluation_index_manage.evaluation_index_manage index = new evaluation_index_manage.evaluation_index_manage(); if(index.studentindex_Update(id,this.TextBox1.Text)) { this.TreeView1.Nodes.Clear(); this.inittree(); Response.Write("<scr"+"ipt>alert('群众评价指标内容更新成功!')</scr"+"ipt>"); } else { Response.Write("<scr"+"ipt>alert('更新时出错,请联系系统管理员!')</scr"+"ipt>"); } } } 评价模块(平级部门评价) private void bt_sub_Click(object sender, System.EventArgs e) { string temp = ""; evaluation_index_manage eim = new evaluation_index_manage(); SqlDataReader reader = eim.get_cou_result(index_id,cou_id); while(reader.Read()) temp = reader["Self_Score"].ToString(); if ( temp == "") { try { if(this.tb_cou_score.Text =="") Response.Write("<script language='javascript'>alert('平级部门评价分值为必填项!')</script>"); else if(System.Double.Parse(this.tb_cou_score.Text)>System.Double.Parse(this.lb_highestscore.Text)||System.Double.Parse(this.tb_cou_score.Text)<System.Double.Parse(this.lb_lowestscore.Text)) { Response.Write("<script language='javascript'>alert('平级部门评价分值需在指标最高分和最低分之间!')</script>"); } else { eim.add_consellor_evaluation(index_id,cou_id,this.tb_cou_score.Text,this.lb_material.Text); Response.Write("<script language='javascript'>alert('该指标评价成功!')</script>"); } } catch { Response.Write("<script language='javascript'>alert('字符输入出错,请检查!')</script>"); } } else { try { if(this.tb_cou_score.Text =="") Response.Write("<script language='javascript'>alert('平级部门评价分值为必填项!')</script>"); else if(System.Double.Parse(this.tb_cou_score.Text)>System.Double.Parse(this.lb_highestscore.Text)||System.Double.Parse(this.tb_cou_score.Text)<System.Double.Parse(this.lb_lowestscore.Text)) { Response.Write("<script language='javascript'>alert('平级部门评价分值需在指标最高分和最低分之间!')</script>"); } else { eim.update_consellor_evaluation(index_id,cou_id,this.tb_cou_score.Text,this.lb_material.Text); Response.Write("<script language='javascript'>alert('指标更新成功!')</script>"); } } catch { Response.Write("<script language='javascript'>alert('更新时出错!')</script>"); } } } |