本文整理汇总了C#中model.GetBoatList方法的典型用法代码示例。如果您正苦于以下问题:C# model.GetBoatList方法的具体用法?C# model.GetBoatList怎么用?C# model.GetBoatList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model.GetBoatList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBoat
/// <summary>
/// Add a boat menu
/// </summary>
/// <param name="a_member">model.Member, the member who owns the new boat</param>
private void AddBoat(model.Member a_member)
{
m_console.AddBoat(a_member);
for (int i = 0; i < (int)model.Boat.Type.Count; i += 1)
{
string message = string.Format("{0}: {1}", i, (model.Boat.Type)i);
m_console.WriteMessage(message);
}
int type;
while (true)
{
m_console.WriteMessage("Type: ");
bool isNumeric = int.TryParse(m_console.ReadResponse(), out type);
if (isNumeric && type >= 0 && type < (int)model.Boat.Type.Count)
{
break;
}
m_console.WriteMessage("Invalid type, type must be a number choosen from the list above");
}
double length;
while (true)
{
m_console.WriteMessage("Length: ");
bool isDouble = double.TryParse(m_console.ReadResponse(), out length);
if (isDouble && length > 0)
{
break;
}
m_console.WriteMessage("Invalid length. Length must be of the format XX or XX,XX");
}
a_member.GetBoatList().AddBoat((model.Boat.Type)type, length);
m_console.SetCurrentMenu(view.Console.CurrentMenu.Member);
GoToCurrentMenu(a_member);
}
示例2: DisplayBoat
/// <summary>
/// Displays a boat to the user
/// </summary>
/// <param name="a_member">model.Member. The member that ownes the boat</param>
/// <param name="a_boatID">int. The ID of that boat to be displayed</param>
public void DisplayBoat(model.Member a_member, int a_boatID)
{
foreach (model.Boat boat in a_member.GetBoatList().GetBoats()){
if(a_boatID == boat.GetBoatID()) {
System.Console.WriteLine("BoatID: {0}", a_boatID);
System.Console.WriteLine("Type: {0}", boat.GetBoatType());
System.Console.WriteLine("Length: {0}", boat.GetLength());
break;
}
}
}
示例3: DisplayMember
/// <summary>
/// Display a member to the user
/// </summary>
/// <param name="a_member">model.Member. The member to be displayed</param>
/// <param name="showPNumber">bool. True if the Personal Number should be displayed, false otherwise</param>
/// <param name="showBoats">bool. True if the boats the user owns should be displayed, false if only the number of boats owned should be displayed</param>
public void DisplayMember(model.Member a_member, bool showPNumber, bool showBoats)
{
System.Console.WriteLine("---");
System.Console.WriteLine("MemberID: {0}", a_member.GetMemberID());
System.Console.WriteLine("Name: {0}", a_member.GetName());
if (showPNumber)
{
System.Console.WriteLine("Personal Number: {0}", a_member.GetPNumber());
}
List<model.Boat> boats = a_member.GetBoatList().GetBoats();
if (boats.Count > 0)
{
if (showBoats)
{
System.Console.WriteLine("Boats:");
foreach (model.Boat boat in boats)
{
DisplayBoat(boat);
}
}
else
{
System.Console.WriteLine("Boats: {0}", boats.Count);
}
}
}
示例4: MemberResponse
/// <summary>
/// Read a response from the user, from the specific member menu and change the users menu position accordingly
/// </summary>
/// <param name="a_member"></param>
private void MemberResponse(model.Member a_member)
{
int response = m_console.GetMemberResponse();
if (response == -1)
{
m_memberList.RemoveMember(a_member);
GoToCurrentMenu();
return;
}
else if (response > 0)
{
foreach (model.Boat boat in a_member.GetBoatList().GetBoats())
{
if (boat.GetBoatID() == response)
{
GoToCurrentMenu(a_member, response);
return;
}
}
m_console.SetCurrentMenu(view.Console.CurrentMenu.Member);
}
GoToCurrentMenu(a_member);
}
示例5: EditBoat
/// <summary>
/// Edit boat menu
/// </summary>
/// <param name="a_member">model.Member, the member that owns the boat</param>
/// <param name="a_boatID">int, the boatID of the boat</param>
private void EditBoat(model.Member a_member, int a_boatID)
{
bool boatExists = false;
foreach (model.Boat boat in a_member.GetBoatList().GetBoats())
{
if (boat.GetBoatID() == a_boatID)
{
boatExists = true;
break;
}
}
if (boatExists)
{
m_console.EditBoat(a_member, a_boatID);
for (int i = 0; i < (int)model.Boat.Type.Count; i += 1)
{
string message = string.Format("{0}: {1}", i, (model.Boat.Type)i);
m_console.WriteMessage(message);
}
int type;
while (true)
{
m_console.WriteMessage("New type: ");
bool isNumeric = int.TryParse(m_console.ReadResponse(), out type);
if (isNumeric && type >= 0 && type < (int)model.Boat.Type.Count)
{
break;
}
m_console.WriteMessage("Invalid type, type must be a number choosen from the list above");
}
double length;
while (true)
{
m_console.WriteMessage("New length: ");
bool isDouble = double.TryParse(m_console.ReadResponse(), out length);
if (isDouble && length > 0)
{
break;
}
m_console.WriteMessage("Invalid length. Length must be of the format XX or XX,XX");
}
a_member.GetBoatList().ChangeBoatInfo(a_boatID, (model.Boat.Type)type, length);
}
m_console.SetCurrentMenu(view.Console.CurrentMenu.Member);
GoToCurrentMenu(a_member);
}
示例6: BoatResponse
/// <summary>
/// Read a response from the user, from the specific boat menu and change the users menu position accordingly
/// </summary>
/// <param name="a_member">model.Member, the member that owns the boat</param>
/// <param name="a_boatID">int, the boatID of the boat</param>
private void BoatResponse(model.Member a_member, int a_boatID)
{
int response = m_console.GetBoatResponse();
if (response == -1)
{
a_member.GetBoatList().RemoveBoat(a_boatID);
GoToCurrentMenu(a_member);
return;
}
GoToCurrentMenu(a_member, a_boatID);
}