protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { Hyoa_class.id = v_uids[i]; Hyoa_class.hy_type = this.txttype.Value; Hyoa_class.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 Hyoa_class = new HyoaClass.Hyoa_class(); if (this.txtop.Value == "add") { Hyoa_class.id = this.hy_id.Text; Hyoa_class.hy_name = this.hy_name.Text; Hyoa_class.hy_type = this.hy_type.Value; Hyoa_class.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString()); Hyoa_class.Insert(); } else { Hyoa_class.id = this.hy_id.Text; Hyoa_class.hy_name = this.hy_name.Text; Hyoa_class.hy_type = this.hy_type.Value; Hyoa_class.hy_sort = System.Int32.Parse(this.hy_sort.Text.ToString()); Hyoa_class.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>"); } }
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(); //默认选中当前所在部门 这个功能先取消 //if (this.Request.QueryString["deptid"] != null) //{ // ls_string = this.Request.QueryString["deptid"].ToString(); //} Response.Write("<HTML><Head><Title></Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<link href=\"/hyhtml/ltree/resources/css/css.css\" rel=\"stylesheet\" type=\"text/css\" />"); 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("<SCRIPT language=JavaScript src=\"/hyhtml/tree/xtree.js\"></SCRIPT>"); Response.Write("<SCRIPT language=JavaScript src=\"/hyhtml/tree/OrgSwitchForTree.js\"></SCRIPT>"); Response.Write("<SCRIPT language=JavaScript src=\"/hyhtml/tree/DeptSelection.js\"></SCRIPT>"); Response.Write("</Head>"); Response.Write("<Body topmargin=10 leftmargin=10 vlink=#FFFFFF >"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenu {width:380px;border:0px solid #ccc;margin:3px;padding:3px;}"); Response.Write("BODY{ PADDING-RIGHT:0px; PADDING-LEFT:0px; PADDING-BOTTOM:0px; PADDING-TOP:0px;}"); Response.Write("</style>"); Response.Write("<Form>"); Response.Write("<TABLE width=\"98%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"BORDER-left: #D4D4D4 1px solid;BORDER-right: #D4D4D4 1px solid;BORDER-top: #D4D4D4 1px solid\">"); Response.Write("<TR class=\"treeshow\">"); Response.Write("<td align=\"left\" valign=\"top\" class=\"lTREEMenu lTREENormal\" id=\"lTREEMenu\">"); Response.Write("<dl>"); Response.Write("<dd><input type=\"checkbox\" name=\"SelAll\" value=\"全选\" onclick=\"SelectAll();\" style=\"width:13;\"> <b>列表</b>"); Response.Write("<dl>"); //得到第一级部门 HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dt = Hyoa_class.GetFirstlevClasss_type(ls_type); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { //判断有子部门 if (Hyoa_class.isHaveSubClass_type(dt.Rows[i]["id"].ToString(), ls_type) == true) { //存在子部门 Response.Write("<dd class=\"folderClose\">"); //if (ls_string != "") //{ // if (ls_string == dt.Rows[i]["id"].ToString()) // { // Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "\" value=\"" + dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); // Response.Write(dt.Rows[i]["hy_name"].ToString()); // } // else // { // Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "\" value=\"" + dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); // Response.Write(dt.Rows[i]["hy_name"].ToString()); // } //} //else //{ Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["id"].ToString() + "\" value=\"" + dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); 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>"); //if (ls_string != "") //{ // if (ls_string == dt.Rows[i]["id"].ToString()) // { // Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "\" value=\""); // Response.Write(dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" style=\"width:13;\"> "); // } // else // { // Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "\" value=\""); // Response.Write(dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); // } //} //else //{ Response.Write("<input type=\"checkbox\" name=\"" + dt.Rows[i]["id"].ToString() + "\" value=\""); Response.Write(dt.Rows[i]["id"].ToString() + "\" text=\"" + dt.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); //} Response.Write(dt.Rows[i]["hy_name"].ToString()); Response.Write("</dt>"); } } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</td>"); Response.Write("</TR>"); Response.Write("</TABLE>"); 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(\"lTREEMenu\");"); 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 Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dtclass = Hyoa_class.GetSubClasss_type(pis_Id, ls_type); if (dtclass.Rows.Count > 0) { for (var i = 0; i < dtclass.Rows.Count; i++) { //判断是否有三级部门 if (Hyoa_class.isHaveSubClass_type(dtclass.Rows[i]["id"].ToString(), ls_type) == true) { //存在三级部门 Response.Write("<dd class=\"folderClose\">"); //if (ls_string != "") //{ // if (ls_string == dtclass.Rows[i]["id"].ToString()) // { // Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); // Response.Write(dtclass.Rows[i]["hy_name"].ToString()); // } // else // { // Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); // Response.Write(dtclass.Rows[i]["hy_name"].ToString()); // } //} //else //{ Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_sub" + i.ToString()+"_" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].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 + "_sub" + i.ToString() + "_" + dtclass.Rows[i]["id"].ToString(), ls_string, ls_type); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dt>"); //if (ls_string != "") //{ // if (ls_string == dtclass.Rows[i]["id"].ToString()) // { // Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\""); // Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" style=\"width:13;\"> "); // } // else // { // Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\""); // Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); // } //} //else //{ Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_sub_" + dtclass.Rows[i]["id"].ToString() + "\" value=\""); Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); //} Response.Write(dtclass.Rows[i]["hy_name"].ToString()); Response.Write("</dt>"); } } } }
private void DataPlay(int PageNo) { //得到当前模块对应的role HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dt_mudel = Hyoa_mudel.Getmudel(this.txtmudelid.Value); string ls_role = "Role9999"; if (dt_mudel.Rows.Count > 0) ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.tdnewdoc.Visible = true; this.tddeldoc.Visible = true; } else { this.isrole.Value = "0"; this.tdnewdoc.Visible = false; this.tddeldoc.Visible = false; } //如果id等于空,则返回按钮隐藏 if (this.txtid.Value== "") { this.btnreturnback.Visible = false; } //得到当前页号 this.curpage.Text = PageNo.ToString(); HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dt; if (this.txtid.Value == "") { dt = Hyoa_class.GetFirstlevClasss_type(this.txttype.Value); } else { dt = Hyoa_class.GetSubClasss_type(this.txtid.Value,this.txttype.Value); } 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(); }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 //得到当前模块对应的role HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dt_mudel = Hyoa_mudel.Getmudel(this.txtmudelid.Value); string ls_role = "Role9999"; if (dt_mudel.Rows.Count > 0) ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; } else { this.btn_submit.Visible = false; } //新文档 if (this.Request.QueryString["op"] == "add") { HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dt; string ls_id = ""; if (this.Request.QueryString["id"] == "") { //ID为空,说明是第一级 dt = Hyoa_class.GetFirstlevClasssSortByid_type(this.hy_type.Value); 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.GetMaxid_type(this.txtid.Value, this.hy_type.Value); } } //旧文档 if (this.Request.QueryString["op"] == "modify") { HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dt = Hyoa_class.GetClass_type(this.txtdocid.Value, this.hy_type.Value); 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(); } } }
//得到下一级部门的信息 private void GetNextDept(string pis_Id, string pis_name, string ls_string, string ls_type) { //循环二级部门 HyoaClass.Hyoa_class Hyoa_class = new HyoaClass.Hyoa_class(); DataTable dtclass = Hyoa_class.GetSubClasss_type(pis_Id, ls_type); if (dtclass.Rows.Count > 0) { for (var i = 0; i < dtclass.Rows.Count; i++) { //判断是否有三级部门 if (Hyoa_class.isHaveSubClass_type(dtclass.Rows[i]["id"].ToString(), ls_type) == true) { //存在三级部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_sub" + i.ToString()+"_" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); Response.Write("<a href='#' onclick='window.parent.document.getElementById(\"TreeStructWinRight\").src=\"/zsgl/list.aspx?mid=zsgl&tableid=3b5a9b5a-d1a3-4f85-b560-ef8c38a031cf&type=" + dtclass.Rows[i]["hy_name"].ToString() + "\";'>" + dtclass.Rows[i]["hy_name"].ToString() + "</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("<input type=\"checkbox\" name=\"" + pis_name + "_sub_" + dtclass.Rows[i]["id"].ToString() + "\" value=\""); Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); Response.Write("<a href='#' onclick='window.parent.document.getElementById(\"TreeStructWinRight\").src=\"/zsgl/list.aspx?mid=zsgl&tableid=3b5a9b5a-d1a3-4f85-b560-ef8c38a031cf&type=" + dtclass.Rows[i]["hy_name"].ToString() + "\";'>" + dtclass.Rows[i]["hy_name"].ToString() + "</a>"); Response.Write("</dt>"); } } } }