//删除实验用房信息
        protected void Delete_OnClick(object sender, EventArgs e)
        {
            ExtendBLL.Location loc = new ExtendBLL.Location();
            try
                {
                    int ID = int.Parse(IDHF.Value);
                    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

                    loc.DeleteLocation(strID, strTable, strColName);
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('删除成功!');refreshParent();wincolse();</script>");
                }
                catch
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('删除失败!');refreshParent();wincolse();</script>");
                    return;
                }
        }
Exemple #2
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);
            }
        }