protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { Hyoa_class_my.id = v_uids[i]; Hyoa_class_my.hy_type = this.txttype.Value; Hyoa_class_my.hy_userid = Session["hyuid"].ToString(); Hyoa_class_my.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); if (this.txtop.Value == "add") { Hyoa_class_my.id = this.hy_id.Text; Hyoa_class_my.hy_name = this.hy_name.Text; Hyoa_class_my.hy_type = this.hy_type.Value; Hyoa_class_my.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString()); Hyoa_class_my.hy_userid = Session["hyuid"].ToString(); Hyoa_class_my.Insert(); } else { Hyoa_class_my.id = this.hy_id.Text; Hyoa_class_my.hy_name = this.hy_name.Text; Hyoa_class_my.hy_type = this.hy_type.Value; Hyoa_class_my.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString()); Hyoa_class_my.hy_userid = Session["hyuid"].ToString(); Hyoa_class_my.Update(); } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 this.btn_submit.Visible = true; //新文档 if (this.Request.QueryString["op"] == "add") { HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dt; string ls_id = ""; if (this.Request.QueryString["id"] == "") { //ID为空,说明是第一级 dt = Hyoa_class_my.GetFirstlevClasssSortByid_type(this.hy_type.Value, Session["hyuid"].ToString()); if (dt.Rows.Count > 0) { //判断当前ID是不是有数据的 ls_id = (System.Int32.Parse(dt.Rows[0]["id"].ToString()) + 1).ToString(); if (ls_id.Length == 1) { this.hy_id.Text = "00" + ls_id; } else if (ls_id.Length == 2) { this.hy_id.Text = "0" + ls_id; } else { this.hy_id.Text = ls_id; } } else { this.hy_id.Text = "001"; } } else { //ID不为空,说明不是第一级 this.hy_id.Text = Hyoa_class_my.GetMaxid_type(this.txtid.Value, this.hy_type.Value, Session["hyuid"].ToString()); } } //旧文档 if (this.Request.QueryString["op"] == "modify") { HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dt = Hyoa_class_my.GetClass_type(this.txtdocid.Value, this.hy_type.Value, Session["hyuid"].ToString()); if (dt.Rows.Count > 0) { this.hy_id.Text = dt.Rows[0]["id"].ToString(); this.hy_sort.Text = dt.Rows[0]["hy_sort"].ToString(); this.hy_name.Text = dt.Rows[0]["hy_name"].ToString(); } dt.Clear(); } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { string ls_string=""; string ls_type = ""; if (this.Request.QueryString["type"] != null) ls_type = this.Request.QueryString["type"].ToString(); Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"zh-cn\">"); Response.Write("<Head><Title>人员列表</Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<meta name=\"generator\" content=\"editplus\" />"); Response.Write("<link type=\"text/css\" rel=\"stylesheet\" href=\"/hyhtml/ltree/resources/css/lTREE.checkbox.css\" />"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenuDEMO {border:1px solid #ccc;margin:3px;padding:3px;}"); Response.Write("#infoBox {position:absolute;left:450px;top:40px;border:1px solid #ccc;width:400px;padding:0 10px;font-family:\"宋体\",Geneva,Arial,sans-serif;line-height:150%;}"); Response.Write("#debugMSG strong {color:#f00;}"); Response.Write("</style>"); Response.Write("<!--[if IE 6]>"); Response.Write("<script>"); Response.Write("document.execCommand(\"BackgroundImageCache\", false, true);"); Response.Write("</script>"); Response.Write("<![endif]-->"); Response.Write("</Head>"); Response.Write("<body style=\"padding:2px;\">"); //Response.Write("<form>"); Response.Write("<div class=\"lTREEMenu lTREENormal\" id=\"lTREEMenuDEMO\">"); Response.Write("<dl>"); Response.Write("<dd><input type=\"checkbox\" value=\"\" /><b>列表</b>"); Response.Write("<dl>"); //得到第一级部门 HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dt = Hyoa_class_my.GetFirstlevClasss_type(ls_type,Session["hyuid"].ToString()); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { //判断有子部门 if (Hyoa_class_my.isHaveSubClass_type(dt.Rows[i]["id"].ToString(), ls_type,Session["hyuid"].ToString()) == true) { //存在子部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["id"].ToString() + "_subuser\" value=\"" + dt.Rows[i]["id"].ToString() + "|" + dt.Rows[i]["hy_name"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\"> "); Response.Write(dt.Rows[i]["hy_name"].ToString()); Response.Write("<dl>"); //显示子部门 GetNextDept(dt.Rows[i]["id"].ToString(), "Dept" + dt.Rows[i]["id"].ToString(), ls_string,ls_type); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "_subuser\" value=\""); Response.Write(dt.Rows[i]["id"].ToString() + "|" + dt.Rows[i]["hy_name"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\"> "); Response.Write(dt.Rows[i]["hy_name"].ToString()); Response.Write("</dt>"); } } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</div>"); Response.Write("<script type=\"text/javascript\" src=\"/hyhtml/ltree/js/lTREE.js\"></script>"); Response.Write("<script class=\"lJSFDemo\" type=\"text/javascript\"> "); Response.Write(" var lTree = new lTREE();"); Response.Write(" lTree.config({"); Response.Write(" path : \"dl dd\""); Response.Write(" });"); Response.Write(" lTree.tagName({"); Response.Write(" folder : \"DD\","); Response.Write(" file : \"DT\""); Response.Write(" });"); Response.Write(" lTree.className({"); Response.Write(" folderClose : \"folderClose\","); Response.Write(" lastChild : \"lastChild\""); Response.Write(" });"); Response.Write("var t=new Date(),timer=[];"); Response.Write("lTree.build(\"lTREEMenuDEMO\");"); Response.Write("timer.push(new Date()-t);"); /************************************** * 给树内所有复选框添加相应事件 * * Start */ Response.Write("function chkAll(){"); Response.Write("var a=this.parentNode.getElementsByTagName(\"input\"),b=this.checked;"); Response.Write("for(var i=0,l=a.length; i<l;i++) {"); Response.Write("a[i].checked=b;"); Response.Write("}"); Response.Write("}"); Response.Write("function chkOne(){"); Response.Write("var a=this,b=this.checked,p=lDOM.$(\"lTREEMenuDEMO\"),pn=null;"); Response.Write("while(a.tagName!=\"DD\" && a!=p) a=a.parentNode;"); Response.Write("pn=a.getElementsByTagName(\"input\");"); Response.Write("if(b){"); Response.Write("for(var i=1,l=pn.length; i<l;i++) {"); Response.Write("if(!pn[i].checked){"); Response.Write("b=false;"); Response.Write("break;"); Response.Write("}"); Response.Write("}"); Response.Write("}"); Response.Write("pn[0].checked=b;"); Response.Write("}"); Response.Write("var arrCHK=lDOM.find(\"dl dd input\",lDOM.$(\"lTREEMenuDEMO\"),{type:\"checkbox\"});"); Response.Write("arrCHK.each(function(s){"); Response.Write("if(s.parentNode.tagName==\"DT\"){"); Response.Write("s.onclick=chkOne;"); Response.Write("} else {"); Response.Write("s.onclick=chkAll;"); Response.Write("}"); Response.Write("});"); Response.Write(" </script>"); //Response.Write("</form>"); Response.Write("</Body></HTML>"); } }
//得到下一级部门的信息 private void GetNextDept(string pis_Id, string pis_name, string ls_string, string ls_type) { //循环二级部门 HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dtclass = Hyoa_class_my.GetSubClasss_type(pis_Id, ls_type, Session["hyuid"].ToString()); if (dtclass.Rows.Count > 0) { for (var i = 0; i < dtclass.Rows.Count; i++) { //判断是否有三级部门 if (Hyoa_class_my.isHaveSubClass_type(dtclass.Rows[i]["id"].ToString(), ls_type, Session["hyuid"].ToString()) == true) { //存在三级部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_subuser" + i.ToString() + "_" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "|" + dtclass.Rows[i]["hy_name"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> 1111111"); Response.Write(dtclass.Rows[i]["hy_name"].ToString()); Response.Write("<dl>"); //显示子部门以及部门人员 GetNextDept(dtclass.Rows[i]["id"].ToString(), pis_name + "_subuser" + i.ToString() + "_" + dtclass.Rows[i]["id"].ToString(), ls_string, ls_type); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_subuser_" + dtclass.Rows[i]["id"].ToString() + "\" value=\""); Response.Write(dtclass.Rows[i]["id"].ToString() + "|" + dtclass.Rows[i]["hy_name"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\"> "); Response.Write(dtclass.Rows[i]["hy_name"].ToString()); Response.Write("</dt>"); } } } }
private void DataPlay(int PageNo) { this.isrole.Value = "1"; this.tdnewdoc.Visible = true; this.tddeldoc.Visible = true; //如果id等于空,则返回按钮隐藏 if (this.txtid.Value== "") { this.btnreturnback.Visible = false; } //得到当前页号 this.curpage.Text = PageNo.ToString(); HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dt; if (this.txtid.Value == "") { dt = Hyoa_class_my.GetFirstlevClasss_type(this.txttype.Value, Session["hyuid"].ToString()); } else { dt = Hyoa_class_my.GetSubClasss_type(this.txtid.Value, this.txttype.Value, Session["hyuid"].ToString()); } DataTable tempTable = dt.Clone(); for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } int TotalRecord = dt.Rows.Count; this.sumts.Text = TotalRecord.ToString(); this.sumts2.Text = TotalRecord.ToString(); this.ShowTotalRecord.Text = TotalRecord.ToString(); //计算及显示总页数 int TotalPage; if (TotalRecord < System.Int32.Parse(PageSize.Text)) { TotalPage = 1; } else { if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0) { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1; } else { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text); } } this.ShowTotalPage.Text = TotalPage.ToString(); this.rptlist.DataSource = tempTable; this.rptlist.DataBind(); dt.Clear(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { string ls_string=""; string ls_type = ""; if (this.Request.QueryString["type"] != null) ls_type = this.Request.QueryString["type"].ToString(); Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"zh-cn\">"); Response.Write("<head><Title></Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<link href=\"/hyhtml/ltree/resources/css/lTREE.default.css\" rel=\"stylesheet\" type=\"text/css\" />"); Response.Write("<script language=\"JavaScript\" src=\"/hyhtml/ltree/js/lTREE.js\"></script>"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenuDEMO {border:1px solid #ccc;margin:3px;padding:3px;}"); Response.Write("#infoBox {position:absolute;left:450px;top:40px;border:1px solid #ccc;width:400px;padding:0 10px;font-family:\"宋体\",Geneva,Arial,sans-serif;line-height:150%;}"); Response.Write("#debugMSG strong {color:#f00;}"); Response.Write("</style>"); Response.Write("</Head>"); Response.Write("<body style=\"padding:2px;\">"); //<!--lTREEMenu Start:--> Response.Write("<div class=\"lTREEMenu lTREENormal\" id=\"lTREEMenuDEMO\">"); Response.Write("<dl>"); Response.Write("<dd> <b>我的收藏</b>"); Response.Write("<dl>"); //得到第一级部门 HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dt = Hyoa_class_my.GetFirstlevClasss_type(ls_type, Session["hyuid"].ToString()); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { //判断有子部门 if (Hyoa_class_my.isHaveSubClass_type(dt.Rows[i]["id"].ToString(), ls_type, Session["hyuid"].ToString()) == true) { //存在子部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<a href='list.aspx?type=" + ls_type+"&id=" + dt.Rows[i]["id"].ToString() + "' target=\"RightIframeWin\" >"); Response.Write(dt.Rows[i]["hy_name"].ToString()); Response.Write("</a>"); Response.Write("<dl>"); //显示子部门 GetNextDept(dt.Rows[i]["id"].ToString(), "Dept" + dt.Rows[i]["id"].ToString(), ls_string,ls_type); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dt>"); Response.Write("<a href='list.aspx?type=" + ls_type + "&id=" + dt.Rows[i]["id"].ToString() + "' target='RightIframeWin' >"); Response.Write(dt.Rows[i]["hy_name"].ToString()); Response.Write("</a>"); Response.Write("</dt>"); } } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</div>"); //<!--lTREEMenuDEMO End--> Response.Write("<script class=\"lJSFDemo\" type=\"text/javascript\"> "); Response.Write(" var lTree = new lTREE();"); Response.Write(" lTree.config({"); Response.Write(" path : \"dl dd\""); Response.Write(" });"); Response.Write(" lTree.tagName({"); Response.Write(" folder : \"DD\","); Response.Write(" file : \"DT\""); Response.Write(" });"); Response.Write(" lTree.className({"); Response.Write(" folderClose : \"folderClose\","); Response.Write(" lastChild : \"lastChild\""); Response.Write(" });"); Response.Write(" lTree.build(\"lTREEMenuDEMO\");"); Response.Write(" </script>"); Response.Write("</Body></HTML>"); } }
//得到下一级部门的信息 private void GetNextDept(string pis_Id, string pis_name, string ls_string, string ls_type) { //循环二级部门 HyoaClass.Hyoa_class_my Hyoa_class_my = new HyoaClass.Hyoa_class_my(); DataTable dtclass = Hyoa_class_my.GetSubClasss_type(pis_Id, ls_type, Session["hyuid"].ToString()); if (dtclass.Rows.Count > 0) { for (var i = 0; i < dtclass.Rows.Count; i++) { //判断是否有三级部门 if (Hyoa_class_my.isHaveSubClass_type(dtclass.Rows[i]["id"].ToString(), ls_type, Session["hyuid"].ToString()) == true) { //存在三级部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<a href='list.aspx?type=" + dtclass.Rows[i]["id"].ToString() + "' target='RightIframeWin' >"); Response.Write(dtclass.Rows[i]["hy_name"].ToString()); Response.Write("</a>"); Response.Write("<dl>"); //显示子部门以及部门人员 GetNextDept(dtclass.Rows[i]["id"].ToString(), pis_name + "_sub" + i.ToString() + "_" + dtclass.Rows[i]["id"].ToString(), ls_string, ls_type); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dt>"); Response.Write("<a href='list.aspx?type=" + ls_type + "&id=" + dtclass.Rows[i]["id"].ToString() + "' target='RightIframeWin' >"); Response.Write(dtclass.Rows[i]["hy_name"].ToString()); Response.Write("</a>"); Response.Write("</dt>"); } } } }