Beispiel #1
0
 //删除
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyCommon HyCommon = new HyCommon();
     string pageUrl = HyCommon.CombUrlTxt(ls_url, "page={0}&rnd={1}", page.ToString(), System.Guid.NewGuid().ToString());
     string ls_tip = "删除成功!";
     String[] v_uids = this.txtuids.Value.Split(',');
     for (int i = 0; i < v_uids.Length; i++)
     {
         HyRole hyRole = new HyRole();
         hyRole.hy_roleid = v_uids[i];
         hyRole.Delete();
     }
     //写系统日志
     Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
 }
 //保存
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     bool flag = false;
     HyRole HyRole = new HyRole();
     try
     {
         if (!this.txtRoleId.Text.Substring(0, 4).Contains("Role"))
         {
             Response.Write("<script>alert('对不起,权限编号要以Role开头');</script>");
             return;
         }
         if (this.txtRoleId.Text.Length < 5)
         {
             Response.Write("<script>alert('权限编号长度必须大于4位!');</script>");
             return;
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('对不起,权限编号要Role开头');</script>");
         return;
     }
     HyRole.hy_sort = Convert.ToInt32(this.txtRoleSort.Text);
     HyRole.hy_roleid = this.txtRoleId.Text;
     HyRole.hy_rolename = this.txtRoleNmae.Text;
     HyRole.hy_demo = this.txtRoleDemo.Text;
     if (this.txtop.Value == "add")
     {
         flag = HyRole.Insert();
     }
     else if (this.txtop.Value == "modify")
     {
         flag = HyRole.Update();
     }
     if (flag)
     {
         Response.Write("<script>alert('保存成功!');window.location='list_role.aspx?rend=" + System.Guid.NewGuid().ToString() + "';</script>");
     }
     else
     {
         Response.Write("<script>alert('保存失败,请联系管理员!');window.location='list_role.aspx?rend=" + System.Guid.NewGuid().ToString() + "';</script>");
     }
 }
 // 数据绑定
 private void RptBind()
 {
     HyRole HyRole = new HyRole();
     DataTable dt = new DataTable();
     if (this.txtop.Value == "modify")
     {
         HyRole.hy_roleid = this.txtdocid.Value;
         dt = HyRole.Getdocbyid();
         if (dt.Rows.Count > 0)
         {
             this.txtRoleSort.Text = dt.Rows[0]["hy_sort"].ToString();
             this.txtRoleId.Text = dt.Rows[0]["hy_roleid"].ToString();
             this.txtRoleNmae.Text = dt.Rows[0]["hy_rolename"].ToString();
             this.txtRoleDemo.Text = dt.Rows[0]["hy_demo"].ToString();
         }
         this.txtRoleId.Enabled = false;
     }
     else if (this.txtop.Value == "add")
     {
         dt.Clear();
         dt = HyRole.GetMaxSort();
         if (dt.Rows.Count > 0)
         {
             this.txtRoleSort.Text = Convert.ToString(Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 2);
         }
         else
         {
             this.txtRoleSort.Text = "1";
         }
     }
 }
Beispiel #4
0
    // 数据绑定
    private void RptBind()
    {
        HyCommon HyCommon = new HyCommon();
        if (this.Request.QueryString["page"] != null)
        {
            this.page = int.Parse(HyCommon.Filter(this.Request.QueryString["page"].ToString()));

        }
        this.txtPageNum.Text = this.pageSize.ToString();
        DataTable dt = new DataTable();
        string strCondition = "";
        if (this.txtKeywords.Text != "")
        {
            strCondition = " and hy_rolename like  '%" + HyCommon.Filter(this.txtKeywords.Text) + "%'";
        }
        HyRole hyRole = new HyRole();
        dt = hyRole.GetDataTable(pageSize, page, strCondition);
        totalCount = hyRole.GetDataTableCount(strCondition);
        this.lblcount.Text = totalCount.ToString();
        rptList.DataSource = dt;
        rptList.DataBind();
        string pageUrl = HyCommon.CombUrlTxt(ls_url, "page={0}&rnd={1}&keywords={2}", "__id__", System.Guid.NewGuid().ToString(), this.txtKeywords.Text);
        PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }