數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng)_第1頁
數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng)_第2頁
數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng)_第3頁
數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng)_第4頁
數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng)_第5頁
已閱讀5頁,還剩17頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、【精品文檔】如有侵權(quán),請聯(lián)系網(wǎng)站刪除,僅供學(xué)習(xí)與交流數(shù)據(jù)庫課程設(shè)計-學(xué)生宿舍管理系統(tǒng).精品文檔.數(shù)據(jù)庫原理課程設(shè)計說明書學(xué)生宿舍管理系統(tǒng)學(xué) 院: 計算機與信息科學(xué)學(xué)院專 業(yè): 網(wǎng)絡(luò)工程 班 級: 網(wǎng)絡(luò)1402 姓名學(xué)號: 吳琳琳 1420140231 姓名學(xué)號: 周岐浪 1420140217 指導(dǎo)教師: 高金華 職稱 講師完成時間: 2016年12月 1、管理系統(tǒng)設(shè)計的背景、意義及目標(biāo)l 設(shè)計背景l(fā) 設(shè)計意義l 設(shè)計目標(biāo)2、系統(tǒng)開發(fā)環(huán)境3、系統(tǒng)需求分析l 基本功能需求l 功能模塊l 數(shù)據(jù)字典4、概念結(jié)構(gòu)設(shè)計l 概念設(shè)計l E_R模型設(shè)計5、邏輯結(jié)構(gòu)設(shè)計l 將E_R圖轉(zhuǎn)換為關(guān)系模型l 各表關(guān)系模

2、型圖6、數(shù)據(jù)實施和維護l 功能實現(xiàn)代碼l 系統(tǒng)實現(xiàn)效果7、個人實現(xiàn)的功能8、總結(jié)1、管理系統(tǒng)設(shè)計的背景、意義及目標(biāo)l 設(shè)計背景隨著IT事業(yè)的發(fā)展,如今,我們已經(jīng)全面跨入信息時代。計算機被廣泛的應(yīng)用于各個行業(yè),人工戰(zhàn)略已經(jīng)轉(zhuǎn)化為信息戰(zhàn)略,如何在短時間內(nèi)獲取大量信息并整合信息,成為立足于時代的關(guān)鍵。為了適應(yīng)考生人數(shù)的急劇增長,當(dāng)今社會各大高校都在進行擴招政策,學(xué)生數(shù)量的急劇增加帶來信息量的成倍增長,由于信息管理的不善與疏忽,各大高校大小事故時有發(fā)生。進行正確的信息管理,對于信息及時處理和反應(yīng),能夠最大程度的減少學(xué)校以及在校學(xué)生的損失,減小潛在危機。學(xué)生宿舍是學(xué)生生活的基本單位,是同學(xué)休息與學(xué)習(xí)的地

3、方,為了保障同學(xué)入住學(xué)生宿舍的安全性,信息的處理和管理極為重要。據(jù)了解,本校的宿舍信息管理仍然使用傳統(tǒng)的手工方式,主要方式是基于文本、表格等紙介質(zhì)的手工處理,用人工手抄對男女生信宿信息進行處理登記。數(shù)據(jù)信息處理工作量大,容易出錯且不易修改;由于數(shù)據(jù)繁多,容易丟失,逐條查找記錄的方式不易操作,浪費了大量的時間,效率極低。學(xué)校的宿舍管理缺乏系統(tǒng),規(guī)范的信息管理手段。建立學(xué)生宿舍管理系統(tǒng),使宿舍管理工作系統(tǒng)化,規(guī)范化,便捷化,程序化,避免宿舍管理的隨意性,提高信息處理的速度和準(zhǔn)確性,能夠及時、準(zhǔn)確、有效的查詢和修改宿舍情況。l 設(shè)計的意義高校規(guī)模的擴大,在校學(xué)生的基本情況隨之層次化、多樣化、復(fù)雜化,

