Beispiel #1
0
        private static void CarRental()
        {
            RentalManager   rentalManager   = new RentalManager(new EfRentalDal());
            CarManager      carManager      = new CarManager(new EfCarDal());
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            var car      = carManager.Get(3);
            var customer = customerManager.Get(1);

            if (car.Data == null)
            {
                Console.WriteLine("Araç sistemde bulunamadı.");
            }
            else if (customer.Data == null)
            {
                Console.WriteLine("Müşteri sistemde bulunamadı.");
            }
            else
            {
                var result = rentalManager.Add(new Rental
                {
                    CarId      = car.Data.CarId,
                    CustomerId = customer.Data.CustomerId,
                    RentDate   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))
                });
                if (result.Success)
                {
                    Console.WriteLine(result.Message);
                }
                else
                {
                    Console.WriteLine(result.Message);
                }
            }
        }
Beispiel #2
0
        private static void KullaniciBul(CustomerManager customerManager)
        {
            Console.WriteLine("Kullanıcı Bulma");
            Console.WriteLine("Kullanici Id'si giriniz.");
            int kullaniciId = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(customerManager.Get(kullaniciId).CustomerName);
            Console.WriteLine("");
        }
Beispiel #3
0
        private static void KullaniciSil(CustomerManager customerManager)
        {
            Console.WriteLine("Kullanıcı Silme");
            Console.WriteLine("Silmek istediğiniz kullanıcının Id'sini giriniz.");
            int      kullaniciId = Convert.ToInt32(Console.ReadLine());
            Customer customer    = customerManager.Get(kullaniciId);

            customerManager.Delete(customer);
            Console.WriteLine("");
        }
Beispiel #4
0
        private static void CustomerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());
            var             result          = customerManager.Get(1);

            Console.WriteLine(result.Data.CompanyName);

            foreach (var custom in customerManager.GetAll().Data)
            {
                Console.WriteLine(custom.CustomerId + " " + custom.CompanyName);
            }
        }
Beispiel #5
0
        private static void CustomerGet()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            try
            {
                Console.WriteLine("Müşteri Şirket Adı: {0}", customerManager.Get(1).Data.CompanyName);
            }
            catch (Exception)
            {
                Console.WriteLine("Müşteri getirilirken bir hata oluştu");
            }
        }
Beispiel #6
0
        private static void KullaniciDetayiBul(CustomerManager customerManager)
        {
            Console.WriteLine("Detaylı Kullanıcı Bulma");
            Console.WriteLine("Kullanici Id'si giriniz.");
            int      kullaniciId = Convert.ToInt32(Console.ReadLine());
            Customer customer    = customerManager.Get(kullaniciId);

            Console.WriteLine(customer.AccountId + "\n"
                              + customer.CustomerName + "\n"
                              + customer.CustomerSurname + "\n"
                              + customer.CustomerAdress + "\n"
                              + customer.TelephoneNumber + "\n");
            Console.WriteLine("");
        }
Beispiel #7
0
        private static void KullaniciGuncelle(CustomerManager customerManager)
        {
            Console.WriteLine("Kullanıcı Güncelleme");
            Console.WriteLine("Güncellemek istediğiniz kullanıcının Id'sini giriniz.");
            int      kullaniciId = Convert.ToInt32(Console.ReadLine());
            Customer customer    = customerManager.Get(kullaniciId);
            int      newCustomerId;

            Console.WriteLine("Customer Id giriniz");
            newCustomerId       = Convert.ToInt32(Console.ReadLine());
            customer.CustomerId = newCustomerId;

            //int accountId;
            //Console.WriteLine("Customer accountId giriniz");
            //accountId = Convert.ToInt32(Console.ReadLine());
            //customer.AccountId = accountId;

            string name;

            Console.WriteLine("Customer name giriniz");
            name = Console.ReadLine();
            customer.CustomerName = name;

            string surname;

            Console.WriteLine("Customer surname giriniz");
            surname = Console.ReadLine();
            customer.CustomerSurname = surname;

            //string adress;
            //Console.WriteLine("Customer adress giriniz");
            //adress = Console.ReadLine();
            //customer.CustomerAdress = adress;

            string telephone;

            Console.WriteLine("Customer telephoneNumber giriniz");
            telephone = Console.ReadLine();
            customer.TelephoneNumber = telephone;

            customerManager.Update(customer);
            Console.WriteLine("");
        }
Beispiel #8
0
        private static void CustomerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            List <Customer> _customers = new List <Customer>
            {
                new Customer()
                {
                    UserId = 2, CompanyName = "Başarı İletişim"
                },
                new Customer()
                {
                    UserId = 3, CompanyName = "Samancı Gıda"
                },
                new Customer()
                {
                    UserId = 4, CompanyName = "Global Serviss"
                },
                new Customer()
                {
                    UserId = 5, CompanyName = "Turuncu Kuruyemiş"
                },
            };

            foreach (var customer in _customers)
            {
                var result = customerManager.Add(customer);
                if (result.Success == true)
                {
                    Console.WriteLine(Messages.CustomerAdded);
                }
                else
                {
                    Console.WriteLine(result.Message);
                }
            }

            // Global Servis yanlışlıkla Global Serviss yazılmış düzeltilecek.
            Customer customerToUpdate = new Customer();

            customerToUpdate.Id          = 3;
            customerToUpdate.UserId      = 4;
            customerToUpdate.CompanyName = "Global Servis";
            var result2 = customerManager.Update(customerToUpdate);

            if (result2.Success == true)
            {
                Console.WriteLine(Messages.CustomerUpdated);
            }
            else
            {
                Console.WriteLine(result2.Message);
            }

            // Turuncu Kuruyemiş silinecek
            Customer customerToDelete = new Customer();

            customerToDelete.Id = 4;


            var result3 = customerManager.Delete(customerToDelete);

            if (result3.Success == true)
            {
                Console.WriteLine(Messages.CustomerDeleted);
            }
            else
            {
                Console.WriteLine(result3.Message);
            }

            var result4 = customerManager.GetAll();

            if (result4.Success == true)
            {
                foreach (var customer in result4.Data)

                {
                    Console.WriteLine("{0}        {1}          {2}", customer.Id, customer.UserId, customer.CompanyName);
                }
                Console.WriteLine(Messages.CustomersListed);
            }
            else
            {
                Console.WriteLine(result4.Message);
            }
            // Id si 1 olan müşterinin bilgilerini getir
            var result5 = customerManager.Get(1);

            if (result5.Success == true)
            {
                Console.WriteLine("{0}        {1}          {2}", result5.Data.Id, result5.Data.UserId, result5.Data.CompanyName);


                Console.WriteLine(Messages.CustomerListed);
            }
            else
            {
                Console.WriteLine(result5.Message);
            }
        }