/// <summary> /// 사동선택 이벤트 /// </summary> /// <param name="groupCode">사동 코드</param> private void SelectedGroupStatusItem(string groupCode) { foreach (Control control in this.group_status_panel.Controls) { if (control is UC_GroupStatusItem) { UC_GroupStatusItem groupControl = control as UC_GroupStatusItem; groupControl.SelectedItem(groupCode); } } }
/// <summary> /// 사동 정보 최초생성 /// </summary> private void AddGroupStatusItem() { group_status_panel.Controls.Clear(); DataTable groupDataTable = dbc.SelectGroupStatus(); foreach (DataRow row in groupDataTable.Rows) { string groupCode = row["group_code"].ToString(); string groupName = row["group_name"].ToString(); string openCnt = row["open_cnt"].ToString(); string groupInmates = row["group_inmates"].ToString(); string roomCnt = row["room_cnt"].ToString(); string doorCnt = row["door_cnt"].ToString(); string cameraCnt = row["camera_cnt"].ToString(); string minRoomName = row["min_room_name"].ToString(); var temp = new UC_GroupStatusItem(groupCode, groupName, openCnt, groupInmates, roomCnt, doorCnt, cameraCnt, selectGroupCode, minRoomName); temp.GroupItemClick += new EventHandler(Group_Item_Click); int XPos = 0; foreach (Control item in group_status_panel.Controls) { XPos += item.Width + 20; } temp.Location = new Point(temp.Location.X + groupMargin + XPos, temp.Location.Y + 10); group_status_panel.Controls.Add(temp); if (groupCode.Equals(selectGroupCode)) { JObject json = new JObject(); json.Add("groupCode", groupCode); json.Add("groupCodeName", groupName); json.Add("openCnt", openCnt); json.Add("groupInmates", groupInmates); json.Add("roomCnt", roomCnt); json.Add("doorCnt", doorCnt); json.Add("cameraCnt", cameraCnt); GroupTitleChange(json); } } }
/// <summary> /// 사동정보 수정 /// </summary> public void UpdateGroupStatusItem() { DataTable groupDataTable = dbc.SelectGroupStatus(); foreach (Control control in this.group_status_panel.Controls) { if (control is UC_GroupStatusItem) { UC_GroupStatusItem groupControl = control as UC_GroupStatusItem; string controlGroupCode = groupControl.GetGroupCode(); string groupCode = ""; string groupName = ""; string openCnt = ""; string groupInmates = ""; string roomCnt = ""; string doorCnt = ""; string cameraCnt = ""; string minRoomName = ""; foreach (DataRow row in groupDataTable.Rows) { if (controlGroupCode.Equals(row["group_code"].ToString())) { groupCode = row["group_code"].ToString(); groupName = row["group_name"].ToString(); openCnt = row["open_cnt"].ToString(); groupInmates = row["group_inmates"].ToString(); roomCnt = row["room_cnt"].ToString(); doorCnt = row["door_cnt"].ToString(); cameraCnt = row["camera_cnt"].ToString(); minRoomName = row["min_room_name"].ToString(); } } groupControl.UpdateGroupStatusItem(groupCode, groupName, openCnt, groupInmates, roomCnt, doorCnt, cameraCnt, minRoomName); } } }