4、相應(yīng)的,學(xué)生管理工作面臨嚴(yán)峻的挑戰(zhàn)。高校學(xué)生信息日漸龐大,相應(yīng)的宿舍管理工作變得復(fù)雜而困難。傳統(tǒng)的賬本化工作模式,手工記錄學(xué)生信息并存檔,這樣的人工管理方式費時、費事、費力,信息獲取慢,更新滯后,查閱困難,容易出錯。為了給學(xué)生提供一個安全舒適的工作、生活、學(xué)習(xí)環(huán)境,方便宿舍管理工作的同時為學(xué)生、教師提供準(zhǔn)確實時的信息至關(guān)重要。 本校的宿舍信息管理,主要方式是基于文本、表格等紙介質(zhì)的手工處理,用人工手抄對男女生信宿信息進行處理登記。數(shù)據(jù)信息處理工作量大,容易出錯且不易修改;由于數(shù)據(jù)繁多,容易丟失,逐條查找記錄的方式不易操作,浪費了大量的時間,效率極低。以上的管理缺陷對學(xué)生宿舍管理造成了相當(dāng)大的阻

5、力,工作進展困難,問題解決的周期過長,資料整改工作量過大。為了改善學(xué)生宿舍管理情況,運用數(shù)據(jù)庫技術(shù)對學(xué)生信息進行處理和統(tǒng)一管理,在校園內(nèi)實現(xiàn)宿舍無紙化辦公。利用計算機的特點,利用互聯(lián)網(wǎng)進行遠程操作,制定學(xué)生客戶端,教師客戶端,管理員客戶端,實現(xiàn)有針對性信息化管理,充分發(fā)揮計算機的高效性、可靠性、保密性、大容量、低成本等特點,建立學(xué)生宿舍管理系統(tǒng),對宿舍相關(guān)信息進行統(tǒng)一管理。新型管理方式學(xué)生宿舍管理系統(tǒng),將幫助宿舍管理人員提高工作效率,全面地掌握宿舍情況,提高宿舍安全系數(shù),快速解決學(xué)生入住學(xué)生宿舍遇到的問題,幫助管理人員與教師及時掌握學(xué)生情況。l 設(shè)計目標(biāo)開發(fā)設(shè)計學(xué)生宿舍管理系統(tǒng),運用簡單的計算

6、機操作實現(xiàn)快速檢索和快速查找,方便信息錄入和更新,本系統(tǒng)僅針對管理員進行使用。實現(xiàn)信息查詢、日常管理、宿舍管理、信息維護幾個方面的系統(tǒng)化管理:1、信息查詢:a)宿舍信息:包括宿舍樓編號、寢室編號、入住人數(shù)、寢室入住人員學(xué)號、用水量、用電量、水費、電費。b)學(xué)生信息:包括學(xué)生姓名、學(xué)號、宿舍號c)宿舍基本配置:包括床、柜子、燈、風(fēng)扇、電視機2、宿舍管理:學(xué)生管理(入住、更換宿舍、);房間管理(增加、刪除、查詢)3、信息維護:學(xué)生個人信息更新、宿舍信息更新、宿舍設(shè)備信息更新。2、系統(tǒng)開發(fā)環(huán)境 開發(fā)所使用數(shù)據(jù)庫系統(tǒng):MySql開發(fā)環(huán)境:windows 7開發(fā)工具:Microsoft VisualSt

7、udio 2010開發(fā)語言:C+、SQL3、系統(tǒng)需求分析l 基本功能需求學(xué)生宿舍管理系統(tǒng)為了更好的進行宿舍管理而設(shè)計。用戶的需求具體體現(xiàn)在各種信息的輸入、修改和查詢。系統(tǒng)功能實現(xiàn)如下:1、提供學(xué)生的入住信息的錄入,更換宿舍信息登記。 提供各宿舍的具體信息,如宿舍樓棟、宿舍號、水費、電費等。并可通過查詢宿舍號得到宿舍的具體信息、入住的學(xué)生信息、宿舍的設(shè)備信息等。2、提供管理員增加、刪除各信息的功能。l 功能模塊本宿舍管理系統(tǒng)的主要功能為:學(xué)生管理、宿舍信息管理、宿舍設(shè)備信息管理、信息查詢、息更新、信息維護。l 數(shù)據(jù)字典(1)宿舍設(shè)備情況數(shù)據(jù)字典(2)宿舍信息情況數(shù)據(jù)字典(3)學(xué)生信息情況數(shù)據(jù)字典

