數據庫課程設計說明書-轎車銷售信息管理系統(tǒng)_第1頁
數據庫課程設計說明書-轎車銷售信息管理系統(tǒng)_第2頁
數據庫課程設計說明書-轎車銷售信息管理系統(tǒng)_第3頁
數據庫課程設計說明書-轎車銷售信息管理系統(tǒng)_第4頁
數據庫課程設計說明書-轎車銷售信息管理系統(tǒng)_第5頁
已閱讀5頁,還剩54頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

PAGEPAGE2中北大學數據庫課程設計說明書

學院、系:軟件學院專業(yè)軟件工程學生姓名:學號:設計題目:轎車銷售信息管理系統(tǒng)起迄日期:指導教師:

20年月日需求分析管理信息系統(tǒng)在現代社會已深入到各行各業(yè),由于計算機技術的迅速發(fā)展和普及,管理信息系統(tǒng)事實上已成為計算機管理信息系統(tǒng)。

轎車信息管理系統(tǒng)是基于商品信息數據庫,遵照商場實際管理流程,對商場商品的進、銷、存的全過程進行全面管理的計算機應用系統(tǒng)。它將人工智能的理論引入商場,其目標是將商場人工操作的商品信息管理工作,轉為有計算機網絡系統(tǒng)自動操作完成。該系統(tǒng)實現了對整個商場商品信息資源的合理共享與分配,并進行科學有效的管理,在這個基礎上謀求提高商品的信息管理效率。

