/// <summary> /// 호실정보 수정 /// </summary> private void UpdateRoomStatusItem() { DataTable roomDataTable = dbc.GetRoomList(selectGroupCode, null); foreach (Control control in this.top_room_panel.Controls) { if (control is UC_RoomStatusItem) { UC_RoomStatusItem roomControl = control as UC_RoomStatusItem; string controlRoomCode = roomControl.GetRoomCode(); string groupCode = ""; string roomCode = ""; string roomName = ""; string roomStatus = ""; foreach (DataRow row in roomDataTable.Rows) { if (controlRoomCode.Equals(row["room_code"].ToString())) { groupCode = row["group_code"].ToString(); roomCode = row["room_code"].ToString(); roomName = row["room_name"].ToString(); roomStatus = row["room_status"].ToString(); } } roomControl.UpdateRoomStatusItem(groupCode, roomCode, roomName, roomStatus); } } foreach (Control control in this.bottom_room_panel.Controls) { if (control is UC_RoomStatusItem) { UC_RoomStatusItem roomControl = control as UC_RoomStatusItem; string controlRoomCode = roomControl.GetRoomCode(); string groupCode = ""; string roomCode = ""; string roomName = ""; string roomStatus = ""; foreach (DataRow row in roomDataTable.Rows) { if (controlRoomCode.Equals(row["room_code"].ToString())) { groupCode = row["group_code"].ToString(); roomCode = row["room_code"].ToString(); roomName = row["room_name"].ToString(); roomStatus = row["room_status"].ToString(); } } roomControl.UpdateRoomStatusItem(groupCode, roomCode, roomName, roomStatus); } } }
/// <summary> /// 호실 상태정보 수정 및 UserController 수정 /// </summary> /// <param name="groupCode">사동코드</param> /// <param name="roomCode">호실코드</param> /// <param name="roomStatus">문상태</param> /// <returns>호실 정보</returns> private JObject UpdateRoomStatusItemBySensor(string groupCode, string roomCode, string roomStatus) { DataTable roomDataTable = dbc.UpdateRoomStatus(groupCode, roomCode, roomStatus); UC_RoomStatusItem roomControl = null; foreach (Control control in this.top_room_panel.Controls) { if (control is UC_RoomStatusItem) { UC_RoomStatusItem temp = control as UC_RoomStatusItem; string UC_GroupCode = temp.GetGroupCode(); string UC_RoomCode = temp.GetRoomCode(); if (UC_GroupCode.Equals(groupCode) && UC_RoomCode.Equals(roomCode)) { roomControl = control as UC_RoomStatusItem; } } } foreach (Control control in this.bottom_room_panel.Controls) { if (control is UC_RoomStatusItem) { UC_RoomStatusItem temp = control as UC_RoomStatusItem; string UC_GroupCode = temp.GetGroupCode(); string UC_RoomCode = temp.GetRoomCode(); if (UC_GroupCode.Equals(groupCode) && UC_RoomCode.Equals(roomCode)) { roomControl = control as UC_RoomStatusItem; } } } if (roomControl != null) { roomControl.RoomColorChange(roomStatus); } DataRow[] rows = roomDataTable.Select(); JObject json = new JObject(); json.Add("groupCode", rows[0]["group_code"].ToString()); json.Add("groupName", rows[0]["group_name"].ToString()); json.Add("roomName", rows[0]["room_name"].ToString()); json.Add("roomCode", rows[0]["room_code"].ToString()); json.Add("roomStatus", rows[0]["room_status"].ToString()); json.Add("roomStatusName", rows[0]["room_status_name"].ToString()); json.Add("updatTime", rows[0]["updat_time"].ToString()); json.Add("preset", rows[0]["preset"].ToString()); return(json); }
/// <summary> /// 호실정보 최초 추가 /// </summary> private void AddRoomStatusItem() { DataTable roomDataTable = dbc.GetRoomList(selectGroupCode, null); foreach (DataRow row in roomDataTable.Rows) { int roomNo = util.ReturnRoomCodeToRoomNo(row["room_code"].ToString()); string roomCode = row["room_code"].ToString(); string roomName = row["room_name"].ToString(); string roomStatus = row["room_status"].ToString(); int XPos = 0; if (roomNo <= 10) { var temp = new UC_RoomStatusItem(selectGroupCode, roomCode, roomName, roomStatus); temp.RoomItemClick += new EventHandler(Room_Item_Click); foreach (Control item in top_room_panel.Controls) { XPos += item.Width; } temp.Location = new Point(XPos, temp.Location.Y); top_room_panel.Controls.Add(temp); } else { var temp = new UC_RoomStatusItem(selectGroupCode, roomCode, roomName, roomStatus); temp.RoomItemClick += new EventHandler(Room_Item_Click); foreach (Control item in bottom_room_panel.Controls) { XPos += item.Width; } temp.Location = new Point(XPos, temp.Location.Y); bottom_room_panel.Controls.Add(temp); } } }