8、4、概念結(jié)構(gòu)設(shè)計l 概念設(shè)計(1)學(xué)生實體:用于顯示學(xué)生的屬性,包括姓名、學(xué)號、宿舍編號。(2)宿舍實體:用于顯示宿舍的屬性,包括樓號、宿舍號、入住學(xué)生學(xué)號、可住人數(shù)、已住人數(shù)、用水量、水費、用電量、電費。(3)宿舍設(shè)備實體:用于顯示宿舍設(shè)備的屬性,包括床、柜子、風(fēng)扇、燈、電視機。l E_R模型設(shè)計(1) 學(xué)生實體E_R圖 (2)宿舍實體E_R圖 (3)宿舍物品設(shè)備實體E_R圖 (4)各實體關(guān)系E_R圖5、邏輯結(jié)構(gòu)設(shè)計l 將E-R圖轉(zhuǎn)換為關(guān)系模型:(1)Student:(num、name、dormitoryCat);(2)Room:(dormitoryCat、dormitory、room、st

9、udentNum、water、waterCharge、electricity、electricityCharge);(3)Item:(dormitoryCat、bed、cabinet、light、fan、tv)l 各表關(guān)系模型圖:(1) Item表外鍵設(shè)計:(2) Student表外鍵設(shè)計:(3) 各表之間的關(guān)系模型圖,Item表與Student表通過外鍵與Room聯(lián)系:6、數(shù)據(jù)實施和維護l 功能實現(xiàn)的代碼/dbstruct.h#pragma onceclass dbStructpublic:MYSQL my;char errMsg300;/學(xué)生表charStudentNum9;charStu

10、dentName20;/宿舍chardormitoryCat6;chardormitory3;charroom4;doublewater;doubleelectricity;doublewaterCharge;doubleelectricityCharge;unsigned int members;/物件boolbed;boolcabinet;boollight;boolfan;booltv;dbStruct();dbStruct();bool Init();bool GetStruct();/添加學(xué)生表一項bool InsertStudentTable();/改變一項bool SetStud

