public void PrintTicket() { FileStream fs = null; StreamWriter sw = null; try { fs = new FileStream("../../../documents/ticketPrinted/ticket_" + ticketNr + ".txt", FileMode.Create, FileAccess.Write); sw = new StreamWriter(fs); sw.WriteLine(" Latitude Music Festival "); sw.WriteLine("--------------------------------------"); sw.WriteLine("Visitor name : " + FirstName + " " + LastName); sw.WriteLine("Date of birth : " + Dob.ToShortDateString()); sw.WriteLine("Event account : " + eventAccount); sw.WriteLine("Ticket number : " + ticketNr); if (hasReserveCamp) { sw.WriteLine("Camping spot : " + reservedSpot.SpotId); if (spotCode != "") { sw.WriteLine("Spot code : " + spotCode); } } } catch (IOException) { throw new LatitudeException("Something wrong with printing"); } finally { if (sw != null) { sw.Close(); } } }
// public int SerialNo { get; set; } = 123; public override string ToString() { return($"{"Dto:",-9}{"FirstName=",-10}{FirstName,-10}LastName = {LastName,-6}Dob={Dob.ToShortDateString()} {"RecordNumber = ",-15}{RecordNumber}"); }
// public string SerialNo { get; set; } = "Abc"; public override string ToString() { return($"{"Student:",-9}{"ForeName=",-10}{ForeName,-10}LastName = {LastName,-6}Dob={Dob.ToShortDateString()} {"Id = ",-15}{Id}"); }
public void DisplayAll() { Console.WriteLine($" EmployeeId: {EmployeeId}\n First Name: { FirstName}\n Last Name: { LastName}\n Dob: { Dob.ToShortDateString()}\n Start Date: { StartDate.ToShortDateString()}\n HomeTown: { HomeTown}\n Department: {Department}\n"); }