1. Trang chủ
  2. » Công Nghệ Thông Tin

ĐÁP ÁN FULL CODE VÀ HÌNH BTNT ASSIGMENT FINAL QUẢN LÝ AIRPORT

33 4,6K 26
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 24,34 KB

Nội dung

... create and to delete an airport The name, runway size and capacity of the new airport are selected when a new airport is creating The program has function to add to an airport one or more fixed... not participate to an airport and which has the needed runway size shorter than the airport runway size The program has function to remove one or more helicopter(s) from an airport The program... function to add to an airport one or more helicopter(s) which currently does not participate to an airport The program has function to remove one or more helicopter(s) from an airport having Require

Trang 1

Create a C# Windows form program to manage an airport with fixed wing airplane and helicopter

Require 001: Business need

Create a C# Windows form program to manage an airport with fixed wing airplane and helicopter

Require 002: Working requirement

Working time: 3hrs

Working environment: Visual Studio.Net 2010 IDE, NUnit, log4Net and FxCop 10.0 on local PC, no internet

connection

Delivery: Source code and testing, reviewing evident packaged in a compress archive,

Require 003: Product architecture

The product is implemented using MVC pattern

Require 005: Input data

 The product gets input data from an input file

 An input file is a csv file

 The input file contains the information about 25 fixed wing airplanes, each one in one input line Each fixed wing airplane has its ID, model, plane type, cruise speed, empty weight, max takeoff weight, min needed runway size

 The input file contains the information about 40 helicopters, each one in one input line Each helicopter has its ID, model, cruise speed, empty weight, max takeoff weight, range

 The input file contains the information about 4 airports, each one in one input line Each airport has an ID, a name, runway size, max fixed wing parking place, list of fixed wing airplane ID, max rotated wing parking place, list of helicopter ID

Require 006: Data constraint

In the input data has followed constraints:

Trang 2

 ID is a string of 7 characters, started by “FW” for fixed wing airplane, “RW” for helicopter and “AP” for airport,followed by 5 digits ID is unique

 The model size is maximum 40 characters

 Three fixed wing airplane type are CAG (Cargo), LGR (Long range) and PRV (Private)

Require 007: Airport Management

 The program has function to create and to delete an airport The name, runway size and capacity of the newairport are selected when a new airport is creating

 The program has function to add to an airport one or more fixed wing airplane(s) which currently does not participate to an airport and which has the min needed runway size shorter than the airport runway size

 The program has function to remove one or more helicopter(s) from an airport

 The program has function to add to an airport one or more helicopter(s) which currently does not participate

to an airport

 The program has function to remove one or more helicopter(s) from an airport having

Require 008: Plane management

 The program has function to change plane type and min needed runway size of fixed wing airplane

 If a fixed wing airplane is parked in an airport, its min runway size does not excess the airport runway size

 The program has function to cruise speed and max takeoff weight of helicopter

 The max takeoff weight of helicopter does not excess 1.5 times of its empty weight

Require 009: Output data

 The program has function to save the data of an airport, having a valid data to an output file

 An airport, having a valid data is an airport having

o At least 5 fixed wing airplanes

o At least 10 helicopters

 The output file is a csv file

 The output data of an airport is

o In the first line: Airport ID, name, runway size, capacity

o Fixed wing airplane information, sorted by range and min needed runway size from higher to lower

o Information of each fixed wing airplane is in one output line

o Helicopter information, sorted by range and max takeoff weight from higher to lower

o Information of each helicopter is in one output line

o The plan – fixed wing and helicopter – information will be followed by its fly method – “fixed wing” for fixed wing airplane and “rotated wing” for helicopter

Trang 3

Require 010: Main Interface

The main windows form contains the control for:

 Data input group

o This group allows inputting data from file The input data file can be selected by file selection dialog

 Airport management group

o The window form must follow the requirement 009 and

o The window form must display information about 5 airports and allows selecting any airport for management action

 Fixed wing airplane management group

o The window form must follow the requirement 010 and

o The window form must display the information of one fixed wing airplane and allows selecting any fixed wing airplane for management action

 Helicopter management group

o The window form must follow the requirement 010 and

o The window form must display the information of one helicopter and allows selecting any helicopter for management action

 Close program

Each unsuccessful action will be informed to user by a message box

Require 011: Testing

The product is tested pass in user case level

Require 012: Coding review

The product is tested with no error message in FxCop tool

Require 013: Logging

The product running is logged in method level using Log4Net

Trang 4

o Add fixed wing airplane 8p

o Remove fixed wing airplane 8p

o Add helicopter 8p

o Remove helicopter 8p

 Fixed wing airplane management 6p Each data 3p

 Helicopter management: 6p Each data 3p

Require 003: Product architecture

5p

Require 004: Technology

Each complete terminology 1p: total 8p

Require 011: Testing

Total 5p, each error found decreases 1p, minimum 0p

Require 012: Coding review

Total 5p, each error found decreases 1p, minimum 0p

Require 013: Logging

