//删除实验用房信息 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; } }
protected void DropDownListIndex_OnChanged(object sender, EventArgs e) { ExtendBLL.Location location = new ExtendBLL.Location(); DataSet ds = new DataSet(); int LabID = 0; if (LabDDL.SelectedValue != "0") { LabID = int.Parse(LabDDL.SelectedValue); } ds = location.GetRoomInfo(LabID, LocationNameTBX.Text, CampusTBX.Text, BuildingNameTBX.Text, FloorTBX.Text, RoomNumTBX.Text); LabRoomGridView.DataSource = ds; LabRoomGridView.DataBind(); }
//删除实验用房信息 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); } }
//绑定LabRoomGridView protected void LabRoom_BindData(int LabID, string LocalName, string Campus, string BuildingName, string Floor, string RoomNum) { ExtendBLL.Location lc = new ExtendBLL.Location(); DataSet ds = new DataSet(); ds = lc.GetRoomInfo(LabID, LocalName, Campus, BuildingName, Floor, RoomNum); LabRoomGridView.DataSource = ds; LabRoomGridView.DataBind(); }
//绑定用房 protected void HouseDropDownList() { LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); List<LabMS.Model.Lab> labModelList = new List<LabMS.Model.Lab>(); ExtendBLL.Location loc = new ExtendBLL.Location(); if (LabDDL.SelectedValue == "") { return; } string str = "a.LabID=" + int.Parse(LabDDL.SelectedValue); labModelList = lab.GetModelList("Lab_ParentID=" + int.Parse(LabDDL.SelectedValue)); for (int i = 0; i < labModelList.Count; i++) { str += " or a.LabID=" + labModelList[i].ID.ToString(); } DataSet ds = loc.GetRoomAddress(str); HouseDDL.DataSource = ds; HouseDDL.DataBind(); }