Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString.Count > 0)
         {
             string name = Request.QueryString["name"].ToString().Trim();
             if (name.Equals("Edit"))
             {
                 if (Request.QueryString["RoleID"].ToString().Trim() != null)
                 {
                     string       roleGroupId = Request.QueryString["RoleID"].ToString().Trim();
                     RoleGroupTab roleGroup   = new RoleGroupTab();
                     roleGroup = roleGroupBLL.GetRoleGroupById(roleGroupId);
                     if (roleGroup != null)
                     {
                         this.txtRoleGroupID.Text     = roleGroup.MemberGradeID.ToString();
                         this.txtRoleGroupName.Text   = roleGroup.MemberGradeName.ToString();
                         this.txtGroupRemark.Text     = roleGroup.Remark.ToString();
                         this.txtRoleGroupID.ReadOnly = true;
                         this.Button1.Enabled         = false;
                     }
                 }
             }
         }
     }
 }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void LinkButton1_Command(object sender, CommandEventArgs e)
    {
        int num = 0;

        switch (e.CommandName)
        {
        case "delete":
            int roleGroupId = Convert.ToInt32(e.CommandArgument);
            num = roleGroupBll.DeleteRoleGroup(roleGroupId);
            if (num > 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!');location.href='ShowRoleList.aspx'", true);
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!');location.href='ShowRoleList.aspx'", true);
            }
            break;

        case "Edit":
            Response.Redirect("AddRoleGrop.aspx?RoleID=" + Convert.ToInt32(e.CommandArgument.ToString().Trim()) + "&name=" + e.CommandName.ToString().Trim());
            break;

        case "IsKai":
            string Id     = e.CommandArgument.ToString().Trim();
            int    Check  = (roleGroupBll.GetRoleGroupById(Id)).SCheck;
            int    SCheck = Check == 1?0:1;
            roleGroupBll.UPdateRoleGroupSCheck(Id, SCheck);
            this.dataBin();
            break;

        default:
            break;
        }
    }