예제 #1
0
        private static void EfRentalDalTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            Rental rental1 = new Rental
            {
                CarId      = 1,
                CustomerId = 2,
                RentDate   = DateTime.Now,
                ReturnDate = null
            };

            Rental rental2 = new Rental
            {
                CarId      = 2,
                CustomerId = 3,
                RentDate   = DateTime.Now,
                ReturnDate = null
            };

            Console.WriteLine("\nRent records in Rentals table: ");
            foreach (Rental rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("Rented at {0}", rental.RentDate);
            }

            Console.WriteLine("\nTrying to rent a booked car.");
            rentalManager.Rent(rental1);

            Console.WriteLine("\nTrying to rent an avaible car.");
            rentalManager.Rent(rental2);

            Console.WriteLine("\nRent records in Rentals table: ");
            foreach (Rental rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("Rented at {0}", rental.RentDate);
            }

            Console.WriteLine("\nCancelling a rental.");
            rentalManager.Cancel(rental2);

            Console.WriteLine("\nRent records in Rentals table: ");
            foreach (Rental rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("Rented at {0}", rental.RentDate);
            }
        }
예제 #2
0
 private static void WriteData(RentalManager obj)
 {
     Console.WriteLine("    rent     ");
     foreach (var e in obj.GetAll().Data)
     {
         Console.WriteLine(e.CarId + " - " + e.CustomerId + " - " + e.RentDate + " - " + e.ReturnDate);
     }
 }
예제 #3
0
 static void RentalGetAll(RentalManager rentalManager)
 {
     Console.WriteLine("\nRentals,\nId\tCarId\tCustomerId\tRentDate\t\tRetrunDate");
     foreach (var rental in rentalManager.GetAll().Data)
     {
         Console.WriteLine(rental.Id + "\t" + rental.CarId + "\t" + rental.CustomerId + "\t\t" + rental.RentDate + "\t" + rental.ReturnDate);
     }
 }
예제 #4
0
 private static void GetAll(RentalManager rentalManager)
 {
     Console.WriteLine("**************************************************** Kiralanmış Arabalar Listesi ****************************************************");
     foreach (var rental in rentalManager.GetAll().Data)
     {
         Console.WriteLine("Id: " + rental.Id + " Rent Date: " + rental.RentDate + " Return Date: " + rental.ReturnDate);
     }
 }
예제 #5
0
        private void RentalMenuScreen(RentalManager rentalManager, CustomerManager customerManager, CarManager carManager)
        {
            bool IsMenuOpen = true;

            while (IsMenuOpen)
            {
                Console.WriteLine("\n--------- ADMIN MENU ---------");
                Console.WriteLine(" 1 - Add New Rental ");
                Console.WriteLine(" 2 - Update a Rental");
                Console.WriteLine(" 3 - Delete a Rental");
                Console.WriteLine(" 4 - View Rental List");
                Console.WriteLine(" 5 - Go back to Main Menu");
                Console.WriteLine("------------------------------");

                string choice = Console.ReadLine();
                if (choice == "")
                {
                    Console.WriteLine("Wrong! Try again.");
                }
                else
                {
                    switch (Int32.Parse(choice))
                    {
                    case 1:
                        RentalMenu_Save(rentalManager, customerManager, carManager);
                        Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll());
                        break;

                    case 2:
                        RentalMenu_Update(rentalManager, customerManager, carManager);
                        Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll());
                        break;

                    case 3:
                        RentalMenu_Delete(rentalManager);
                        Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll());
                        break;

                    case 4:
                        if (rentalManager.GetCountOfAll() != 0)
                        {
                            Console.WriteLine("\nList of All Rentals");
                            rentalManager.WriteAll(rentalManager.GetAll().Data);
                        }
                        Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll());
                        break;

                    case 5:
                        IsMenuOpen = false;
                        break;

                    default:
                        Console.WriteLine("Wrong! Try again.");
                        break;
                    }
                }
            }
        }
        private static void RentalManagerTest()
        {
            CarDetailDto  carDetailDto  = new CarDetailDto();
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            rentalManager.Add(new Rental {
                CarId = 2, CustomerId = 1, RentDate = new DateTime(2020, 06, 23)
            });

            //rentalManager.Add(new Rental { CarId = 3, CustomerId = 3, RentDate = new DateTime(2021, 11, 26) });

            var result = rentalManager.GetAll();

            if (result.Success)
            {
                foreach (var rental in result.Data)
                {
                    Console.WriteLine($@"{rental.CustomerId}'idli müşterimiz {rental.CarId}'idli arabayı {rental.RentDate} tarihinde kiralamıştır ");
                    if (rental.ReturnDate != null)
                    {
                        Console.WriteLine($@"{rental.ReturnDate} tarihinde                                          teslim etmiştir.");
                    }
                }
            }

            Console.WriteLine("--Update--");

            rentalManager.Update(new Rental {
                RentalId = 4, CarId = 2, CustomerId = 1, RentDate = new DateTime(2020, 06, 23), ReturnDate = new DateTime(2020, 07, 01)
            });

            var result2 = rentalManager.GetAll();

            if (result2.Success)
            {
                foreach (var rental in result2.Data)
                {
                    Console.WriteLine($@"{rental.CustomerId}'idli müşterimiz {rental.CarId}'idli arabayı {rental.RentDate} tarihinde kiralamıştır ");
                    if (rental.ReturnDate != null)
                    {
                        Console.WriteLine($@"{rental.ReturnDate} tarihinde                                          teslim etmiştir.");
                    }
                }
            }
        }
