public static void CautareMed() { Farmacie m = new Farmacie(); Console.Write("Cautati prin ID:"); int find = int.Parse(Console.ReadLine()); if (medList.Exists(x => x.medID == find)) { foreach (Farmacie searchId in medList) { if (searchId.medID == find) { Console.WriteLine("Medicament ID :{0}\n" + "Medicamentul :{1}\n" + "Pretul :{2}\n" + "Numarul :{3}", searchId.medID, searchId.medNume, searchId.medPret, searchId.medNr); } } } else { Console.WriteLine("Medicamentul ID {0} nu a fost gasit", find); } }
public static void AdaugareMed() { Farmacie m = new Farmacie(); Console.WriteLine("Medicament Id:{0}", m.MedID = medList.Count + 1); Console.Write("Numele medicamentului:"); m.MedNume = Console.ReadLine(); Console.Write("Pretul:"); m.MedPret = int.Parse(Console.ReadLine()); Console.Write("Numarul:"); m.X = m.MedNr = int.Parse(Console.ReadLine()); Console.WriteLine("Prescriptie(0-cu,1-fara):"); m.Prescriptie1 = (Farmacie.Prescriptie) int.Parse(Console.ReadLine()); Console.WriteLine("Efecte secundare:"); for (int i = 0; i <= 7; i++) { Console.WriteLine("{0} - {1}", i, (Farmacie.EfecteSecundare)i); } m.EfecteSecundare1 = (Farmacie.EfecteSecundare) int.Parse(Console.ReadLine()); for (int i = 0; i < medList.Count; i++) { if (Farmacie.Compara(m, medList[i]) == Farmacie.LESS) { medList.Insert(i, m); return; } } medList.Add(m); }
public static void EditareMed() { Console.Write("Cautati prin ID:"); int find = int.Parse(Console.ReadLine()); Console.WriteLine(stocareDate.CautareID(find, medList)); Farmacie m = new Farmacie(); Console.Write("Numele medicamentului:"); m.MedNume = Console.ReadLine(); Console.Write("Pretul:"); m.MedPret = int.Parse(Console.ReadLine()); Console.Write("Numarul:"); m.X = m.MedNr = int.Parse(Console.ReadLine()); Console.WriteLine("Prescriptie(0-cu,1-fara):"); m.Prescriptie1 = (Farmacie.Prescriptie) int.Parse(Console.ReadLine()); Console.WriteLine("Efecte secundare:"); for (int i = 0; i <= 7; i++) { Console.WriteLine("{0} - {1}", i, (Farmacie.EfecteSecundare)i); } m.EfecteSecundare1 = (Farmacie.EfecteSecundare) int.Parse(Console.ReadLine()); stocareDate.Editare(find, m, medList); }
public static void CautareMed() { Console.Write("Cautati prin ID:"); int find = int.Parse(Console.ReadLine()); Farmacie m = stocareDate.CautareID(find, medList); Console.WriteLine(m.ToString()); }
public void Editare(int id, Farmacie f, List <Farmacie> lst) { for (int i = 0; i < lst.Count; i++) { if (id == lst[i].MedID) { lst[i] = f; } } }
public static void AfisareMed() { Farmacie m = new Farmacie(); foreach (Farmacie searchId in medList) { Console.WriteLine("Medicament ID :{0}\n" + "Medicamentul :{1}\n" + "Pretul :{2}\n" + "Numarul :{3}", searchId.medID, searchId.medNume, searchId.medPret, searchId.medNr); } }
public static void AdaugareMed() { Farmacie m = new Farmacie(); Console.WriteLine("Medicament Id:{0}", m.medID = medList.Count + 1); Console.Write("Numele medicamentului:"); m.medNume = Console.ReadLine(); Console.Write("Pretul:"); m.medPret = int.Parse(Console.ReadLine()); Console.Write("Numarul:"); m.x = m.medNr = int.Parse(Console.ReadLine()); medList.Add(m); }
public static void StergereMed() { Farmacie m = new Farmacie(); Console.Write("Introduceti ID-ul medicamentului ce doriti sa il stergeti: "); int Del = int.Parse(Console.ReadLine()); if (medList.Exists(x => x.medID == Del)) { medList.RemoveAt(Del - 1); Console.WriteLine("Medicament ID - {0} a fost sters", Del); } else { Console.WriteLine("ID invalid"); } medList.Add(m); }