//根据选择的公寓信息执行删除操作
    protected void Btn_Del_Click(object sender, EventArgs e)
    {
        int    selectCount  = 0;   //要删除的公寓总数
        string apartmentNos = "";  //保存要删除的公寓编号
        string oneapartmentNo;     //保存某行记录的编号

        foreach (GridViewRow gr in GridView1.Rows)
        {
            CheckBox chk = (CheckBox)gr.Cells[0].FindControl("checkBox");
            if (chk.Checked) //如果要删除该公寓
            {
                oneapartmentNo = gr.Cells[1].Text;
                if (0 == selectCount)
                {
                    apartmentNos = "'" + oneapartmentNo + "'";
                }
                else
                {
                    apartmentNos = apartmentNos + ",'" + oneapartmentNo + "'";
                }
                selectCount++;
            }
        }
        if (0 == selectCount) //如果用户没有选择公寓
        {
            Response.Write("<script>alert('对不起,你没有选择公寓!');</script>");
        }
        else
        {
            Apartment apartment = new Apartment();
            bool      result    = apartment.DeleteApartments(apartmentNos);
            if (true == result)
            {
                Response.Write("<script>alert('公寓信息删除成功!');location.href='apartmentInfoManage.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('" + apartment.ErrMessage + "');</script>");
            }
        }
    }