Ejemplo n.º 1
0
/*
 * 说明:
 *    删除台号信息
 * 参数:
 *    hwnd [in] 主窗口句柄
 * 返回值
 *    成功返回true
 */
bool DeleteTable(HWND hwnd)
{
	CListView table_list(hwnd, IDC_L_TABLE_INFO);
	int select = table_list.GetSelectionMark();
	if (-1 == select) {
		MessageBox(hwnd, TEXT("请在左侧列表款选择要删除的房间编号!"), TEXT("基础信息管理"), MB_ICONINFORMATION);
		return false;
	}
	std::string floor, room, table_no;
	CComboBox combo(hwnd, IDC_TABLE_FLOOR_COMBO);
	combo.GetComboBoxText(floor);              // 获取楼层名
	room = table_list.GetItem(select, 0);      // 获取房间名
	table_no = table_list.GetItem(select, 1);  // 获取台号
		CTableInfo table;
		table.DeleteTable(floor.c_str(), room.c_str(), table_no.c_str());
		CComboBox combox;
		//清空显示
		combox.Initialization(hwnd,IDC_C_FLOOR_NAME);
		combox.DeleteAllString();
		combox.Initialization(hwnd,IDC_C_ROOM_NAME);
		combox.DeleteAllString();
		CEdit edit;
		edit.Initialization(hwnd,IDC_E_TABLE_NO);
		edit.Empty();
		edit.Initialization(hwnd,IDC_E_TABLE_NUM);
		edit.Empty();
		InitTableList(hwnd, IDC_L_TABLE_INFO, floor.c_str(), 0);  // 更新
	return true;
}