Total 5p, each error found decreases 1p, minimum 0p

TẠO CLASS KẾT NỐI

Trang 6

sanbay sb = new sanbay();

maybay mb = new maybay();

Tructhang tt = new Tructhang(); public void menusanbay()

{

ketnoi kn = new ketnoi();

kn.conn.Open();

Trang 7

Console.WriteLine("\n 2) Xoa San Bay");

Console.WriteLine("\n 3) Xem San Bay");

Console.WriteLine("\n 4) Them May Bay Vao San Bay");

Console.WriteLine("\n 5) Xoa May Bay Khoi San Bay");

Console.WriteLine("\n 6) Them Truc Thang Vao San Bay");

Console.WriteLine("\n 7) Xoa Truc Thang Khoi San Bay");

Console.WriteLine("\n 8) Thoat");

Console.WriteLine("\n Vui long chon chuc nang!");

Console.WriteLine("\n==================================="); chon = int.Parse(Console.ReadLine());

switch (chon)

{

case 1: sb.Nhap(); break;

case 2: sb.Xoa(); break;

case 3: sb.XuatSanbay(); break;

case 4: mb.NhapMBSB(); break;

case 5: mb.XoaMBSB(); break;

case 6: tt.NhapTTSB(); break;

case 7: tt.XoaTTSB(); break;

case 8: break;

}

Trang 8

Console.WriteLine("\n 2) Xoa May Bay");

Console.WriteLine("\n 3) Xuat May Bay");

Console.WriteLine("\n 4) Sua Loai May Bay");

Console.WriteLine("\n 5) Sua KTDB May Bay");

Console.WriteLine("\n 6) Thoat");

Console.WriteLine("\n Vui long chon chuc nang!");

Console.WriteLine("\n==============================="); chon = int.Parse(Console.ReadLine());

switch (chon)

{

case 1: mb.nhap(); break;

case 2: mb.Xoa(); break;

case 3: mb.XuatMaybay(); break;

case 4: mb.SuaLoai(); break;

Trang 9

case 5: mb.SuaKichThuoc(); break;

Console.WriteLine("\n 2) Xoa Truc Thang");

Console.WriteLine("\n 3) Xuat Truc Thang");

Console.WriteLine("\n 4) Thoat");

Console.WriteLine("\n Vui long chon chuc nang!");

Console.WriteLine("\n==============================="); chon = int.Parse(Console.ReadLine());

switch (chon)

{

case 1: tt.nhap(); break;

case 2: tt.Xoa(); break;

Trang 10

case 3: tt.XuatTructhang(); break; case 4: break;

private string idmb;

public string Idmb

{

get { return idmb; }

Trang 11

set { idmb = value; } }

private string model;

public string Model

{

get { return model; } set { model = value; } }

private string cruisespeed;

public string Cruisespeed {

get { return cruisespeed; } set { cruisespeed = value; } }

public string Loai

{

get { return loai; }

set { loai = value; } }

private string emptyweight;

public string Emptyweight {

get { return emptyweight; } set { emptyweight = value; }

Trang 12

}

private string maxtakeoffweight;

public string Maxtakeoffweight {

get { return maxtakeoffweight; } set { maxtakeoffweight = value; } }

private string minneededrunwaysize;

public string minneededrunwaysize1 {

get { return minneededrunwaysize; } set { minneededrunwaysize = value; } }

private string idsb;

public string Idsb

{

get { return idsb; }

set { idsb = value; }

}

private string loai;

public void ThemMaybay(maybay mb) {

ketnoi kn = new ketnoi();

kn.conn.Open();

Trang 13

SqlCommand cmd = new SqlCommand("INSERT INTO

MAYBAY(IDMB,model,cruisespeed,loai,emptyweight,maxtakeoffweight,minneededrunwaysize) VALUES ('" + mb.Idmb + "','"+ mb.model + "','" + mb.Cruisespeed + "','" + mb.Loai + "'," + mb.Emptyweight + ",'" + mb.Maxtakeoffweight + "','" +

SqlCommand cmd = new SqlCommand("SELECT * FROM MAYBAY", kn.conn);

SqlDataAdapter sdr = new SqlDataAdapter(cmd);

DataTable dt = new DataTable();

sdr.Fill(dt);

foreach (DataRow Row in dt.Rows)

{

Console.Clear();

Trang 14

Console.WriteLine("ID May Bay : {0} \n\nModel : {1} \n\nToc do : {2} \n\nLoai May Bay : {7} \n\nSuc chua : {3} \n\nSuc chua toi da : {4} \n\nkich thuoc duong bang : {5} \n\nID San Bay : {6}", Row["IDMB"], Row["model"],

Row["cruisespeed"], Row["emptyweight"], Row["maxtakeoffweight"], Row["minneededrunwaysize"], Row["IDSB"],

SqlCommand cmd = new SqlCommand("update MAYBAY set minneededrunwaysize='" + mb.minneededrunwaysize1 +

"' where IDMB='" + mb.Idmb + "'", kn.conn);

Trang 17

Console.Write("\nNhap Id San Bay can them : ");

Trang 18

maybay mb = new maybay();

Trang 19

public string Idsb

{

get { return idsb; }

set { idsb = value; }

}

private string ten;

public string Ten

{

get { return ten; }

set { ten = value; }

}

private string minneededrunwaysize;

public string Minneededrunwaysize

{

get { return minneededrunwaysize; } set { minneededrunwaysize = value; } }

private string maxfixedwingparkingplace;

public string Maxfixedwingparkingplace {

get { return maxfixedwingparkingplace; } set { maxfixedwingparkingplace = value; } }

Trang 20

public void ThemSanbay(sanbay sb)

{

ketnoi kn = new ketnoi();

kn.conn.Open();

SqlCommand cmd = new SqlCommand("INSERT INTO SANBAY

(IDSB,TEN,minneededrunwaysize,maxfixedwingparkingplace) VALUES ('" + sb.Idsb + "','" + sb.Ten + "','" +

sb.Minneededrunwaysize + "'," + sb.Maxfixedwingparkingplace + ")", kn.conn);

SqlCommand cmd = new SqlCommand("SELECT * FROM SANBAY", kn.conn);

SqlDataAdapter sdr = new SqlDataAdapter(cmd);

DataTable dt = new DataTable();

Trang 23

private string idtt;

public string Idtt

{

get { return idtt; }

set { idtt = value; }

}

private string model;

public string Model

{

get { return model; } set { model = value; } }

private string cruisespeed;

public string Cruisespeed {

get { return cruisespeed; } set { cruisespeed = value; } }

private string emptyweight;

public string Emptyweight {

get { return emptyweight; } set { emptyweight = value; }

Trang 24

}

private string maxtakeoffweight;

public string Maxtakeoffweight

{

get { return maxtakeoffweight; } set { maxtakeoffweight = value; } }

private string minneededrunwaysize;

public string minneededrunwaysizeTT {

get { return minneededrunwaysize; } set { minneededrunwaysize = value; } }

private string idsb;

public string Idsb

{

get { return idsb; }

set { idsb = value; }

Trang 25

SqlCommand cmd = new SqlCommand("INSERT INTO

TRUCTHANG(IDTT,model,cruisespeed,emptyweight,maxtakeoffweight,minneededrunwaysize) VALUES ('" + tt.Idtt + "','" + tt.model + "','" + tt.Cruisespeed + "'," + tt.Emptyweight + ",'" + tt.Maxtakeoffweight + "','" + tt.minneededrunwaysizeTT + "')", kn.conn);

SqlCommand cmd = new SqlCommand("SELECT * FROM TRUCTHANG", kn.conn);

SqlDataAdapter sdr = new SqlDataAdapter(cmd);

DataTable dt = new DataTable();

sdr.Fill(dt);

foreach (DataRow Row in dt.Rows)

{

Console.Clear();

Trang 26

Console.WriteLine("ID Truc Thang : {0} \n\nModel : {1} \n\nToc do : {2} \n\nSuc chua : {3} \n\nSuc chua toi da : {4}

\n\nkich thuoc duong bang : {5} \n\nID San Bay : {6}", Row["IDTT"], Row["model"], Row["cruisespeed"],

Row["emptyweight"], Row["maxtakeoffweight"], Row["minneededrunwaysize"], Row["IDSB"]);

Console.WriteLine("\n\n\nBam Enter de quay lai menu");

Trang 27

Tructhang tt = new Tructhang();

Trang 29

ketnoi kn = new ketnoi();

menu mn = new menu();

Tructhang tt = new Tructhang();

Console.WriteLine("\n 2) Quan Ly May Bay");

Console.WriteLine("\n 3) Quan Ly Truc Thang");

Console.WriteLine("\n 4) Thoat");

Console.WriteLine("\n Vui long chon chuc nang !");

Console.WriteLine("\n=================================="); chon = int.Parse(Console.ReadLine());

switch (chon)

Trang 30

{

case 1: mn.menusanbay(); break;

case 2: mn.menumaybay(); break;

case 3: mn.menutructhang(); break;

CODE CƠ SỞ DỮ LIỆU DATABASE

CREATE DATABASE QUANLY_AIRPORT

Trang 32

INSERT INTO MAYBAY(IDMB,model,cruisespeed,loai,emptyweight,maxtakeoffweight,minneededrunwaysize)

Trang 33

INSERT INTO SANBAY(IDSB,TEN,minneededrunwaysize,maxfixedwingparkingplace) VALUES ('AP33333','QUOC

TE CAN THO','4000M',100)

INSERT INTO SANBAY(IDSB,TEN,minneededrunwaysize,maxfixedwingparkingplace) VALUES ('AP44444','QUOC

TE DA NANG','5000M',100)

SELECT * FROM MAYBAY

SELECT * FROM TRUCTHANG

SELECT * FROM SANBAY

Ngày đăng: 30/09/2015, 08:37

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w