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="名称不能为空!";
     }
 }
Esempio n. 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();
 }
Esempio n. 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;

            }
        }
 private void btnupSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     if(this.txtNewName.Text.Trim()!="")
     {
         Permissions p=new Permissions();
         p.Update(int.Parse(this.lblPermId.Text),this.txtNewName.Text.Trim());
         this.TabEdit.Visible=false;
         PermissionsDatabind();
     }
     else
     {
         this.lbltip3.Text="名称不能为空!";
     }
 }