11、entTable(char num9);/主鍵為num, vachar(8)/獲取一項bool GetStudent(char num9);/*刪除一項bool DeleteStudent(char num9);/添加宿舍表一項bool InsertDormitoryTable();/改變一項bool SetDormitoryTable(char dormitoryCat6);/主鍵為dormitoryCat, varchar(6)/獲得一項bool GetDormitory(char dormitoryCat6);/刪除一項bool DeleteDormitory(char dormitor

12、yCat6);/添加物品表一項bool InsertItemTable();/改變一項bool SetItemTable(char dormitoryCat6);/主鍵為dormitoryCat, varchar(6)/獲得一項bool GetItem(char dormitoryCat6);/*刪除一項bool DeleteItem(char dormitoryCat6);void ErrMB();/dbStruct.cpp#include "stdafx.h"dbStruct:dbStruct()this->water = 0.0;this->electri

13、city = 0.0;this->waterCharge = 0.0;this->electricityCharge = 0.0;this->members = 4;this->bed = TRUE;this->cabinet = TRUE;this->light = TRUE;this->fan = TRUE;this->tv = TRUE;dbStruct:dbStruct()mysql_close(&my);bool dbStruct:Init()mysql_init(&this->my);if(!mysql_real

14、_connect(&this->my, "localhost", "root", "fast", "dormitory", 0, NULL, 0)StringCchPrintfA(errMsg, 300, "獲取寢室物件信息錯誤: %sn", mysql_error(&this->my);return false;mysql_query(&this->my, "SET NAMES gbk");return true;bool dbSt

15、ruct:InsertStudentTable()if(this->dormitoryCat = NULL |this->StudentName = NULL | this->StudentNum = NULL)StringCchPrintfA(errMsg, 100, "添加學(xué)生信息錯誤: 值不完整n");return FALSE;char query300;/獲得該寢室已住人數(shù)數(shù)StringCchPrintfA(query, 300, "SELECT count(dormitoryCat) FROM student WHERE dormito

16、ryCat = "19425"",this->dormitoryCat);mysql_query(&this->my, query);/可以確保在數(shù)據(jù)庫工作正常的情況下,能夠查詢到惟一的一條數(shù)據(jù)MYSQL_RES * res;res = mysql_use_result(&this->my);MYSQL_ROW row;int i; /i為已住人數(shù)while(row = mysql_fetch_row(res) != NULL)i = row00 - '0'mysql_free_result(res);if(+i

17、> 4)/超過了寢室最大人員數(shù)量StringCchPrintfA(errMsg, 300, "添加學(xué)生信息錯誤: 此寢室已滿n");/*是否自動添加宿舍信息return FALSE;/可以添加學(xué)生信息StringCchPrintfA(query, 300,"INSERT INTO student(num, name, dormitoryCat) VALUES("%s", "%s", "%s")",this->StudentNum, this->StudentName, this

18、->dormitoryCat);if(mysql_query(&this->my, query) != 0)StringCchPrintfA(errMsg, 300, "添加學(xué)生信息錯誤: %sn", mysql_error(&this->my);/*是否需要自動添加宿舍信息return FALSE;return TRUE;bool dbStruct:DeleteStudent(char num9)char query300;StringCchPrintfA(query, 300, "DELETE FROM student WHE

19、RE num = "%s"", num);if(mysql_query(&this->my, query) != 0)StringCchPrintfA(errMsg, 300, "刪除學(xué)生信息錯誤: %sn", mysql_error(&this->my);/*是否需要自動添加宿舍信息return FALSE;return TRUE;bool dbStruct:GetStudent(char num9)char query300;StringCchPrintfA(query, 300, "SELECT *

20、FROM student WHERE num = "%s"", num);if(mysql_query(&this->my, query) != NULL)StringCchPrintfA(errMsg, 300, "獲取學(xué)生信息錯誤: %sn", mysql_error(&this->my);return FALSE;MYSQL_RES * res;MYSQL_ROW row;res = mysql_use_result(&this->my);while(row = mysql_fetch_row(r

21、es) != NULL)StringCchPrintfA(this->StudentNum, 9, row0);StringCchPrintfA(this->StudentName, 20, row1);StringCchPrintfA(this->dormitoryCat, 6, row2);mysql_free_result(res);return TRUE;bool dbStruct:InsertDormitoryTable()if(this->dormitoryCat = NULL | this->room = NULL | this->dormit

22、ory = NULL)StringCchPrintfA(errMsg, 300, "添加宿舍信息錯誤: 值不完整n");return FALSE;char query300;StringCchPrintfA(query, 300,"INSERT INTO room(dormitoryCat, dormitory, room, studentsNum, water, electricity, waterCharge, electricityCharge) VALUES("%s", "%s", "%s", %

23、d, %.2lf, %.2lf, %.2lf, %.2lf)",this->dormitoryCat, this->dormitory, this->room,this->members, this->water, this->electricity, this->waterCharge, this->electricityCharge);if(mysql_query(&this->my, query) != 0)StringCchPrintfA(errMsg, 300, "添加宿舍信息錯誤: %sn"

24、, mysql_error(&this->my);return FALSE;this->InsertItemTable();return TRUE;bool dbStruct:DeleteDormitory(char dormitoryCat6)/由于外鍵約束,刪除此寢室時,相應(yīng)的student和item表中的此寢室信息自動刪除.char query300;StringCchPrintfA(query, 300, "DELETE FROM room WHERE dormitoryCat = "%s"", dormitoryCat);i

25、f(mysql_query(&this->my, query) != 0)StringCchPrintfA(errMsg, 300, "刪除宿舍信息錯誤: %sn", mysql_error(&this->my);return FALSE;return TRUE;bool dbStruct:GetDormitory(char dormitoryCat6)char query300;StringCchPrintfA(query, 300, "SELECT * FROM room WHERE dormitoryCat = "%s&

26、quot;", dormitoryCat);if(mysql_query(&this->my, query) != NULL)StringCchPrintfA(errMsg, 300, "獲取寢室信息錯誤: %sn", mysql_error(&this->my);return FALSE;MYSQL_RES * res;MYSQL_ROW row;res = mysql_use_result(&this->my);while(row = mysql_fetch_row(res) != NULL)StringCchPrin

27、tfA(this->dormitoryCat, 6, row0);StringCchPrintfA(this->dormitory, 3, row1);StringCchPrintfA(this->room, 4, row2);this->members = atoi(row3);this->water = atof(row4);this->electricity = atof(row5);this->waterCharge = atof(row6);this->electricityCharge = atof(row7);mysql_free_

28、result(res);return TRUE;bool dbStruct:InsertItemTable()if(this->dormitoryCat = NULL)StringCchPrintfA(errMsg, 300, "添加宿舍信息錯誤: 值不完整n");return FALSE;char query300;StringCchPrintfA(query, 300,"INSERT INTO item(dormitoryCat,bed, cabinet, light, fan, tv) VALUES("%s", %d, %d, %d

29、, %d, %d)",this->dormitoryCat, this->bed, this->cabinet, this->light,this->fan, this->tv);if(mysql_query(&this->my, query) != 0)StringCchPrintfA(errMsg, 300, "添加宿舍物件信息錯誤: %sn", mysql_error(&this->my);return FALSE;return TRUE;bool dbStruct:GetItem(char d

30、ormitoryCat6)char query300;StringCchPrintfA(query, 300, "SELECT * FROM item WHERE dormitoryCat = "%s"", dormitoryCat);if(mysql_query(&this->my, query) != NULL)StringCchPrintfA(errMsg, 300, "獲取寢室物件信息錯誤: %sn", mysql_error(&this->my);return FALSE;MYSQL_RES *

31、res;MYSQL_ROW row;res = mysql_use_result(&this->my);while(row = mysql_fetch_row(res) != NULL)StringCchPrintfA(this->dormitoryCat, 6, row0);this->bed = (atoi(row3) = 1? true: false);this->cabinet = (atof(row4) = 1? true: false);this->light = (atof(row5) = 1? true: false);this->f

32、an = (atof(row6) = 1? true: false);this->tv = (atof(row7) = 1? true: false);mysql_free_result(res);return TRUE;void dbStruct:ErrMB()MessageBoxA(GetActiveWindow(), this->errMsg, "發(fā)生錯誤!", MB_ICONERROR);/stdafx.h#pragma once#include "targetver.h"/ Windows 頭文件:#include <wind

33、ows.h>#include <mysql.h>#include <WindowsX.h>#include <CommCtrl.h>/ C 運行時頭文件#include <stdlib.h>#include <malloc.h>#include <memory.h>#include <tchar.h>#include <strsafe.h>/ TODO: 在此處引用程序需要的其他頭文件#include "dbStruct.h"#pragma comment(lib, &qu

34、ot;libmysql.lib")#pragma comment(lib, "comctl32.lib")/stdafx.cpp/ stdafx.cpp : 只包括標(biāo)準(zhǔn)包含文件的源文件/ DormitoryMng.pch 將作為預(yù)編譯頭/ stdafx.obj 將包含預(yù)編譯類型信息#include "stdafx.h"/dormitoryMng.h#pragma once#include "resource.h"#define MAX_LOADSTRING 100/dormitoryMng.cpp(部分代碼)bool Que

35、ryStart(bool flag)char query300;if(flag = true)/查詢寢室信息GetWindowTextA(GetDlgItem(g_hWndQuery, IDC_EDITBUILD), m_db.dormitory, 3);GetWindowTextA(GetDlgItem(g_hWndQuery, IDC_EDITROOM), m_db.room, 4);if(strcmp(m_db.dormitory, "") = 0 && strcmp(m_db.room,"") = 0)StringCchCopyA

36、(query, 300,"SELECT room.dormitoryCat,dormitory, room, studentsNum, count(student.dormitoryCat), water, electricity, waterCharge, electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat GROUP BY room.dormitoryCat"else if(strcmp(m_db.dormitory, ""

37、) != 0 && strcmp(m_db.room,"") = 0)StringCchPrintfA(query, 300,"SELECT room.dormitoryCat,dormitory, room, studentsNum, count(student.dormitoryCat), water, electricity, waterCharge, electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat WHERE

38、dormitory = "%s" GROUP BY room.dormitoryCat",m_db.dormitory);else if(strcmp(m_db.dormitory, "") = 0 && strcmp(m_db.room,"") != 0)StringCchPrintfA(query, 300,"SELECT room.dormitoryCat,dormitory, room, studentsNum, count(student.dormitoryCat), water, ele

39、ctricity, waterCharge, electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat WHERE room = "%s" GROUP BY room.dormitoryCat",m_db.room);elseStringCchPrintfA(query, 300,"SELECT room.dormitoryCat,dormitory, room, studentsNum, count(student.dormitor

40、yCat), water, electricity, waterCharge, electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat WHERE dormitory = "%s" AND room = "%s" GROUP BY room.dormitoryCat",m_db.dormitory, m_db.room);if(true != QueryInput(L"寢室號.樓棟號.寢室號.可住人數(shù).當(dāng)前人數(shù).

41、用水量.用電量.水費.電費", 9, query)m_db.ErrMB();else/查詢學(xué)生信息GetWindowTextA(GetDlgItem(g_hWndQuery, IDC_EDITSTUNO), m_db.StudentNum, 9);GetWindowTextA(GetDlgItem(g_hWndQuery, IDC_EDITSTUNAME), m_db.StudentName, 20);if(strcmp(m_db.StudentNum, "") = 0 && strcmp(m_db.StudentName, ""

42、;) = 0)StringCchCopyA(query, 300,"SELECT num, name, dormitoryCat FROM student");else if(strcmp(m_db.StudentNum, "") != 0 && strcmp(m_db.StudentName, "") = 0)StringCchPrintfA(query, 300,"SELECT num, name, dormitoryCat FROM student WHERE num = "%s"&

43、quot;,m_db.StudentNum);else if(strcmp(m_db.StudentNum, "") = 0 && strcmp(m_db.StudentName, "") != 0)StringCchPrintfA(query, 300,"SELECT num, name, dormitoryCat FROM student WHERE name = "%s"",m_db.StudentName);elseStringCchPrintfA(query, 300,"SELE

44、CT num, name, dormitoryCat FROM student WHERE name = "%s" AND num = "%s"",m_db.StudentName, m_db.StudentNum);if(true != QueryInput(L"學(xué)號.姓名.所住寢室", 3, query)m_db.ErrMB();return TRUE;LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)int wm

45、Id, wmEvent;PAINTSTRUCT ps;HDC hdc;switch (message)case WM_CREATE:if(!m_db.Init()m_db.ErrMB();/*填寫錯誤信息break;/創(chuàng)建列表CreateList(hWnd);/查詢填充if(false = QueryInput(L"寢室號.樓棟號.寢室號.可住人數(shù).當(dāng)前人數(shù).用水量.用電量.水費.電費", 9,"SELECT room.dormitoryCat,dormitory, room, studentsNum,count(student.dormitoryCat),wat

46、er,electricity, waterCharge,electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat GROUP BY room.dormitoryCat")m_db.ErrMB();break;case WM_NOTIFY:LPNMITEMACTIVATE nc = (LPNMITEMACTIVATE)lParam;if(nc->hdr.code = NM_RCLICK && nc->iSubItem != 0)HMENU

47、 hMenu = CreatePopupMenu();InsertMenu(hMenu, 0, MF_ENABLED, 10023, _T("刪除");InsertMenu(hMenu, 0, MF_ENABLED, 10024, _T("詳細(xì)信息");ClientToScreen(hWnd, &nc->ptAction);int result = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_LEFTBUTTON| TPM_NOANIMATION,nc->ptAction.x + 5, nc-&

48、gt;ptAction.y + 30, 0, hWnd, NULL);if(result = 10023)wchar_t str9;ListView_GetItemText(g_hWndList, nc->iItem, 2, str, 9);int iSize;char * szMultiByte;/寬字符轉(zhuǎn)換成多字節(jié)型iSize = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);szMultiByte = new chariSize;WideCharToMultiByte(CP_ACP, 0, str, -1,

49、 szMultiByte, iSize, NULL, NULL);if(iSize = 6)if(!m_db.DeleteDormitory(szMultiByte)m_db.ErrMB();delete szMultiByte;break;/刷新ListView_DeleteAllItems(g_hWndList);while(ListView_DeleteColumn(g_hWndList, 1)if(true != QueryInput(L"寢室號.樓棟號.寢室號.可住人數(shù).當(dāng)前人數(shù).用水量.用電量.水費.電費", 9,"SELECT room.dormit

50、oryCat,dormitory, room, studentsNum,count(student.dormitoryCat),water,electricity, waterCharge,electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat GROUP BY room.dormitoryCat")m_db.ErrMB();elseif(!m_db.DeleteStudent(szMultiByte)m_db.ErrMB();delete szMultiByt

51、e;break;/刷新ListView_DeleteAllItems(g_hWndList);while(ListView_DeleteColumn(g_hWndList, 1)if(true != QueryInput(L"學(xué)號.姓名.所住寢室", 3, "SELECT * FROM student")m_db.ErrMB();delete szMultiByte;RedrawWindow(g_hWnd, NULL, NULL, RDW_INVALIDATE);break;case WM_COMMAND:wmId = LOWORD(wParam);wm

52、Event = HIWORD(wParam);/ 分析菜單選擇:switch (wmId)case IDC_REFRESH:/刷新ListView_DeleteAllItems(g_hWndList);while(ListView_DeleteColumn(g_hWndList, 1)if(true != QueryInput(L"寢室號.樓棟號.寢室號.可住人數(shù).當(dāng)前人數(shù).用水量.用電量.水費.電費", 9,"SELECT room.dormitoryCat,dormitory, room, studentsNum,count(student.dormitory

53、Cat),water,electricity, waterCharge,electricityCharge FROM room LEFT JOIN student ON room.dormitoryCat = student.dormitoryCat GROUP BY room.dormitoryCat")m_db.ErrMB();RedrawWindow(g_hWnd, NULL, NULL, RDW_INVALIDATE);break;case IDC_DELETE:int itemCount;itemCount = ListView_GetItemCount(g_hWndLis

54、t);for(int i = 0; i < itemCount; i+)if(ListView_GetCheckState(g_hWndList, i)wchar_t str9;ListView_GetItemText(g_hWndList, i, 2, str, 9);int iSize;char * szMultiByte;/寬字符轉(zhuǎn)換成多字節(jié)型iSize = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);szMultiByte = new chariSize;WideCharToMultiByte(CP_A

55、CP, 0, str, -1, szMultiByte, iSize, NULL, NULL);if(iSize = 6)if(!m_db.DeleteDormitory(szMultiByte)m_db.ErrMB();delete szMultiByte;break;/刷新ListView_DeleteAllItems(g_hWndList);while(ListView_DeleteColumn(g_hWndList, 1)if(true != QueryInput(L"寢室號.樓棟號.寢室號.可住人數(shù).當(dāng)前人數(shù).用水量.用電量.水費.電費", 9,"SELECT room.dormitoryCat,dormitory, room, studentsNum,count(stu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論