예제 #7
0
        private static void GetRentals()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("{0} - {1} - {2} - {3} - {4}", rental.Id, rental.CarId, rental.CustomerId, rental.RentDate, rental.ReturnDate);
            }
        }
예제 #8
0
        private static void RentalGetAll()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var r in rentalManager.GetAll().Data)
            {
                Console.WriteLine(r.CarId + " " + r.UserId + " " + r.Id + " " + r.RentDate + " " + r.ReturnDate);
            }
        }
예제 #9
0
        private static void RentalTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            rentalManager.Add(new Rental {
                CarId = 2, CustomerId = 1, RentDate = DateTime.Now, ReturnDate = new DateTime(2021, 3, 1)
            });
            Console.WriteLine(rentalManager.GetAll().Data);
        }
예제 #10
0
        private static void RentalGetAllTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rental.RentDate);
            }
        }
예제 #11
0
        //private static void UserTest()
        //{
        //    UserManager userManager = new UserManager(new EfUserDal());
        //    foreach (var user in userManager.GetAll().Data)
        //    {
        //        Console.WriteLine(user.FirstName + " " + user.LastName + " " + user.Email);
        //    }
        //}

        private static void RentalTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rental.RentalId + " " + rental.CustomerId + " " + rental.CarId + " " + rental.RentDate + " " + rental.ReturnDate);
            }
        }
예제 #12
0
        private static void GetAllRental()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rent in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rent.Id + "/ " + rent.RentDate + "/ " + rent.ReturnDate);
            }
        }
예제 #13
0
        private static void RentalManagerTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            var result = rentalManager.GetAll();

            if (result.Success == true)
            {
                foreach (var rental in rentalManager.GetAll().Data)
                {
                    Console.WriteLine(rental.Id + " - " + rental.CustomerId + " - " + rental.CarId + " - " + rental.RentDate + " - " + rental.ReturnDate);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
예제 #14
0
        private static void RentalManagerTest()
        {
            IRentalService _rentalManager = new RentalManager(new EfRentalDal());

            var result = _rentalManager.GetAll();

            if (result.Success == true)
            {
                foreach (var rental in _rentalManager.GetAll().Data)
                {
                    Console.WriteLine(rental.ReturnDate);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
예제 #15
0
        private static void RentalManager()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rent in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rent.CustomerId + "   " + rent.RentDate + "  " + rent.ReturnDate);
            }
            //rentalManager.Add(new Rental { CustomerId = 1, RentDate = DateTime.Now, ReturnDate =new DateTime(2020,02,13) });
        }
예제 #16
0
        private static void RentalTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());
            var           result        = rentalManager.GetAll();

            foreach (var rental in result.Data)
            {
                Console.WriteLine(rental.Id);
            }
        }
예제 #17
0
        private static void RentalTest(Rental rental1)
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            Console.WriteLine(rentalManager.Add(rental1).Message);
            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rental.Id);
            }
        }
예제 #18
0
        private static void RentalList()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var item in rentalManager.GetAll().Data)
            {
                Console.WriteLine(item.CarId + "/" + item.CustomerId + "/" +
                                  item.RentDate + "/" + item.ReturnDate);
            }
        }
예제 #19
0
        private static void RentalTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("RentalId: {0} CarID: {1} CustomerId: {2} RentDate: {3} ReturnDate: {4}"
                                  , rental.Id, rental.CarId, rental.CustomerId, rental.RentDate, rental.ReturnDate);
            }
        }
예제 #20
0
        private static void RentalGetAll()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());
            var           result        = rentalManager.GetAll();

            foreach (var r in result.Data)
            {
                Console.WriteLine("{0} -> {1} - {2} - {3} / {4}", r.Id, r.CustomerId, r.CarId, r.RentDate, r.ReturnDate);
            }
        }
