Пример #1
0
        static void Main(string[] args)
        {
            // 1. Customer instance
            Customer customer1 = new Customer();

            customer1.Id                = 1;
            customer1.FirstName         = "Gökhan";
            customer1.LastName          = "Çoban";
            customer1.CitizenshipNumber = "425789562365";

            // 2. Customer instance
            Customer customer2 = new Customer();

            customer2.Id                = 2;
            customer2.FirstName         = "Ercan";
            customer2.LastName          = "Uçar";
            customer2.CitizenshipNumber = "879513654321";

            // 3. Customer instance
            Customer customer3 = new Customer();

            customer3.Id                = 3;
            customer3.FirstName         = "Akın";
            customer3.LastName          = "Aras";
            customer3.CitizenshipNumber = "565656565560";

            // 4. Customer instance
            Customer customer4 = new Customer();

            customer4.Id                = 4;
            customer4.FirstName         = "Orhan";
            customer4.LastName          = "Kılıç";
            customer4.CitizenshipNumber = "595956336890";

            // 5. Customer instance
            Customer customer5 = new Customer();

            customer5.Id                = 5;
            customer5.FirstName         = "Turan";
            customer5.LastName          = "Duman";
            customer5.CitizenshipNumber = "595956336890";



            //CustomerManager instance
            CustomerManager manager = new CustomerManager();

            Console.WriteLine("\nMüşteri Ekleme Sayfası");
            manager.Add(customer1);
            manager.Add(customer2);
            manager.Add(customer3);
            manager.Add(customer4);
            manager.Add(customer5);

            //Console.WriteLine("");
            Console.WriteLine("\nMüşteri Silme Sayfası");
            manager.Delete(customer3);
            manager.Delete(customer4);


            //Müşteri Listesi
            List <Customer> customers = new List <Customer>
            {
                customer1,
                customer2,
                customer3,
                customer4,
                customer5
            };

            Console.WriteLine("\n Müşteri Görüntüleme Sayfası \n");
            Console.WriteLine("{0,-7} {1,-13} {2,-13} {3}", "ID", "AD", "Soyad", "TC NO");
            Console.WriteLine();
            manager.PrintCustomers(customers);
            Console.WriteLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Customers customer1 = new Customers();

            customer1.Id       = 220391;
            customer1.Name     = "Melek Nur Gül";
            customer1.KimlikNo = 34154785139;
            customer1.City     = "Edirne";

            Customers customer2 = new Customers();

            customer2.Id       = 280912;
            customer2.Name     = "Ali Konar";
            customer2.KimlikNo = 74185296315;
            customer2.City     = "Giresun";

            Customers customer3 = new Customers();

            customer3.Id       = 140285;
            customer3.Name     = "Nursel Konar";
            customer3.KimlikNo = 84125741254;
            customer3.City     = "Bolu";

            Customers customer4 = new Customers();

            customer4.Id       = 280281;
            customer4.Name     = "Kenan Konar";
            customer4.KimlikNo = 95175345841;
            customer4.City     = "Giresun";

            Customers customer5 = new Customers();

            customer5.Id       = 610610;
            customer5.Name     = "Ali Furkan Zehir";
            customer5.KimlikNo = 65414785423;
            customer5.City     = "Trabzon";

            Customers customer6 = new Customers();

            customer6.Id       = 510512;
            customer6.Name     = "Meyra Sare Özata";
            customer6.KimlikNo = 51515151519;
            customer6.City     = "Niğde";

            Customers[] musteriler = new Customers[] { customer1, customer2, customer3, customer4 };

            //foreach (Customers customers in musteriler)
            //{
            //    Console.WriteLine(customers.Id);
            //    Console.WriteLine(customers.Name);
            //    Console.WriteLine(customers.KimlikNo);
            //    Console.WriteLine(customers.City);
            //}



            CustomerManager Manegment = new CustomerManager();



            Manegment.List(musteriler);
            Console.WriteLine("  ");
            Console.WriteLine("  ");
            Console.WriteLine("  ");
            Console.WriteLine("  ");


            Console.WriteLine("________________");
            Manegment.Add(customer5);
            Console.WriteLine("  ");
            Console.WriteLine("  ");
            Console.WriteLine("  ");
            Console.WriteLine("  ");

            Console.WriteLine("________________");
            Manegment.Remove(customer6);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer();

            customer1.CustomerName    = "SELMA";
            customer1.CustomerSurname = "CALİ";
            customer1.CustomerId      = 1;



            Customer customer2 = new Customer();

            customer2.CustomerName    = "ESRA";
            customer2.CustomerSurname = "CALİ";
            customer2.CustomerId      = 2;

            Customer customer3 = new Customer();

            customer3.CustomerName    = "ZEYNEP";
            customer3.CustomerSurname = "BİLMEZ";
            customer3.CustomerId      = 3;

            Operations();

            void Operations()
            {
                Console.WriteLine("Select an operation: \nAdded (1) \nRemove (2)  \nListing (3)");
                int selection = Convert.ToInt32(Console.ReadLine());

                switch (selection)
                {
                case 1:
                {
                    Console.Clear();
                    Customer        customer        = new Customer();
                    CustomerManager customerManager = new CustomerManager();
                    customerManager.Add(customer);
                    Console.WriteLine("~~~~~~~~~~~~~~~~");
                    Operations();
                    break;
                }

                case 2:
                {
                    Console.Clear();
                    CustomerManager customerManager = new CustomerManager();
                    List <Customer> customer        = new List <Customer> {
                        customer1, customer2, customer3
                    };
                    foreach (var c in customer)
                    {
                        Console.WriteLine("Customer ID: " + c.CustomerId + " Customer Name Surname: " + c.CustomerName + " " + c.CustomerSurname);
                        Console.WriteLine("~~~~~~~~~~~~~~~~");
                    }

                    Console.WriteLine("\nEnter the customer's ID  to be deleted: ");
                    int Id = Convert.ToInt32(Console.ReadLine());
                    customerManager.Remove(customer, Id);

                    break;
                }


                case 3:
                {
                    Console.Clear();
                    List <Customer> customers = new List <Customer> {
                        customer1, customer2, customer3
                    };
                    CustomerManager customerManager = new CustomerManager();
                    customerManager.Listing(customers);
                    Console.WriteLine("~~~~~~~~~~~~~~~~");
                    Operations();
                    break;
                }

                default:
                    Console.WriteLine("Default Case!");
                    break;
                }
            }
        }