public bool Create_Part( int module, string part, int panels_made) { Machine_part newpart = new Machine_part { Module = module, Part = part, Panels_made = panels_made }; if (!ContainsPart(newpart)) { Parts.Add(newpart); return true; } return false; }
private bool ContainsPart(Machine_part target) { int count = 0; for (int i = 0; i < Parts.Count; i++) { if (Parts[i].Part == target.Part && Parts[i].Module == target.Module) { count++; } } if (count == 0) { return(false); } return(true); }
public bool Create_Part(int module, string part, int panels_made) { Machine_part newpart = new Machine_part { Module = module, Part = part, Panels_made = panels_made }; if (!ContainsPart(newpart)) { Parts.Add(newpart); return(true); } return(false); }
private bool ContainsPart(Machine_part target) { int count = 0; for (int i = 0; i < Parts.Count; i++) { if (Parts[i].Part == target.Part && Parts[i].Module == target.Module) { count++; } } if (count == 0) { return false; } return true; }