//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_group Hyoa_group = new HyoaClass.Hyoa_group(); if (this.txtop.Value == "add") { //先判断这个ROLEID是否已经存在 DataTable dt = Hyoa_group.Getgroup(this.txtid.Text); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该群组已存在,请重新填写!');history.back();</script>"); return; } else { Hyoa_group.hy_groupid = this.txtid.Text; Hyoa_group.hy_groupname = this.txtname.Value; Hyoa_group.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_group.Insert(); } } else { Hyoa_group.hy_groupid = this.txtid.Text; Hyoa_group.hy_groupname = this.txtname.Value; Hyoa_group.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_group.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(); //新增还是修改 //判断当前用户是否有保存的权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; //保存 } else { this.btn_submit.Visible = false; //保存 } //旧文档 if (this.Request.QueryString["op"] == "modify") { if (this.Request.QueryString["id"] != null) { //根据roleid得到信息 this.txtid.Text = this.Request.QueryString["id"].ToString(); HyoaClass.Hyoa_group Hyoa_group = new HyoaClass.Hyoa_group(); DataTable dt = Hyoa_group.Getgroup(this.txtid.Text); if (dt.Rows.Count > 0) { this.txtname.Value = dt.Rows[0]["hy_groupname"].ToString(); this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString(); } dt.Clear(); this.txtid.Enabled = false; } } } }