示例#1
0
        //ɾ��ʵ���÷���Ϣ
        protected void Delete_OnClick(object sender, EventArgs e)
        {
            ExtendBLL.Location loc = new ExtendBLL.Location();
            bool IsDel = false;
            for (int i = 0; i < LabRoomGridView.Rows.Count; i++)
            {
                CheckBox checkBox = (CheckBox)LabRoomGridView.Rows[i].FindControl("RoomCheckBox");

                if (checkBox.Checked == true)
                {
                    IsDel = true;
                    int ID = int.Parse(LabRoomGridView.DataKeys[i].Value.ToString());
                    List<string> strID = new List<string>();
                    List<string> strTable = new List<string>();
                    List<string> strColName = new List<string>();
                    #region �÷�
                    strID.Add(ID.ToString());
                    strTable.Add("Location");
                    strColName.Add("ID");
                    #endregion
                    #region �γ̰���
                    strID.Add(ID.ToString());
                    strTable.Add("Arrangement");
                    strColName.Add("LocationID");
                    #endregion
                    try
                    {
                        loc.DeleteLocation(strID, strTable, strColName);

                    }
                    catch
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('ɾ��ʧ��!')</script>");
                        return;
                    }
                }

            }
            if (IsDel)
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('ɾ���ɹ�!')</script>");
                LabRoom_BindData(int.Parse(LabDDL.SelectedValue), LocationNameTBX.Text, CampusTBX.Text, BuildingNameTBX.Text, FloorTBX.Text, RoomNumTBX.Text);
            }
        }