Created
June 14, 2022 01:33
-
-
Save joecastelo/b4c0014f141346304eb641a797cd380d to your computer and use it in GitHub Desktop.
Gist for the post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace WorkShopCBFM22 | |
{ | |
class Program | |
{ | |
[STAThread] | |
static void Main(string[] args) | |
{ | |
Console.BackgroundColor = ConsoleColor.Blue; | |
var fileDialog = new OpenFileDialog(); | |
fileDialog.ShowDialog(); | |
var patientsFileName = fileDialog.FileName; | |
var read = File.ReadAllLines(patientsFileName); | |
var patients = read.Select(line => new Patient(line.Split(',')[0], | |
line.Split(',')[1], line.Split(',')[2])); | |
var prioritys = patients.Where(pat => pat.Priority != "Urgent").ToList(); | |
prioritys.ForEach(prio => prio.PrintPatient()); | |
Console.ReadKey(); | |
} | |
} | |
public class Patient | |
{ | |
public string Name; | |
public string Id; | |
public string Priority; | |
public Patient(string name, string id, string priority) | |
{ | |
Name = name; | |
Id = id; | |
Priority = priority; | |
} | |
public Patient() | |
{ | |
} | |
public string PrintPatient() | |
{ | |
Console.WriteLine("Patient : " + Name + " " + Id + " " + Priority); | |
return Name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment