private void SetParameters() { try { Console.Write("Set customer first and last name: "); CustomerName = Console.ReadLine().ToString().Trim(); if (CustomerName == "" || !CustomerName.Contains(" ")) { throw new Exception("Incorect Customer Name"); } Console.Write("Set customer PESEL: "); PESEL = Console.ReadLine().ToString().Trim(); if (!CheckPesel(PESEL)) { throw new Exception("Incorect PESEL"); } Console.Write("Set prescription number: "); PrescriptionNumber = Console.ReadLine().ToString().Trim(); if (PrescriptionNumber.Length != 20) { throw new Exception("Incorect prescription number"); } } catch (FormatException e) { Console.WriteLine("Incorrect Data: ", e.Message); Save(); } catch (Exception e) { Console.WriteLine("Incorrect Data: ", e.Message); Save(); } }