private void button4_Click(object sender, EventArgs e) { form.OpenConnection(); CupBoard cupBoard = form.GetCupBoard(form.connection, GetFkOrder()); int lockerNumber = cupBoard.GetLockerList().Count(); string colorExtrusion = cupBoard.GetExtrusion().GetColor(); string path = @"/Users/Fatine/source/DetailParts.txt"; using (StreamWriter sw = File.CreateText(path)) { sw.WriteLine("DETAIL PARTS"); sw.WriteLine(" "); sw.WriteLine("there is in this order: 1 cupboard with " + lockerNumber + " locker(s)."); sw.WriteLine(" "); int i = 1; foreach (Locker locker in cupBoard.GetLockerList()) { sw.WriteLine("Locker n°" + i + " "); sw.WriteLine("Color: " + locker.GetColor() + " Price: " + locker.GetPrice(form.connection) + " euros"); sw.WriteLine(" Parts : "); foreach (Accessory access in locker.GetAccessoryList()) { string availability; if (access.GetInstock(form.connection) > 1) { availability = "available"; } else { availability = "not available"; } sw.WriteLine(" Type : " + access.GetAccessType() + " color : " + GetRealColor(access.GetColor()) + " dimensions : " + GetDimension(access.GetHeight(), access.GetWidth(), access.GetDepth()) + " price : " + access.GetPrice(form.connection) + " euros" + " " + availability); } sw.WriteLine(" "); i++; } Extrusion extrusion = cupBoard.GetExtrusion(); string availabilityC; if (extrusion.GetInstock(form.connection) > 1) { availabilityC = "available"; } else { availabilityC = "not available"; } sw.WriteLine("Corner "); sw.WriteLine("Color: " + colorExtrusion + " height : " + extrusion.GetHeight() + " Price : " + extrusion.GetPrice(form.connection) + " euros " + " " + availabilityC); sw.WriteLine(" "); sw.WriteLine("Total : " + cupBoard.GetPrice(form.connection) + " euros"); } form.CloseConnection(); }