Пример #1
0
    protected void btn_Delete_Click(object sender, ImageClickEventArgs e)
    {
        string idList = string.Empty;
        foreach (GridViewRow dr in GridView1.Rows)
        {
            CheckBox chk = (CheckBox)dr.FindControl("chk");
            if (chk.Checked)
            {
                int _id = Convert.ToInt32((dr.Cells[1].Text));
                idList += _id + ",";
            }

        }
        if (idList.Length > 0)
        {
            if (idList.Contains("1000"))
            {
                UtilityService.Alert(this.Page, "不能删除总公司信息!");
                return;
            }
            OrganBLL organBLL = new OrganBLL();
            idList = idList.TrimEnd(',');
            bool re = organBLL.DeleteList(idList);
            if (re)
            {
                UtilityService.AlertAndRedirect(this.Page, "删除成功!", "OrganMgr.aspx");
            }
            else
            {
                UtilityService.Alert(this.Page, "删除失败!");
            }
        }
    }