在整個課程設計過程中,本設計具體完成了對“基本資料”、“售后服務管理”、“銷售管理”、“庫存管理”和“系統(tǒng)管理”這5個功能模塊的實現。所以本設計主要是對這5個模塊的設計,以實用、標準、可靠、強擴展性的原則為出發(fā)點,能夠為商品的進銷存提供最簡便、最科學、最優(yōu)化的系統(tǒng)設計和服務。本系統(tǒng)結合實際的轎車銷售服務管理制度??傮w設計2.1.1數據庫應用系統(tǒng)的開發(fā)涉及如下內容:系統(tǒng)功能設計;數據庫設計;界面設計程序代碼設計2.1.2項目內容:開發(fā)一個轎車銷售管理系統(tǒng)對于該項目,主要注意以下兩個方面:轎車銷售公司的銷售員管理、轎車信息管理和客戶信息管理轎車銷售系統(tǒng)中涉及那些數據對象,各對象之間以及對象內部的關系如何?如何保存?zhèn)€數據對象的相關數據,以便圖書館借閱系統(tǒng)進行數據處理。2.2分析2.2.1轎車銷售系統(tǒng)的主要功能有:系統(tǒng)用戶管理功能。用戶根據姓名和密碼登錄系統(tǒng)。登錄用戶分為兩個等級:普通用戶和管理員用戶。普通用戶只查看轎車信息、客戶信息、員工信息等功能;管理員用戶(admin)除了以上功能外,同時還有添加用戶、修改用戶密碼和刪除用戶的功能。轎車信息管理功能。錄入所銷售的轎車編號、型號、品牌、價格、保修期等信息,同時支持對轎車信息的添加、修改、刪除和查詢功能??蛻粜畔⒐芾砉δ堋d浫胭徺I轎車的客戶姓名、性別、年齡、聯(lián)系方式、所購車型號、購車價格等信息,同時還支持虧客戶信息的添加、修改、刪除和查詢功能。員工信息管理功能。錄入員工的員工號、姓名、性別等信息,同時支持對員工信息的添加、修改、刪除和查詢功能。2.2.2根據系統(tǒng)的功能要求,采用模塊化的方法,設計圖書借閱系統(tǒng)的控制流程圖如圖:登錄登錄修改用戶密碼查詢用戶密碼系統(tǒng)用戶刪除系統(tǒng)用戶管理功能轎車信息管理功能客戶信息管理功能員工信息管理功能轎車信息查詢轎車信息添加轎車信息修改轎車信息刪除客戶信息查詢客戶信息添加客戶信息修改客戶信息刪除員工信息查詢員工信息添加員工信息修改員工信息刪除系統(tǒng)用戶添加2.2.3E-R模型用E-R模型描述土書館管理系統(tǒng)中的實體集與實體集之間的關系,目的是以E-R圖為工具,設計關系型的數據庫,即確定應用系統(tǒng)所使用的數據庫應包含哪些表,每個表的結構是怎么樣的。經過轉換,可以導出各個關系。這些實體涉及的數據項有:系統(tǒng)用戶:(用戶名、密碼、用戶等級)管理:(用戶等級、類型描述)汽車信息:(轎車編號、轎車型號、轎車品牌、轎車價格、轎車保修期、轎車具體描述)客戶信息:(客戶編號、客戶姓名、客戶性別、客戶年齡、客戶職業(yè)、身份證號、客戶電話、客戶住址、購車型號、購車價格、備注)員工信息:(姓名編號、性別﹑生日﹑進入公司時間﹑部門﹑職位)注:下劃鍵為主鍵系統(tǒng)用戶系統(tǒng)用戶員工信息客戶信息轎車信息管理用戶名密碼用戶等級類型描述用戶級別轎車型號轎車編號轎車品牌轎車價格轎車保修期轎車具體描述客戶編號客戶年齡客戶職業(yè)身份證號客戶電話客戶住址購車價格購車型號客戶性別客戶姓名員工編號員工性別員工姓名員工電話員工職務員工生日員工地址進入公司時間所在部門創(chuàng)建數據庫在創(chuàng)建數據庫表之前,首先要創(chuàng)建一個數據庫,本系統(tǒng)以SQLServer2000為后臺數據庫。用戶可以在企業(yè)管理器中創(chuàng)建數據庫,也可以在查詢分析器中執(zhí)行SQL語句。需要主要的是,在設計數據庫結構時,通常需要考慮主文件,從文件和日志文件的存儲位置和大小。文件大小可以根據數據庫的用途,用戶數量和存儲數據等因素綜合考慮。一般出事大小不宜設置過大,以免浪費存儲空間。而文件最大尺寸需要設置大些,以保證有足夠的存儲空間。日志文件則不需要太多的空間。轎車銷售管理系統(tǒng)庫表結構設計該系統(tǒng)設計了五個數據庫表:用戶信息表Users、用戶類型表UserType、轎車信息表Car、客戶信息表Customer、員工信息表Staff。具體結構如下圖所示:Users表字段名稱標識名稱數據類型空否字段說明User_name用戶名Varchar(10)N主鍵User_pwd密碼Varchar(20)NUser_type用戶等級smallintN限制用戶權限UserType表字段名稱標識名稱數據類型空否字段說明User_type用戶等級SmallintN限制用戶權限Type_discription類型描述Varchar(50)NCar表字段名稱標識名稱數據類型空否字段說明Car_ip轎車編號IntN自增,主鍵Car_name轎車型號Varchar(20)NCar_brand轎車品牌Varchar(10)NCar_price轎車價格IntNCar_time轎車保修期Varchar(10)NCar_info轎車具體描述Varchar(100)Y備注Customer表字段名稱標識名稱數據類型空否字段說明Customer_id客戶編號IntN自增,主鍵Customer_name客戶姓名Varchar(10)NCustomer_sex客戶性別Varchar(2)NCustomer_age客戶年齡IntYCustomer_occup客戶職業(yè)Varchar(10)YCustomer_num身份證號Varchar(20)YCustomer_tel客戶電話Varchar(10)YCustomer_addr客戶住址Varchar(20)YBuy_car購車型號Varchar(20)NBuy_price購車價格Varchar(10)NInfo備注Varchar(100)Y客戶其他信息Staff表字段名稱標識名稱數據類型空否字段說明Staff_id員工編號IntN自增,主鍵Staff_name員工姓名Varchar(10)NStaff_sex員工性別Varchar(2)NStaff_brith員工生日Varchar(8)YStaff_intime進入公司時間Varchar(8)NStaff_depart所在部門Varchar(10)YStaff_title員工職務Varchar(10)YStaff_tel員工電話Varchar(10)YStaff_addr員工住址Varchar(20)Y當登錄成功后,就會進入如圖3-3的主界面。首頁主要由兩大部分組成,第一部分是功能導航區(qū),第二部分是操作區(qū)。圖系統(tǒng)主界面PublicUserAsStringPublicusertypeAsIntegerPrivateSubForm_Load()Frm_login.Show1EndSubPrivateSubMenu_addCar_Click()Frm_addCar.ShowEndSubPrivateSubMenu_addCus_Click()Frm_addCus.ShowEndSubPrivateSubMenu_addEmp_Click()Frm_addEmp.ShowEndSubPrivateSubMenu_addUser_Click()Frm_addUser.ShowEndSubPrivateSubMenu_Exit_Click()創(chuàng)建用戶管理模塊窗體工作流程用戶管理模塊有幾個窗體所共同組成,其流程如圖13所示顯示用戶列表輸入用戶名選擇用戶類型更改用戶類型輸入密碼添加用戶刪除用戶選擇用戶修改用戶添加用戶成功顯示用戶列表輸入用戶名選擇用戶類型更改用戶類型輸入密碼添加用戶刪除用戶選擇用戶修改用戶添加用戶成功圖用戶管理模塊的流程系統(tǒng)用戶信息管理只要用于添加用戶、修改刪除密碼。添加信息如圖3-4所示。圖3-14添加系統(tǒng)用戶PublicUserAsStringPublicusertypeAsIntegerPrivateSubForm_Load()Frm_login.Show1EndSubPrivateSubMenu_addCar_Click()Frm_addCar.ShowEndSubPrivateSubMenu_addCus_Click()Frm_addCus.ShowEndSubPrivateSubMenu_addEmp_Click()Frm_addEmp.ShowEndSubPrivateSubMenu_addUser_Click()Frm_addUser.ShowEndSubPrivateSubMenu_Exit_Click()創(chuàng)建汽車信息管理模塊窗體模塊的功能在汽車信息管理模塊中,包含3個窗體:汽車信息列表窗體、汽車信息編輯體和顯示庫存數量的窗體。汽車信息列表窗體以表格的形式列出當前系統(tǒng)中的汽車信息,并且為用戶提供了進行各種操作的接口;汽車信息編輯窗體用于顯示某一個汽車的基本信息,借助該窗體可以對某個汽車信息進行編輯,也可以向數據庫增加一個汽車信息;顯示庫存數量的窗體主要是借助圖形方式顯示出汽車當前的數量。窗體工作流程添加編輯刪除查找添加編輯刪除查找汽車信息列表圖形顯示庫存狀態(tài)汽車信息列表圖形顯示庫存狀態(tài)圖汽車信息管理模塊的子功能窗體界面顯示轎車信息管理模塊主要用于查看轎車信息、修改/刪除轎車信息、增加轎車信息具體操圖按條件查詢轎車修改/刪除轎車信息增加轎車信息DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCustomerOrderbyCustomer_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIfcus_name=""ThenMsgBox("請輸入客戶名字")ExitSubEndIfIfbuycar_name=""ThenMsgBox("請輸入汽車型號")ExitSubElseAdodc1.RecordSource="select*fromCarwhereCar_name='"+Trim(buycar_name)IfAdodc1.Recordset.BOF=FalseThenMsgBox("沒有的輸入汽車型號")buycar_name.SetFocusEndIf客戶信息管理模塊實現客戶信息管理模塊主要用于查看客戶信息、修改/刪除客戶信息、增加客戶信息具體操作圖3-19至3-21所示。圖3-19查詢客戶信息圖3-20修改/刪除客戶信息圖3-21添加客戶信息該模塊的具體設計執(zhí)行代碼如下:PrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCustomerOrderbyCustomer_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIfcus_name=""ThenMsgBox("請輸入客戶名字")ExitSubEndIfIfbuycar_name=""ThenMsgBox("請輸入汽車型號")ExitSubElseAdodc1.RecordSource="select*fromCarwhereCar_name='"+Trim(buycar_name)IfAdodc1.Recordset.BOF=FalseThenMsgBox("沒有的輸入汽車型號")buycar_name.SetFocusEndIf員工信息管理模塊實現員工信息管理模塊主要用于查看員工信息、修改/刪除員工信息、員工客戶信息具體操作圖3-11至3-10所示。圖3-22員工信息查詢圖3-23修改/刪除員工信息該模塊具體設計執(zhí)行代碼如下:PrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMStaffOrderbyStaff_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIftxtEmpname=""ThenMsgBox("請輸入員工名字")ExitSubEndIfIftxtsex=""ThenMsgBox("請輸入員工性別")ExitSubEndIfIftxtindate=""ThenMsgBox("請輸入進入公司時間")ExitSub3.詳細設計PublicUserAsStringPublicusertypeAsIntegerPrivateSubForm_Load()Frm_login.Show1EndSubPrivateSubMenu_addCar_Click()Frm_addCar.ShowEndSubPrivateSubMenu_addCus_Click()Frm_addCus.ShowEndSubPrivateSubMenu_addEmp_Click()Frm_addEmp.ShowEndSubPrivateSubMenu_addUser_Click()Frm_addUser.ShowEndSubPrivateSubMenu_Exit_Click()UnloadMeEndSubPrivateSubMenu_edit_Car_Click()Frm_edit_Car.ShowEndSubPrivateSubMenu_edit_Cus_Click()Frm_edit_Cus.ShowEndSubPrivateSubMenu_edit_User_Click()Frm_edit_User.ShowEndSubPrivateSubMenu_modiEmp_Click()Frm_edit_Emp.ShowEndSubPrivateSubMenu_queCar_Click()Frm_queCar.ShowEndSubPrivateSubMenu_queCus_Click()Frm_queCus.ShowEndSubPrivateSubMenu_queEmp_Click()Frm_queEmp.ShowEndSub

PrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCarOrderbyCar_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIftxtBrand.Text=""ThenMsgBox("請輸入汽車品牌")ExitSubEndIfIftxtPrice.Text=""ThenMsgBox("請輸入汽車價格")ExitSubEndIfIftxtName.Text=""ThenMsgBox("請輸入汽車型號")ExitSubEndIfIftxtTime.Text=""ThenMsgBox("請輸入汽車保修期")ExitSubEndIf'增加新車Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Val(txtId)Adodc1.Recordset.Fields(1).Value=Trim(txtName.Text)Adodc1.Recordset.Fields(2).Value=Trim(txtBrand.Text)Adodc1.Recordset.Fields(3).Value=Val(Trim(txtPrice.Text))Adodc1.Recordset.Fields(4).Value=Trim(txtTime.Text)Adodc1.Recordset.Fields(5).Value=Trim(txtInfo.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox"汽車信息增加完成"UnloadMeEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubForm_Load()EndSubPrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCarOrderbyCar_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIftxtBrand.Text=""ThenMsgBox("請輸入汽車品牌")ExitSubEndIfIftxtPrice.Text=""ThenMsgBox("請輸入汽車價格")ExitSubEndIfIftxtName.Text=""ThenMsgBox("請輸入汽車型號")ExitSubEndIfIftxtTime.Text=""ThenMsgBox("請輸入汽車保修期")ExitSubEndIf'增加新車Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Val(txtId)Adodc1.Recordset.Fields(1).Value=Trim(txtName.Text)Adodc1.Recordset.Fields(2).Value=Trim(txtBrand.Text)Adodc1.Recordset.Fields(3).Value=Val(Trim(txtPrice.Text))Adodc1.Recordset.Fields(4).Value=Trim(txtTime.Text)Adodc1.Recordset.Fields(5).Value=Trim(txtInfo.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox"汽車信息增加完成"UnloadMeEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubForm_Load()EndSubPrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCarOrderbyCar_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIftxtBrand.Text=""ThenMsgBox("請輸入汽車品牌")ExitSubEndIfIftxtPrice.Text=""ThenMsgBox("請輸入汽車價格")ExitSubEndIfIftxtName.Text=""ThenMsgBox("請輸入汽車型號")ExitSubEndIfIftxtTime.Text=""ThenMsgBox("請輸入汽車保修期")ExitSubEndIf'增加新車Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Val(txtId)Adodc1.Recordset.Fields(1).Value=Trim(txtName.Text)Adodc1.Recordset.Fields(2).Value=Trim(txtBrand.Text)Adodc1.Recordset.Fields(3).Value=Val(Trim(txtPrice.Text))Adodc1.Recordset.Fields(4).Value=Trim(txtTime.Text)Adodc1.Recordset.Fields(5).Value=Trim(txtInfo.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox"汽車信息增加完成"UnloadMeEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubForm_Load()EndSubPrivateSubCmd_add_Click() DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMCustomerOrderbyCustomer_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIfcus_name=""ThenMsgBox("請輸入客戶名字")ExitSubEndIfIfbuycar_name=""ThenMsgBox("請輸入汽車型號")ExitSubElseAdodc1.RecordSource="select*fromCarwhereCar_name='"+Trim(buycar_name)IfAdodc1.Recordset.BOF=FalseThenMsgBox("沒有的輸入汽車型號")buycar_name.SetFocusEndIfEndIfIfbuycar_price=""ThenMsgBox("請輸入汽車價格")ExitSubEndIf'增加新車Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Val(txtId)Adodc1.Recordset.Fields(1).Value=Trim(cus_name.Text)Adodc1.Recordset.Fields(2).Value=Trim(cus_sex.Text)Adodc1.Recordset.Fields(3).Value=Val(Trim(cus_age.Text))Adodc1.Recordset.Fields(4).Value=Trim(cus_job.Text)Adodc1.Recordset.Fields(5).Value=Trim(cus_num.Text)Adodc1.Recordset.Fields(6).Value=Trim(cus_tel.Text)Adodc1.Recordset.Fields(7).Value=Trim(cus_address.Text)Adodc1.Recordset.Fields(8).Value=Trim(buycar_name.Text)Adodc1.Recordset.Fields(9).Value=Trim(buycar_price.Text)Adodc1.Recordset.Fields(10).Value=Trim(cus_info.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox"客戶信息增加完成"UnloadMeEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubFrame1_DragDrop(SourceAsControl,XAsSingle,YAsSingle)EndSubPrivateSubCmd_add_Click()DimtxtIdAsIntegerAdodc1.RecordSource="SELECT*FROMStaffOrderbyStaff_iddesc"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThentxtId=1ElsetxtId=Adodc1.Recordset.Fields(0)+1EndIfIftxtEmpname=""ThenMsgBox("請輸入員工名字")ExitSubEndIfIftxtsex=""ThenMsgBox("請輸入員工性別")ExitSubEndIfIftxtindate=""ThenMsgBox("請輸入進入公司時間")ExitSubEndIf'增加新車Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Val(txtId)Adodc1.Recordset.Fields(1).Value=Trim(txtEmpname.Text)Adodc1.Recordset.Fields(2).Value=Trim(txtsex.Text)Adodc1.Recordset.Fields(3).Value=CDate(Trim(txtbirthdate.Text))Adodc1.Recordset.Fields(4).Value=CDate(Trim(txtindate.Text))Adodc1.Recordset.Fields(5).Value=Trim(txtdepart.Text)Adodc1.Recordset.Fields(6).Value=Trim(txttitle.Text)Adodc1.Recordset.Fields(7).Value=Trim(txttel.Text)Adodc1.Recordset.Fields(8).Value=Trim(txtaddr.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox"員工信息增加完成"UnloadMeEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubFrame1_DragDrop(SourceAsControl,XAsSingle,YAsSingle)EndSub將PrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubCmd_OK_Click()DimusertypeAsInteger'數據有效性檢查IftxtUser=""ThenMsgBox"請輸入用戶名"txtUser.SetFocusExitSubEndIfAdodc1.RecordSource="SELECT*FROMUsersWHEREUser_name='"+Trim(txtUser.Text)+"'"Adodc1.RefreshIfAdodc1.Recordset.EOF=FalseThenMsgBox"已經有此用戶,請重新輸入"txtUser.SetFocusExitSubElseIftxtPwd=""ThenMsgBox"請輸入密碼"txtPwd.SetFocusExitSubEndIfIftxtSurePwd=""ThenMsgBox"請確認密碼"txtSurePwd.SetFocusExitSubEndIfIfOption1=TrueThenusertype=0ElseIfOption2=TrueThenusertype=1ElseMsgBox"請選擇用戶類型"ExitSubEndIfIfLen(txtPwd)<6ThenMsgBox"密碼長度不能小于6"txtPwd.SetFocustxtPwd.SelStart=0txtPwd.SelLength=Len(txtPwd)ExitSubEndIfIftxtPwd<>txtSurePwdThenMsgBox"密碼和確認密碼不相同,請重新確認"txtSurePwd.SetFocustxtSurePwd.SelStart=0txtSurePwd.SelLength=Len(txtSurePwd)ExitSubEndIf'增加新用戶Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(0).Value=Trim(txtUser.Text)Adodc1.Recordset.Fields(1).Value=Trim(txtPwd.Text)Adodc1.Recordset.Fields(2).Value=usertypeAdodc1.Recordset.UpdateAdodc1.RefreshMsgBox"用戶增加完成"UnloadMeEndIfEndSubPrivateSubFrame1_DragDrop(SourceAsControl,XAsSingle,YAsSingle)EndSubPrivateSubtxtUser_Change()EndSubPublicfirstIdAsIntegerPubliclastIdAsIntegerPubliccurIdAsIntegerPrivateSubCmd_del_Click()Adodc1.Recordset.DeleteAdodc1.Recordset.UpdateMsgBox("轎車記錄已刪除")Adodc1.RecordSource="SELECT*FROMCar"Adodc1.RefreshEndSubPrivateSubCmd_final_Click()Adodc1.Recordset.MoveLastCmd_next.Enabled=FalseCmd_pre.Enabled=TrueEndSubPrivateSubCmd_first_Click()Adodc1.Recordset.MoveFirstCmd_pre.Enabled=FalseCmd_next.Enabled=TrueEndSubPrivateSubCmd_modi_Click()curId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.Fields(1)=Trim(txtCarname.Text)Adodc1.Recordset.Fields(2)=Trim(txtCarbrand.Text)Adodc1.Recordset.Fields(3)=Val(Trim(txtCarprice.Text))Adodc1.Recordset.Fields(4)=Trim(txtCartime.Text)Adodc1.Recordset.Fields(5)=Trim(txtCarinfo.Text)Adodc1.Recordset.UpdateMsgBox("轎車記錄已修改")Adodc1.RecordSource="SELECT*FROMCar"Adodc1.RefreshDoWhileAdodc1.Recordset.Fields(0)<>curIdAdodc1.Recordset.Move(1)LoopEndSubPrivateSubCmd_next_Click()IfCmd_pre.Enabled=FalseThenCmd_pre.Enabled=TrueEndIfAdodc1.Recordset.MoveNextIfAdodc1.Recordset.Fields(0)=lastIdThenCmd_next.Enabled=FalseEndIfEndSubPrivateSubCmd_pre_Click()IfCmd_next.Enabled=FalseThenCmd_next.Enabled=TrueEndIfAdodc1.Recordset.MovePreviousIfAdodc1.Recordset.Fields(0)=firstIdThenCmd_pre.Enabled=FalseEndIfEndSubPrivateSubCmd_quit_Click()UnloadMeEndSubPrivateSubForm_Load()Adodc1.RecordSource="SELECT*FROMCar"Adodc1.RefreshIfAdodc1.Recordset.RecordCount<>0ThenAdodc1.Recordset.MoveLastlastId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.MoveFirstfirstId=Adodc1.Recordset.Fields(0)EndIfCmd_pre.Enabled=FalseIfAdodc1.Recordset.RecordCount=1ThenCmd_next.Enabled=FalseEndIfEndSubPublicfirstIdAsIntegerPubliclastIdAsIntegerPubliccurIdAsIntegerPrivateSubCmd_del_Click()Adodc1.Recordset.DeleteAdodc1.Recordset.UpdateMsgBox("客戶記錄已刪除")Adodc1.RecordSource="SELECT*FROMCustomer"Adodc1.RefreshEndSubPrivateSubCmd_final_Click()Adodc1.Recordset.MoveLastCmd_next.Enabled=FalseCmd_pre.Enabled=TrueEndSubPrivateSubCmd_first_Click()Adodc1.Recordset.MoveFirstCmd_next.Enabled=TrueCmd_pre.Enabled=FalseEndSubPrivateSubCmd_modi_Click()curId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.Fields(1)=Trim(cus_name.Text)Adodc1.Recordset.Fields(2)=Trim(cus_sex.Text)Adodc1.Recordset.Fields(3)=Val(Trim(cus_age.Text))Adodc1.Recordset.Fields(4)=Trim(cus_job.Text)Adodc1.Recordset.Fields(5)=Trim(cus_num.Text)Adodc1.Recordset.Fields(6)=Trim(cus_tel.Text)Adodc1.Recordset.Fields(7)=Trim(cus_address.Text)Adodc1.Recordset.Fields(8)=Trim(buycar_name.Text)Adodc1.Recordset.Fields(9)=Trim(buycar_price.Text)Adodc1.Recordset.Fields(10)=Trim(cus_info.Text)Adodc1.Recordset.UpdateMsgBox("客戶記錄已修改")Adodc1.RecordSource="SELECT*FROMCustomer"Adodc1.RefreshDoWhileAdodc1.Recordset.Fields(0)<>curIdAdodc1.Recordset.Move(1)LoopEndSubPrivateSubCmd_next_Click()IfCmd_pre.Enabled=FalseThenCmd_pre.Enabled=TrueEndIfAdodc1.Recordset.MoveNextIfAdodc1.Recordset.Fields(0)=lastIdThenCmd_next.Enabled=FalseEndIfEndSubPrivateSubCmd_pre_Click()IfCmd_next.Enabled=FalseThenCmd_next.Enabled=TrueEndIfAdodc1.Recordset.MovePreviousIfAdodc1.Recordset.Fields(0)=firstIdThenCmd_pre.Enabled=FalseEndIfEndSubPrivateSubCmd_quit_Click()UnloadMeEndSubPrivateSubcus_info_Change()EndSubPrivateSubForm_Load()Adodc1.RecordSource="SELECT*FROMCustomer"Adodc1.RefreshIfAdodc1.Recordset.RecordCount<>0ThenAdodc1.Recordset.MoveLastlastId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.MoveFirstfirstId=Adodc1.Recordset.Fields(0)EndIfCmd_pre.Enabled=FalseIfAdodc1.Recordset.RecordCount=1ThenCmd_next.Enabled=FalseEndIfEndSubPublicfirstIdAsIntegerPubliclastIdAsIntegerPubliccurIdAsIntegerPrivateSubCmd_Exit_Click()UnloadMeEndSubPrivateSubCmd_del_Click()Adodc1.Recordset.DeleteAdodc1.Recordset.UpdateMsgBox("員工記錄已刪除")Adodc1.RecordSource="SELECT*FROMStaff"Adodc1.RefreshEndSubPrivateSubCmd_final_Click()Adodc1.Recordset.MoveLastCmd_next.Enabled=FalseCmd_pre.Enabled=TrueEndSubPrivateSubCmd_first_Click()Adodc1.Recordset.MoveFirstCmd_pre.Enabled=FalseCmd_next.Enabled=TrueEndSubPrivateSubCmd_modi_Click()curId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.Fields(1).Value=Trim(txtEmpname.Text)Adodc1.Recordset.Fields(2).Value=Trim(txtsex.Text)Adodc1.Recordset.Fields(3).Value=CDate(Trim(txtbirthdate.Text))Adodc1.Recordset.Fields(4).Value=CDate(Trim(txtindate.Text))Adodc1.Recordset.Fields(5).Value=Trim(txtdepart.Text)Adodc1.Recordset.Fields(6).Value=Trim(txttitle.Text)Adodc1.Recordset.Fields(7).Value=Trim(txttel.Text)Adodc1.Recordset.Fields(8).Value=Trim(txtaddr.Text)Adodc1.Recordset.UpdateMsgBox("員工記錄已修改")Adodc1.RecordSource="SELECT*FROMStaff"Adodc1.RefreshDoWhileAdodc1.Recordset.Fields(0)<>curIdAdodc1.Recordset.Move(1)LoopEndSubPrivateSubCmd_next_Click()IfCmd_pre.Enabled=FalseThenCmd_pre.Enabled=TrueEndIfAdodc1.Recordset.MoveNextIfAdodc1.Recordset.Fields(0)=lastIdThenCmd_next.Enabled=FalseEndIfEndSubPrivateSubCmd_pre_Click()IfCmd_next.Enabled=FalseThenCmd_next.Enabled=TrueEndIfAdodc1.Recordset.MovePreviousIfAdodc1.Recordset.Fields(0)=firstIdThenCmd_pre.Enabled=FalseEndIfEndSubPrivateSubForm_Load()Adodc1.RecordSource="SELECT*FROMStaff"Adodc1.RefreshIfAdodc1.Recordset.RecordCount<>0ThenAdodc1.Recordset.MoveLastlastId=Adodc1.Recordset.Fields(0)Adodc1.Recordset.MoveFirstfirstId=Adodc1.Recordset.Fields(0)EndIfCmd_pre.Enabled=FalseIfAdodc1.Recordset.RecordCount=1ThenCmd_next.Enabled=FalseEndIfEndSubPrivateSubtxtaddr_Change()EndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubCmd_del_Click()DimusernameAsStringIfAdodc1.Recordset.EOF=TrueThenMsgBox"請選擇記錄"ExitSubEndIf'通過Adodc1.Recordset.Fields()讀取Adodc1記錄源中的當前數據username=Adodc1.Recordset.Fields(0)'詢問用戶是否確認刪除IfMsgBox("是否刪除當前行?",vbYesNo,"確認")=vbYesThenAdodc1.RecordSource="Select*FromUsersWhereUser_name='"+username+"'"Adodc1.RefreshAdodc1.Recordset.DeleteAdodc1.Recordset.UpdateEndIf'刷新DataGrid表格的內容Adodc1.RecordSource="SELECTu.User_name,u.User_Pwd,t.Type_discriptionAsUser_discFROMUsersu,UserTypetWheret.User_type=u.User_type"Adodc1.RefreshEndSubPrivateSubCmd_modi_Click()IfAdodc1.Recordset.EOF=TrueThenMsgBox"請選擇記錄"ExitSubEndIf'通過Adodc1.Recordset.Fields()讀取Adodc1記錄源中的當前數據Frm_modiUser.oldPwd=Adodc1.Recordset.Fields(1)Frm_modiUser.username=Adodc1.Recordset.Fields(0)Frm_modiUser.ShowEndSubPrivateSubForm_Load()DimiAsIntegerAdodc1.RecordSource="SELECTu.User_name,u.User_Pwd,t.Type_discriptionAsUser_discFROMUsersu,UserTypetWheret.User_type=u.User_type"Adodc1.RefreshEndSubPublicPasswordKeyAsStringPublicNameKeyAsStringPublicTry_timesAsIntegerPrivateSubCmd_Cancel_Click()EndEndSubPrivateSubCmd_OK_Click()DimjAsSingle'數據有效性檢查IftxtUser=""ThenMsgBox"請輸入用戶名"txtUser.SetFocusExitSubEndIfIftxtPwd=""ThenMsgBox"請輸入密碼"txtPwd.SetFocusExitSubEndIf'將用戶輸入賦值到變量中NameKey=Trim(txtUser.Text)PasswordKey=Trim(txtPwd.Text)'判斷用戶是否存在Adodc1.RecordSource="select*fromUserswhereUser_name='"+NameKey+"'"Adodc1.RefreshIfAdodc1.Recordset.EOF=TrueThenMsgBox"用戶名不存在"Try_times=Try_times+1IfTry_times>=3ThenMsgBox"您已經三次嘗試進入本系統(tǒng),均不成功,系統(tǒng)將關閉"ExitSubElseExitSubEndIfEndIf'判斷密碼是否正確IfPasswordKey<>Adodc1.Recordset.Fields(1)ThenMsgBox"密碼錯誤"Try_times=Try_times+1IfTry_times>=3ThenMsgBox"您已經三次嘗試進入本系統(tǒng),均不成功,系統(tǒng)將關閉"ExitSubElseExitSubEndIfEndIf'登錄成功,設置權限IfAdodc1.Recordset.Fields(2)=1ThenFormMain.Menu_addCar.Enabled=FalseFormMain.Menu_addCus.Enabled=FalseFormMain.Menu_addEmp.Enabled=FalseFormMain.Menu_addUser.Enabled=FalseFrm_edit_Car.Cmd_Del.Enabled=FalseFrm_edit_Car.Cmd_Modi.Enabled=FalseFrm_edit_Cus.Cmd_Del.Enabled=FalseFrm_edit_Cus.Cmd_Modi.Enabled=FalseFrm_edit_Emp.Cmd_Del.Enabled=FalseFrm_edit_Emp.Cmd_Modi.Enabled=FalseFormMain.Menu_edit_User.Enabled=FalseElseIfAdodc1.Recordset.Fields(2)<>0ThenMsgBox("用戶類型錯誤")ExitSubEndIf'關閉登錄對話框UnloadMeEndSubPrivateSubFrame1_DragDrop(SourceAsControl,XAsSingle,YAsSingle)EndSubPublicoldPwdAsStringPublicusernameAsStringPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubCmd_OK_Click()IfTrim(txtOldPwd)=oldPwdThenAdodc1.RecordSource="SELECT*FROMUsersWHEREUser_name='"+Trim(username)+"'"Adodc1.RefreshAdodc1.Recordset.Fields(1).Value=Trim(txtNewPwd.Text)Adodc1.Recordset.UpdateMsgBox"修改成功"EndIfUnloadMeFrm_selectUser.Adodc1.RefreshEndSubPrivateSubForm_Load()'txtOldPwd.SetFocusEndSubPrivateSubCmd_Cancel_Click()UnloadMeEndSubPrivateSubCmd_que_Click()IfOption1=TrueThenIftxtName.Text<>""ThenAdodc1.RecordSource="select*fromCarwhereCar_name='"+Trim(txtName.Text)+"'"Adodc1.RefreshEndIfEndIfIfOption2=TrueThenIftxtBrand.Text<>""ThenAdodc1.RecordSource="select*fromCarwhereCar_brand='"+Trim(txtBrand.Text)+"'"Adodc1.RefreshEndIfEndIfIfOption3=TrueThenIftxtPrice.Text<>""ThenAdodc1.RecordSource="select*fromCarwhereCar_price="+Val(Trim(txtPrice.Text))Adodc1.RefreshEndIfEndIfEndSubPrivateSubForm_Load()EndSubPrivateSubOption1_Click()txtBrand.Text=""txtBrand.Enabled=FalsetxtPrice.Text=""txtPrice.Enabled=FalsetxtName.Enabled=TrueEndSubPrivateSubOption2_Click()txtName.Text=""txtName.Enabled=FalsetxtPrice.Text=""txtPrice.Enabled=FalsetxtBrand.Enabled=TrueEndSubPrivateSubOption3_Click()txtName.Text=""txtName.Enabled=FalsetxtBrand.Text=""txtBrand.Enabled=FalsetxtPrice.Enabled=TrueEndSubPrivateSubCmd_Cancel_Click(IndexAsInteger)UnloadMeEndSubPrivateSubCmd_queCus_Click()IfOption1=TrueThenIftxtCusname.Text<>""ThenAdodc1.RecordSource="select*fromCustomerwhereCustomer_name='"+Trim(txtCusname.Text)+"'"Adodc1.RefreshEndIfEndIfIfOption2=TrueThenIftxtCussex.Text<>""ThenAdodc1.RecordSource="select*fromCustomerwhereCustomer_sex='"+Trim(txtCussex.Text)+"'"Adodc1.RefreshEndIfEndIfIfOption3=TrueThenIftxtCusage.Text<>""ThenAdodc1.RecordSource="select*fromCustomerwhereCustomer_age="+Val(Trim(txtCusage.Text))Adodc1.RefreshEndIfEndIfIfOption4=TrueThenIftxtCusjob.Text<>""Then

溫馨提示

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

評論

0/150

提交評論