private void btnDelFloor_Click(object sender, EventArgs e) { string strFloorIDs = ""; foreach (DataGridViewRow row in dgvFloor.Rows) { if (row.Cells["colSelected"].Value != null && (bool)row.Cells["colSelected"].Value) { strFloorIDs += row.Cells["FloorID"].Value.ToString() + ","; } } if (string.IsNullOrEmpty(strFloorIDs)) { MessageBox.Show("请选择楼层!"); return; } //验证有没有房间 KnowledgeDesk.ActionHelper.WebAPIHelper webapi = new ActionHelper.WebAPIHelper(); string strErr = ""; string strPost = "FloorID=" + strFloorIDs.TrimEnd(','); ExecResult result = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Room/QueryRoomByFloorID", strPost, "Get", ref strErr); if (result.DTData.Rows.Count > 0) { MessageBox.Show("选择楼层中存在房间,操作失败"); return; } else { ExecResult resultDel = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Floor/DelFloor", strPost, "Get", ref strErr); MessageBox.Show("操作成功"); QueryFloor(); } }
private void btnDelRoom_Click(object sender, EventArgs e) { string strRoomIDs = ""; foreach (DataGridViewRow row in dgvRoom.Rows) { if (row.Cells["Selected"].Value != null && (bool)row.Cells["Selected"].Value) { strRoomIDs += row.Cells["RoomID"].Value.ToString() + ","; } } //验证有没有卡牌 KnowledgeDesk.ActionHelper.WebAPIHelper webapi = new ActionHelper.WebAPIHelper(); string strErr = ""; string strPost = "RoomIDs=" + strRoomIDs.TrimEnd(','); ExecResult result = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Car/QueryCarByRoomIDs", strPost, "Get", ref strErr); if (result.DTData.Rows.Count > 0) { MessageBox.Show("选择房间中存在卡牌,操作失败"); return; } else { string postpara = "IDs=" + strRoomIDs.TrimEnd(','); ExecResult resultDel = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Room/DelRoom", postpara, "Get", ref strErr); MessageBox.Show("操作成功"); QueryRoom(); } }
private void QueryCar() { KnowledgeDesk.ActionHelper.WebAPIHelper webapi = new ActionHelper.WebAPIHelper(); string strErr = ""; string strPost = "EmployeeID=1"; ExecResult result = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Car/QueryCar", strPost, "Get", ref strErr); this.dgvCar.DataSource = result.DTData; if (result.DTData.Columns.Count > 0) { this.dgvCar.Columns[1].Visible = false; } AutoSize(dgvCar); }