示例#1
0
 private void BtnAddPermissions_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     string Permissions=this.PermissionsName.Text.Trim();
     if(Permissions!="")
     {
         int CategoryId=int.Parse(this.ClassList.SelectedValue);
         Permissions p=new Permissions();
         p.Create(CategoryId,Permissions);
         if(this.ClassList.SelectedItem!=null)
         {
             PermissionsDatabind();
         }
         this.PermissionsName.Text="";
     }
     else
     {
         this.lbltip2.Text="名称不能为空!";
     }
 }
示例#2
0
 private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     string id = e.Item.Cells[0].Text;
     TextBox bTextBox = (TextBox)(e.Item.Cells[1].Controls[0]);
     string Permissions = bTextBox.Text.Trim();
     if ((Permissions != "") && (id != ""))
     {
         Permissions p = new Permissions();
         p.Update(int.Parse(id), Permissions);
     }
     //恢复状态
     DataGrid1.EditItemIndex = -1;
     PermissionsDatabind();
 }
示例#3
0
        private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            string c=e.CommandName;
            int PermissionsID =(int)this.DataGrid1.DataKeys[e.Item.ItemIndex];
            string Permissions=e.Item.Cells[1].Text.Trim();
            switch(c)
            {
                case "Delete":
                    if(Permissions!="帐户管理")
                    {
                        Permissions p=new Permissions();
                        p.Delete(PermissionsID);
                        PermissionsDatabind();
                    }
                    else
                    {
                        Response.Write("<script>alert('对不起,不能删除这个权限,否则将无法进行权限管理!');</script>");
                    }
                    break;
                case "Edit":
                    //this.TabEdit.Visible=true;
                    //this.lblPermId.Text=PermissionsID.ToString();
                    //this.txtNewName.Text=Permissions;
                    break;

            }
        }