Exemplo n.º 1
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        //先刪除全部權限,在新增新的權限
        apBLL.DeleteByaId(id);
        bool isOk = false;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            RadioButtonList rdList   = (RadioButtonList)GridView1.Rows[i].FindControl("raIsVisable");
            Label           lbfi_no1 = (Label)GridView1.Rows[i].FindControl("lbfi_no1");
            Label           lbfi_no2 = (Label)GridView1.Rows[i].FindControl("lbfi_no2");
            if (rdList != null && lbfi_no1 != null && lbfi_no2 != null)
            {
                int            fi_no1 = int.Parse(lbfi_no1.Text);
                int            fi_no2 = int.Parse(lbfi_no2.Text);
                AdminPowerInfo info   = new AdminPowerInfo();
                info.ap_no1    = fi_no1;
                info.ap_id     = id;
                info.ap_no2    = fi_no2;
                info.ap_aid    = id;
                info.ap_enable = bool.Parse(rdList.SelectedValue);
                if (apBLL.Insert(info) > 0)
                {
                    isOk = true;
                }
            }
        }
        if (isOk == true)
        {
            Response.Redirect("List.aspx?header=修改成功!", true);
        }
        else
        {
            Response.Redirect("List.aspx?header=修改失敗!", true);
        }
    }
Exemplo n.º 2
0
 private void Delete(int aId)
 {
     apBLL.DeleteByaId(aId);
     adBLL.Delete(aId);
 }