public static void DoBulkCopy() { Console.WriteLine("***Do Bulk Copy***"); var cars = new List <Car>() { new Car() { CarId = 40, Color = "Blue", Make = "Honda", PetName = "MyCarl" }, new Car() { CarId = 41, Color = "Red", Make = "Volvo", PetName = "MyCar2" }, new Car() { CarId = 42, Color = "White", Make = "VW", PetName = "МуСагЗ" }, new Car() { CarId = 43, Color = "Yellow", Make = "Toyota", PetName = "MyCar4" } }; ProcessBulkImport.ExecuteBulkImport(cars, "Inventory"); var lst = Dal.GetAllInventory(); InitCars(); ShowAllCars(); }
public static void DoBulkCopy() { Console.WriteLine("**** Do Bulk Copy *****"); var cars = new List <Car> { new Car { Color = "Blue", Make = "Honda", PetName = "MyCar1" }, new Car { Color = "Red", Make = "Volvo", PetName = "MyCar2" }, new Car { Color = "White", Make = "VW", PetName = "MyCar3" }, new Car { Color = "Yellow", Make = "Toyota", PetName = "MyCar4" } }; ProcessBulkImport.ExecuteBulkCopy(cars, "Inventory"); var dal = new InventoryDal(); var list = dal.GetAllInventory(); Console.WriteLine("**** All Cars ****"); Console.WriteLine("CarId\tMake\tColor\tPet Name"); foreach (var item in list) { Console.WriteLine($"{item.CarId}\t{item.Make}\t{item.Color}\t{item.PetName}"); } Console.WriteLine(); }
public static void DoBulkCopy() { Console.WriteLine("----------Do Bulk Copy-----------"); var cars = new List <Car> { new Car() { Color = "Blue", Make = "Honda", PetName = "MyCar" }, new Car() { Color = "Red", Make = "Volvo", PetName = "MyCar2" } }; ProcessBulkImport.ExecuteBulkImport(cars, "Inventory"); InventoryDal dal = new InventoryDal(); var list = dal.GetAllInventory(); Console.WriteLine("*************All cars***********"); Console.WriteLine("CarId\tMake\tColor\tPetName"); foreach (var car in list) { Console.WriteLine($"{car.Id}\t{car.Make}\t{car.Color}\t{car.PetName}"); } }
public static void DalTest() { var dal = new InventoryDal(); var list = dal.GetAllInventory(); Console.WriteLine("***** All Cars ******"); Console.WriteLine("CarId\tMake\tColor\tPet Name"); foreach (var item in list) { Console.WriteLine($"{item.CarId}\t{item.Make}\t{item.Color}\t{item.PetName}"); } Console.WriteLine(); var car = dal.GetCar(list.OrderBy(x => x.Color).Select(x => x.CarId).First()); Console.WriteLine("***** First Car by Color ********"); Console.WriteLine("CarId\tMake\tColor\tPet Name"); Console.WriteLine($"{car.CarId}\t{car.Make}\t{car.Color}\t{car.PetName}"); try { dal.DeleteCar(5); Console.WriteLine("Car deleted"); } catch (Exception ex) { Console.WriteLine($"An exception occured: {ex.Message}"); } dal.InsertAuto(new Car { Color = "Blue", Make = "Pilot", PetName = "TownMonster" }); list = dal.GetAllInventory(); var newCar = list.First(x => x.PetName == "TownMonster"); Console.WriteLine("***** New Car ********"); Console.WriteLine("CarId\tMake\tColor\tPet Name"); Console.WriteLine($"{newCar.CarId}\t{newCar.Make}\t{newCar.Color}\t{newCar.PetName}"); dal.DeleteCar(newCar.CarId); var petName = dal.LookUpPetName(car.CarId); Console.WriteLine($"Car pet name: {petName}"); Console.WriteLine("Press Enter to continue..."); Console.ReadLine(); }
public MainWindowViewModel() { using (InventoryDal cars = (new InventoryDal())) { var allCars = cars.GetAllInventory(); foreach (var car in allCars) { Cars.Add(ModelTransformations.CarToInventory(car)); } } }
public static void GetAll() { InventoryDal dal = new InventoryDal(); var list = dal.GetAllInventory(); Console.WriteLine("*************All cars***********"); Console.WriteLine("CarId\tMake\tColor\tPetName"); foreach (var car in list) { Console.WriteLine($"{car.Id}\t{car.Make}\t{car.Color}\t{car.PetName}"); } }