//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_iplimit Hyoa_iplimit = new HyoaClass.Hyoa_iplimit(); if (this.txtop.Value == "add") { //先判断这个模块编号是否已经存在 DataTable dt = Hyoa_iplimit.Getiplimitsbymudelid(this.ddlmudelid.SelectedValue); if (dt.Rows.Count > 0) { Response.Write("<script>alert('该模块的IP限制已存在,请重新填写!');history.back();</script>"); return; } else { Hyoa_iplimit.ID = Hyoa_global.GetRandom(); Hyoa_iplimit.hy_mudelid = this.ddlmudelid.SelectedValue; Hyoa_iplimit.hy_iplists = this.txtiplists.Value; Hyoa_iplimit.hy_createtime = System.DateTime.Now.ToString(); Hyoa_iplimit.hy_isenabled = this.ddlisenabled.SelectedValue; Hyoa_iplimit.Insert(); } } else { Hyoa_iplimit.ID = this.txtdocid.Value; Hyoa_iplimit.hy_mudelid = this.ddlmudelid.SelectedValue; Hyoa_iplimit.hy_iplists = this.txtiplists.Value; Hyoa_iplimit.hy_createtime = System.DateTime.Now.ToString(); Hyoa_iplimit.hy_isenabled = this.ddlisenabled.SelectedValue; Hyoa_iplimit.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 btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_iplimit Hyoa_iplimit = new HyoaClass.Hyoa_iplimit(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { Hyoa_iplimit.ID = v_uids[i]; Hyoa_iplimit.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
private void DataPlay(int PageNo) { //判断当前用户是否有新建删除权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", 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; //删除 } //得到当前页号 this.curpage.Text = PageNo.ToString(); HyoaClass.Hyoa_iplimit Hyoa_iplimit = new HyoaClass.Hyoa_iplimit(); DataTable dt; dt = Hyoa_iplimit.Getiplimits(); 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() { //是否启用 this.ddlisenabled.Items.Insert(0, "是"); this.ddlisenabled.Items.Insert(1, "否"); //模块编号 //加载模块 HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dtmudel = Hyoa_mudel.Getmudels(); if (dtmudel.Rows.Count > 0) { this.ddlmudelid.DataSource = dtmudel; this.ddlmudelid.DataTextField = "hy_mudelname"; this.ddlmudelid.DataValueField = "hy_mudelid"; this.ddlmudelid.DataBind(); this.ddlmudelid.Items.Insert(0, "--请选择--"); this.ddlmudelid.SelectedIndex = 0; } 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) { //根据id得到信息 this.txtdocid.Value = this.Request.QueryString["id"].ToString(); HyoaClass.Hyoa_iplimit Hyoa_iplimit = new HyoaClass.Hyoa_iplimit(); DataTable dt = Hyoa_iplimit.Getiplimit(this.txtdocid.Value); if (dt.Rows.Count > 0) { this.txtiplists.Value = dt.Rows[0]["hy_iplists"].ToString(); if (dt.Rows[0]["hy_isenabled"].ToString() == "是") this.ddlisenabled.SelectedIndex = 0; else this.ddlisenabled.SelectedIndex = 1; this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString(); } dt.Clear(); } } } }