【发布时间】:2015-10-08 20:02:51
【问题描述】:
所以我不知道一旦将数据添加到字典中后如何将数据发送回对象。
使用我为完整代码制作的 http://pastebin.com/HicZMzAt 这个数据结构
我有
public class Computer
{
public Computer() { }
public Computer(int _year)
{
dropOffDate = DateTime.Now;
RepairFinished = false;
Year = _year;
}
private DateTime dropOffDate;
public bool RepairFinished;
private readonly int Year;
public static string Plate;
private string make;
public string Make
{
get { return make; }
set { make = value; }
}
public string Model { get; set; }
public string ComputerTicketId { get; set; }
public bool IsLaptop { get; set; }
public Location Location { get; set; }
public int HoursWorked { get; set; }
public double PartsCost { get; set; }
public DateTime DateFinished { get; set; }
// public virtual double TotalCost { get { TotalCost = (this.HoursWorked * 50) + PartsCost; } set; }
public void ComputerPickUp()
{
Console.WriteLine("Cost is {0:C} ", this.HoursWorked);
RepairFinished = true;
}
我想计算每次系统损坏的不同维修成本。
public class Laptop : Computer
{
public bool HasCharger { get; set; }
public Laptop(int year, bool _HasCharger)
: base(year)
{
HasCharger = _HasCharger;
}
//TODO overide for COST ! + 10
而且我有台式机课程,而且台式机系统的维修费用更便宜。
但我正在使用
public static class Repair
{
public static Dictionary<string, object> RepairLog { get; set; }
}
跟踪维修 现在我迷失在程序的 UI 部分,以获取数据来计算价格。
public class RepairUI
{
....edited
Repair.RepairLog = new Dictionary<string, object>();
....
Computer = new Desktop(ComputerYear, HasLcd);
这就是我如何处理数据的方式,每个维修单元(桌面/NBK)的类数据都在字典中组织,现在我想获取数据并编辑维修成本object ,但我似乎无法弄清楚如何到达该对象。
那么,我如何在接机时询问并计算单位的信息?
【问题讨论】:
-
似乎修复类应该计算出来并将其放入一个属性中。 RepairLog 是单机维修的日志吗?
标签: c# oop data-structures