public FormularStudent() { InitializeComponent(); adminStudenti = StocareFactory.GetAdministratorStocare(); ckbPCLP.Hide(); ckbDEEA.Hide(); ckbED.Hide(); ckbMEST.Hide(); ckbPIU.Hide(); ckbPOO.Hide(); }
static void Main(string[] args) { IStocareData adminCars = StocareFactory.GetAdministratorStocare(); ArrayList cars; List <Car> listaAutoturismeFisier = adminCars.GetCarsFile(); //Car.LastIndexAutoturism = cars.Count; List <Car> listaAutoturismeCautate; Car autoturismTest = new Car("Audi", "A3", 2012, 7000); Car autoturismTest2 = new Car("Audi", "A4", 2015, 8000); Car autoturismTest3 = new Car("AUDI", "A4"); while (true) { Console.Clear(); Console.WriteLine("A. Afisare masini"); Console.WriteLine("B. Afisare masini tabel"); Console.WriteLine("C. Creare si Adaugare"); Console.WriteLine("F. Cautare autoturismE dupa marca si model"); Console.WriteLine("R. Cautare si modificare autoturism"); Console.WriteLine("T. Compara utilizand autoturism din linia de comanda"); Console.WriteLine("X. Inchidere program"); Console.WriteLine("Alegeti o optiune\n"); var key = Console.ReadKey(true).Key; switch (key) { case ConsoleKey.A: cars = ConvertListToArrayList(listaAutoturismeFisier); AfisareInformatii(cars); // arraylist break; case ConsoleKey.B: //AfisareInformatiiTabel(cars); // arraylist AfisareInformatiiTabel(listaAutoturismeFisier); break; case ConsoleKey.T: //Console.WriteLine("Rezultatul Compararii:\n" + (autoturismTest < CitireComanda(args))); Console.WriteLine("Comparare\n" + autoturismTest.Marca + " " + autoturismTest.Model + " " + autoturismTest.Pret); Console.WriteLine("cu\n" + autoturismTest2.Marca + " " + autoturismTest2.Model + " " + autoturismTest2.Pret); Console.WriteLine("\nRezultatul Compararii:\n" + (autoturismTest < autoturismTest2)); break; case ConsoleKey.F: if (listaAutoturismeFisier.Count > 0) { Console.Write("Introduceti marca cautata: "); autoturismTest3.Marca = Console.ReadLine().ToUpper().Trim(); Console.Write("Introduceti modelul cautat: "); autoturismTest3.Model = Console.ReadLine().ToUpper().Trim(); listaAutoturismeCautate = adminCars.SearchCars(autoturismTest3, listaAutoturismeFisier); AfisareInformatiiTabel(listaAutoturismeCautate); } else { Console.WriteLine("- NU EXISTA MASINI INTRODUSE -"); } break; case ConsoleKey.R: if (listaAutoturismeFisier.Count > 0) { Console.Write("Introduceti marca cautata: "); autoturismTest3.Marca = Console.ReadLine().ToUpper().Trim(); Console.Write("Introduceti modelul cautat: "); autoturismTest3.Model = Console.ReadLine().ToUpper().Trim(); listaAutoturismeFisier = adminCars.ModifyCarPrice(listaAutoturismeFisier, autoturismTest3); adminCars.RewriteCars(listaAutoturismeFisier); } else { Console.WriteLine("- NU EXISTA MASINI INTRODUSE-"); } break; case ConsoleKey.C: Car newCarCreated = CitireTastaturaAutoturism(); listaAutoturismeFisier.Add(newCarCreated); adminCars.AddCar(newCarCreated); break; case ConsoleKey.X: Environment.Exit(0); break; default: Console.WriteLine("Optiune inexistenta"); break; } Console.WriteLine("\nPress any key..."); Console.ReadKey(); } }
public FormularStudent() { InitializeComponent(); adminStudenti = StocareFactory.GetAdministratorStocare(); }