老婆說要研究買彩票,正好我最近有閒功夫,準備用C#開發一個雙色球彩票號管理系統,主要的功能包括:輸入/編輯/修改各期中獎號,生成統計圖表,隨機生號,預測號碼(這個需要概率統計知識,還在研究當中)。設計文檔大致如下:
Lottery Management System (LMS)
Introduction:
LMS is a tool for mange the Lottery number including inputting number, modifying number and deleting number. LMS also could do some analysis basing on the Lottery Number.
Function Description:
1. Lottery
a) Predict (TBD)
b) Random
c) TBD
d) Exit
2. Maintain
a) Input
i. Input the Number by Manual
ii. Input the Number automatically by system (download the number from http://www.zhcw.com/). (TBD)
b) Edit
c) Delete
d) Search
e) View
3. Analysis (TBD)
a) Red Number
i. Chart for the count of lottery number
ii. Chart for the series number
iii. Chart for the odd number
iv. Chart for the even number
b) Blue Number
i. Chart for the count of lottery number
ii. Chart for the odd number
iii. Chart for the even number
Flow Chart:
Engine DB Function Class UI Legend
Input Lottery Number Edit Lottery Number Delete Lottery Number UI Lottery Dataset DB Engine DB Maintain Search Lottery Number View Lottery Number
Model Design:
1. Engine (dll)
a) DB Engine (DBEngine.dll)
No. |
Functions |
Input |
Output |
Comment |
1 |
Open |
strConnection, string |
Int: 0=successful 1=failure |
Connect to the database |
2 |
Close |
void |
Void |
Close the connection with DB |
3 |
FillDataset |
strSQL, string |
Dataset |
Execute SQL command and return dataset. It is suitable for initiate the data table |
4 |
ExecuteSQL |
strSQL, string |
Int 0=failure >0 successful |
Execute SQL command and return the affection rows of DB. It is suitable for “Delete” or “Edit” operation |
5 |
UpdateDatabaset |
Dataset |
int |
Use the changed dataset to update the data on DB |
6 |
|
|
|
|
7 |
|
|
|
|
2. Class
a) objLottery
No. |
Members |
Name |
Comment |
1 |
Property |
RedNumber |
Data type: Int[6] Method: set, get |
2 |
Property |
BlueNumber |
Data type: int Method: set, get |
3 |
Property |
LotterySID |
Data type: string Method: set, get |
4 |
Function |
CheckRedNumber |
Input: void Output: int[6] 0=correct, 1=error Comment: check the red numbers if they are correct as the following rules. The output is indicating which number is not correct: 1. Numerical 2. Integer 3. >=1 and <=33 4. They should not be duplicate |
5 |
Function |
CheckBlueNumber |
Input: void Output: int 0=correct, 1=error Comment: check the blue number if it is correct as the following rules: 1. Numerical 2. Integer 3. >=1 and <=16 |
6 |
Function |
FillLotteryNumber |
Input: 1. string strLotterySID 2. int[6] intRedNumber 3. int intBlueNumber Output: void Comment: assign the input values to the fields |
7 |
Function |
AddLotteryNumber |
Input: Dataset dst Output: void Comment: add the new lottery number to Dataset |
8 |
Function |
DeleteLotteryNumber |
Input: Dataset dst Output: void Comment: delete the existing lottery number with specific lottery sid |
9 |
Function |
EditLotteryNumber |
Input: Dataset dst Output: void Comment: edit the existing lottery number with specific lottery sid |
10 |
Function |
InitiateLotterySID |
Input: Dataset dst Output: string Comment: from the dataset to initiate the next lottery sid |
|
|
|
|
|
|
|
|
|
|
|
|
b) objDataset
No. |
Members |
Name |
Comment |
1 |
Function |
FillData |
Input: string strSQL Output: void Comment: execute the SQL command and fill the return data to dataset |
2 |
Function |
AddData |
Input: 1. DataRow drowData 2. string strTable Output: void Comment: add the new row to specific table in the dataset |
3 |
Function |
DeleteData |
Input: string strData Output: void Comment: delete the existing row basing the specific search string |
4 |
Function |
EditData |
Input: 1. DataRow drowData 2. strin strTable Output: void Comment: edit the specific row within specific table in the dataset |
5 |
Function |
UpdateData |
Input: void Output: void Comment: from the dataset to update the data on database |
|
|
|
|
|
|
|
|
|
|
|
|
3. UI
a) Maintain
4. DB (LMS)
a) Tables
i. Table1: TBL_Lottery
No. |
Fields |
Data |
1 |
FLD_LotterySID |
Varchar(10) |
2 |
FLD_RedNumber1 |
Int |
3 |
FLD_RedNumber2 |
Int |
4 |
FLD_RedNumber3 |
Int |
5 |
FLD_RedNumber4 |
Int |
6 |
FLD_RedNumber5 |
Int |
7 |
FLD_RedNumber6 |
Int |
8 |
FLD_BlueNumber |
Int |
b) Procedures
No. |
Name |
Parameter (default input) |
Comments |
1 |
PRO_InsertLotteryNumber |
@LotterySID Varchar(10) |
Insert a new lottery number |
@RedNumber1 int |
|||
@RedNumber2 int |
|||
@RedNumber3 int |
|||
@RedNumber4 int |
|||
@RedNumber5 int |
|||
@RedNumber6 int |
|||
@BlueNumber int |
|||
2 |
PRO_EditLotteryNumber |
@LotterySID Varchar(10) |
Edit an existing lottery number |
@RedNumber1 int |
|||
@RedNumber2 int |
|||
@RedNumber3 int |
|||
@RedNumber4 int |
|||
@RedNumber5 int |
|||
@RedNumber6 int |
|||
@BlueNumber int |
|||
3 |
PRO_DeleteLotteryNumber |
@LotterySID Varchar(10) |
Delete an existing lottery number |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c) Views (TBD)