예제 #21
0
        static void Main(string[] args)
        {
            //CarCrud();

            Console.WriteLine("---------------------------------------");

            // ColorCrud();

            Console.WriteLine("---------------------------------------");
            // BrandCrud();

            Console.WriteLine("---------------------------------------");

            Rental rent1 = new Rental()
            {
                CarId = 1, CustomerId = 1, RentDate = DateTime.Now.Date.ToString("dd-MM-yyyy"), ReturnDate = "15-02-2021"
            };
            RentalManager rentacar = new RentalManager(new EfRentalDal());

            rentacar.Add(rent1);

            if (rentacar.GetAll().Success)
            {
                foreach (var rental in rentacar.GetAll().Data)
                {
                    Console.WriteLine(rental.RentalId + " " + rental.RentDate + " " + rental.ReturnDate);
                }
            }
            else
            {
                Console.WriteLine(rentacar.GetAll().Message);
            }

            Console.WriteLine("---------------------------------------");



            foreach (var car in rentacar.GetRentalDetails().Data)
            {
                Console.WriteLine("{0}-{1}-{2}-{3}-{4}-{5}", car.RentalId, car.CarName, car.CarDescription, car.RentDate, car.ReturnDate, car.TotalPrice);
            }
        }
예제 #22
0
 private static void RentalAddTest(RentalManager rentalManager)
 {
     rentalManager.Add(new Rental {
         CarId    = 1, CustomerID = 1,
         RentDate = DateTime.Now, ReturnDate = null
     });
     foreach (var rental in rentalManager.GetAll().Data)
     {
         Console.WriteLine(rental.CarId);
     }
 }
예제 #23
0
        private static void RentalManagerTest()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            Console.WriteLine("---------Kiralık Listesi-------");

            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine(rental.CustomerId);
            }
        }
예제 #24
0
        private static void TestRental()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            var result = rentalManager.GetAll();

            foreach (var rental in result.Data)
            {
                Console.WriteLine("{0} {1} {2}", rental.CarId, rental.CustomerId, rental.RentDate);
            }
        }
예제 #25
0
        static void Main(string[] args)
        {
            RentalManager crmngr = new RentalManager(new EfRentalDal());
            var           result = crmngr.GetAll();

            foreach (var item in result.Data)
            {
                Console.WriteLine(item.RentDate.Year + "-" + item.RentDate.Month + "-" + item.RentDate.Day);
            }
            Console.ReadKey();
        }
예제 #26
0
        private static void RentalsListMethod(RentalManager rentalManager)
        {
            var result = rentalManager.GetAll();

            foreach (var car in result.Data)
            {
                Console.WriteLine(car.CarId + " " + "|" + " " + car.CarId + " " + "|" + " "
                                  + car.RentDate + " " + "|" + " " + car.ReturnDate);
            }
            Console.WriteLine(Messages.RentalsListed);
        }
예제 #27
0
        private static void RentalList()
        {
            Console.WriteLine("***** KİRALAMA LİSTESİ *****\n");
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            //rentalManager.Add(new Rental {Id=3,CarId=2,CustomerId=2,RentDate=DateTime.Now, ReturnDate=null });
            foreach (var rental in rentalManager.GetAll().Data)
            {
                Console.WriteLine("Kiralama Id : " + rental.Id + " " + "Customer Id : " + rental.CustomerId + " " + "Car Id : " + rental.CarId + " " + "Kiralama Tarihi :" + rental.RentDate + " " + "Geri geliş tarihi: " + rental.ReturnDate);
            }
        }
예제 #28
0
        private static void RentalGetAll()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());
            var           result        = rentalManager.GetAll();

            foreach (var rental in result.Data)
            {
                Console.WriteLine(rental.CarId + rental.RentDate.ToString());
            }
            Console.WriteLine(result.Message);
        }
예제 #29
0
        private static void RentalGetAll()
        {
            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            var result = rentalManager.GetAll();

            foreach (var rent in result.Data)
            {
                Console.WriteLine("Araba Kiralama Tarihi: {0} \n Araba Teslim Tarihi: {1}", rent.RentDate, rent.ReturnDate);
                Console.WriteLine("---------------------------------");
            }
        }
예제 #30
0
        }//Metodlar

        private static void RentalGetAll(RentalManager rentalManagerEF)
        {
            var result = rentalManagerEF.GetAll();

            if (result.Success)
            {
                foreach (var rental in result.Data)
                {
                    Console.WriteLine(rental.RentDate);
                }
            }
        }