Beispiel #1
0
        private static void CustomerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Console.WriteLine(customerManager.Add(new Customer {
                CustomerId = 1, UserId = 1, CompanyName = "Google"
            }).Message);
            Console.WriteLine(customerManager.Update(new Customer {
                CustomerId = 1, UserId = 1, CompanyName = "Rockstar Games"
            }).Message);
            Console.WriteLine(customerManager.Delete(new Customer {
                CustomerId = 2
            }).Message);

            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customerManager.GetAll().Message);
                Console.WriteLine("Customer Id {0} / User Id {1} / Company Name {2}", customer.CustomerId, customer.UserId, customer.CompanyName);
            }

            foreach (var customer in customerManager.GetCustomerDetailDtos().Data)
            {
                Console.WriteLine(customerManager.GetCustomerDetailDtos().Message);
                Console.WriteLine(customer.CustomerName + "/" + customer.CustomerSurname + "/" + customer.CustomerCompany);
            }
        }
Beispiel #2
0
        private static void CustomerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Console.WriteLine("-----Add-----");
            var result = customerManager.Add(new Customer
            {
                Id          = 6,
                CompanyName = "Vural a.ş.",
                UserId      = 2,
            });

            Console.WriteLine(result.Message);

            Console.WriteLine("-----Update---- -");
            var result1 = customerManager.Update(new Customer
            {
                Id          = 6,
                CompanyName = "Vural a.ş.",
                UserId      = 5,
            });

            Console.WriteLine(result1.Message);

            Console.WriteLine("-----Delete-----");
            var result2 = customerManager.Delete(new Customer
            {
                Id          = 6,
                CompanyName = "Vural a.ş.",
                UserId      = 5,
            });

            Console.WriteLine(result2.Message);
        }
Beispiel #3
0
        private static void EfCustomerDalTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Customer customer1 = new Customer()
            {
                CompanyName = "Google",
                UserId      = 4
            };

            Console.WriteLine("\nInitial records of Customers table: ");
            foreach (Customer customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CompanyName);
            }

            Console.WriteLine("\nAdding customer: {0} to Customers table", customer1.CompanyName);
            customerManager.Add(customer1);

            Console.WriteLine("\nList of customers: ");
            foreach (Customer customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CompanyName);
            }

            Console.WriteLine("\nRemoving customer: {0} from Customers table", customer1.CompanyName);
            customerManager.Delete(customer1);

            Console.WriteLine("\nList of customers: ");
            foreach (Customer customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CompanyName);
            }
        }
Beispiel #4
0
        private void UserMenu_Delete(UserManager userManager, CustomerManager customerManager)
        {
            Console.WriteLine("\nList of All Users");
            userManager.WriteAll(userManager.GetAll().Data);

            bool IsExist  = false;
            int  searchID = 0;

            while (!IsExist)
            {
                Console.Write("-> Enter the ID of the user you want to delete: ");
                searchID = Convert.ToInt32(Console.ReadLine());
                IsExist  = userManager.IsExistById(searchID).Success;
                if (!IsExist)
                {
                    Console.Write(Messages.ColorNotExist + " Try again. User ID: ");
                    searchID = Convert.ToInt32(Console.ReadLine());
                    IsExist  = userManager.IsExistById(searchID).Success;
                }
            }

            var user = userManager.Delete(userManager.GetById(searchID).Data).Data;

            customerManager.Delete(customerManager.GetById(user.Id).Data);
        }
Beispiel #5
0
        private static void CustomersTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomersDal());

            Console.WriteLine(customerManager.Add(new Customer
            {
                UserId      = 1,
                CompanyName = "A AJANS"
            }));
            customerManager.Add(new Customer
            {
                UserId      = 2,
                CompanyName = "B AJANS"
            });
            customerManager.Add(new Customer
            {
                UserId      = 3,
                CompanyName = "C AJANS"
            });
            Console.WriteLine("*********************MÜŞTERİ LİSTESİ********************");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("{0} : {1} : {3} ", customer.Id, customer.UserId, customer.CompanyName);
            }

            customerManager.Delete(new Customer
            {
                Id = 1
            });
            Console.WriteLine("*********************MÜŞTERİ LİSTESİ********************");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("{0} : {1} : {3} ", customer.Id, customer.UserId, customer.CompanyName);
            }
        }
Beispiel #6
0
        private static void RunCustomerManager()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());
            int             options         = -1;

            while (options != 0)
            {
                Console.WriteLine("[1] List All Customers\n" +
                                  "[2] Get Customer By ID\n" +
                                  "[3] Add Customer\n" +
                                  "[4] Delete Customer\n" +
                                  "[5] Update Customer\n" +
                                  "[0] Exit Menu" +
                                  "");
                options = Convert.ToInt32(Console.ReadLine());
                switch (options)
                {
                case 1:
                    foreach (var customer in customerManager.GetAll().Data)
                    {
                        Console.WriteLine("Customer ID: " + customer.CustomerID);
                        Console.WriteLine("User ID: " + customer.UserID);
                        Console.WriteLine("Company Name: " + customer.CompanyName);
                    }
                    break;

                case 2:
                    Console.WriteLine(customerManager.GetID(2).Data.CompanyName);
                    break;

                case 3:
                    customerManager.Add(new Customer {
                        CompanyName = "Holy Mustance", UserID = 2
                    });
                    break;

                case 4:
                    Console.WriteLine("-Enter Customer ID-");
                    int deletedcustomer = Convert.ToInt32(Console.ReadLine());
                    customerManager.Delete(new Customer {
                        CustomerID = deletedcustomer
                    });
                    break;

                case 5:
                    Console.WriteLine("-Enter Customer ID-");
                    int updatedcustomer = Convert.ToInt32(Console.ReadLine());
                    customerManager.Update(new Customer
                    {
                        CustomerID  = updatedcustomer,
                        CompanyName = "Boris"
                    });
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #7
0
        private static void DeleteCustomerTest(int id)
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            var result = customerManager.Delete(customerManager.GetById(id).Data);

            Console.WriteLine(result.Message);
        }
Beispiel #8
0
        private static void DeleteTest(CustomerManager customerManager)
        {
            var result = customerManager.Delete(new Customer {
                ID = 1
            });

            Console.WriteLine(result.Message);
        }
Beispiel #9
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 #10
0
        private static void CustomerManager()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Console.WriteLine(customerManager.Add(new Customer()
            {
                UserId      = 2,
                CompanyName = "AAA Ajans"
            }));

            customerManager.Add(new Customer()
            {
                UserId      = 3,
                CompanyName = "BBB Ajans"
            });

            customerManager.Add(new Customer()
            {
                UserId      = 4,
                CompanyName = "BBB Ajans"
            });

            Console.WriteLine("------------------MÜŞTERİ LİSTESİ-------------------------");

            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("{0} : {1} : {2}", customer.Id, customer.UserId, customer.CompanyName);
            }

            customerManager.Update(new Customer()
            {
                Id          = 3,
                UserId      = 4,
                CompanyName = "CCC Ajans"
            });

            Console.WriteLine("------------------MÜŞTERİ LİSTESİ-------------------------");

            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("{0} : {1} : {2}", customer.Id, customer.UserId, customer.CompanyName);
            }

            customerManager.Delete(new Customer()
            {
                Id = 3
            });

            Console.WriteLine("------------------MÜŞTERİ LİSTESİ-------------------------");

            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine("{0} : {1} : {2}", customer.Id, customer.UserId, customer.CompanyName);
            }
        }
Beispiel #11
0
            static void deleteCustomer(CustomerManager customerManager)
            {
                Customer customer1 = new Customer();

                getAllCustomer(customerManager);
                Console.WriteLine("Enter Customer ID to DELETE:");
                customer1.Id = UInt16.Parse(Console.ReadLine());
                //customer1 = customerManager.GetById(customer1.CustomerId);
                customer1 = customerManager.GetById(customer1.Id).Data;
                customerManager.Delete(customer1);
            }
Beispiel #12
0
        private static void CustomerDeleteTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            CustomerTest();
            Console.Write("Silmek için Customer ID'si giriniz:");
            int chooseId = int.Parse(Console.ReadLine());
            var result   = customerManager.GetById(chooseId).Data;

            customerManager.Delete(result);
        }
Beispiel #13
0
        private static void CustomerDelete()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            CustomerList();
            Console.Write("Silmek istediğiniz müşterinin Id'si: ");
            int id = int.Parse(Console.ReadLine());

            customerManager.Delete(new Customer {
                Id = id
            });
        }
Beispiel #14
0
        private static void CustomerDelete(CustomerManager customerManager)
        {
            Console.WriteLine("---------- Müşteri Kayıt Silme Ekranı ----------");
            Console.WriteLine("Müşteri Id:");
            int      id             = Convert.ToInt32(Console.ReadLine());
            Customer deleteCustomer = new Customer {
                CustomerId = id
            };

            var result = customerManager.Delete(deleteCustomer);

            SuccessCustomer(customerManager, result);
        }
Beispiel #15
0
        private static void DeleteToCustomer(CustomerManager customerManager)
        {
            int _deletedCustomerId;

            Console.Write("Silmek istediğiniz Kayıt ID : ");
            _deletedCustomerId = Convert.ToInt32(Console.ReadLine());

            var result = customerManager.Delete(new Customer 
            {
                CustomerId=_deletedCustomerId 
            });
            Console.WriteLine(result.Message);
        }
Beispiel #16
0
        public static void DeleteCustomer(CustomerManager customerManager)
        {
            Console.Clear();
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine($"{customer.Id}. {customer.CompanyName}");
            }
            Console.Write("Lütfen Sistemden Silmek Istediğiniz Müşterinin Id sini Giriniz:");
            int customerId = Convert.ToInt32(Console.ReadLine());

            customerManager.Delete(new Customer {
                Id = customerId
            });
        }
Beispiel #17
0
        private static void CustomerTest(CustomerManager customerManager)
        {
            if (customerManager.GetAll().Data.Count != 0)
            {
                Console.WriteLine("Bütün müşteriler");
                foreach (var customer in customerManager.GetAll().Data)
                {
                    Console.WriteLine(customer.CustomerId + "  " + customer.UserId + "  " + customer.CompanyName);
                }
            }
            else
            {
                Console.WriteLine("Henüz hiç müşteri yok!");
            }

            customerManager.Add(new Customer {
                UserId = 2, CompanyName = "AyseCompany"
            });
            customerManager.Add(new Customer {
                UserId = 2, CompanyName = "BilgeCompany"
            });

            Console.WriteLine("Eklemeden sonra bütün müşteriler");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + "  " + customer.UserId + "  " + customer.CompanyName);
            }

            customerManager.Update(new Customer
            {
                CustomerId  = 2,
                UserId      = 2,
                CompanyName = "UpdatedCompany"
            });
            Console.WriteLine("Güncellemeden sonra bütün müşteriler");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + "  " + customer.UserId + "  " + customer.CompanyName);
            }

            customerManager.Delete(new Customer {
                CustomerId = 2
            });
            Console.WriteLine("Silmeden sonra bütün müşteriler");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + "  " + customer.UserId + "  " + customer.CompanyName);
            }
        }
        public void DeleteToCustomer()
        {
            int _deletedCustomerId;

            Console.Write("Silmek istediğiniz Kayıt ID : ");
            _deletedCustomerId = Convert.ToInt32(Console.ReadLine());

            Customer deleteCustomer = new Customer {
                Id = _deletedCustomerId
            };

            var result = customerManager.Delete(deleteCustomer);

            Console.WriteLine(result.Message);
        }
Beispiel #19
0
        private static void CustomerDelete()
        {
            ICustomerService customerManager = new CustomerManager(new EfCustomerDal());
            var result1 = customerManager.Delete(new Customer
            {
                CustomerId  = 2,
                UserId      = 2,
                CompanyName = "solvia"
            });

            if (result1.Success == true)
            {
                Console.WriteLine(result1.Message);
            }
        }
Beispiel #20
0
        //private static void UserAndCustomerAdd()
        //{

        //    UserManager userManager = new UserManager(new EfUserDal());
        //    User user = new User { FirstName = "Burak", LastName = "Esen", Email = "*****@*****.**", PasswordHash = "123456" };
        //    userManager.Add(user);

        //    CustomerManager customerManager = new CustomerManager(new EfCustomerDal());
        //    customerManager.Add(new Customer { UserId = userManager.Get(user).Data.Id, CompanyName = "BE Lim." });



        //    User userTwo = new User { FirstName = "Samet", LastName = "Öz", Email = "*****@*****.**", Password = "******" };
        //    userManager.Add(userTwo);

        //    customerManager.Add(new Customer { UserId = userManager.Get(userTwo).Data.Id, CompanyName = "Sö Lim." });

        //}
        private static void UserAndCustomerDelete(int userId)
        {
            UserManager userManager = new UserManager(new EfUserDal());
            var         user        = userManager.GetById(userId).Data;


            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            if (customerManager.GetByUserId(user.Id).Data != null)
            {
                Console.WriteLine("GİRDİ");
                customerManager.Delete(customerManager.GetByUserId(user.Id).Data);
            }

            userManager.Delete(user);
        }
Beispiel #21
0
        private static void CustomerTest()
        {
            Console.WriteLine("--------- CUSTOMER TEST ---------");
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Console.WriteLine("--------- GetAll ---------");
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + " " + customer.CompanyName);
            }

            Console.WriteLine("--------- GetById ---------");
            Console.WriteLine(customerManager.GetById(1).Data.CustomerId + " " + customerManager.GetById(1).Data.CompanyName);

            Console.WriteLine("--------- Add ---------");
            var resultAdd = customerManager.Add(new Customer {
                CustomerId = 6, UserId = 1, CompanyName = "F"
            });

            Console.WriteLine(resultAdd.Message);
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + " " + customer.CompanyName);
            }

            Console.WriteLine("--------- Update ---------");
            var resultUpdate = customerManager.Update(new Customer {
                CustomerId = 6, UserId = 1, CompanyName = "FFF"
            });

            Console.WriteLine(resultUpdate.Message);
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + " " + customer.CompanyName);
            }

            Console.WriteLine("--------- Delete ---------");
            var resultDelete = customerManager.Delete(new Customer {
                CustomerId = 6
            });

            Console.WriteLine(resultDelete.Message);
            foreach (var customer in customerManager.GetAll().Data)
            {
                Console.WriteLine(customer.CustomerId + " " + customer.CompanyName);
            }
        }
Beispiel #22
0
        private static void CustomerDelete()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            try
            {
                customerManager.Delete(new Customer {
                    Id = 4
                });

                Console.WriteLine("Müşteri silindi");
            }
            catch (Exception)
            {
                Console.WriteLine("Müşteri silinirken bir hata oluştu");
            }
        }
        //private static void UserTest(UserManager userManager)
        //{
        //    userManager.Add(new User { Email = "e", FirstName = "a", LastName = "b", Password = "******" });
        //    foreach (var users in userManager.GetAll().Data)
        //    {
        //        Console.WriteLine(users.FirstName);
        //    }

        //    userManager.Update(new User { Id = 3, Email = "E", FirstName = "A", LastName = "B", Password = "******" });
        //    userManager.Delete(new User { Id = 4 });
        //}

        private static void CustomerTest(CustomerManager customerManager)
        {
            customerManager.Add(new Customer {
                CompanyName = " A Şirketi", UserId = 1
            });
            foreach (var customers in customerManager.GetAll().Data)
            {
                Console.WriteLine("Şirket Adı: " + customers.CompanyName + "User Id: " + customers.UserId);
            }

            customerManager.Update(new Customer {
                CompanyName = " X Şirketi", UserId = 6, CustomerId = 7
            });
            customerManager.Delete(new Customer {
                CustomerId = 6
            });
        }
Beispiel #24
0
        static void CustomerDelete(CustomerManager customerManager)
        {
            Customer deletedCustomer = new Customer();

            Console.Write("Silmek istediğiniz müşterinin idsini giriniz : ");
            deletedCustomer.Id = int.Parse(Console.ReadLine());
            var result = customerManager.Delete(deletedCustomer);

            if (result.Success)
            {
                Console.WriteLine(result.Message);
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
Beispiel #25
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer
            {
                customerId      = 1,
                customerName    = "Erhan",
                customerSurName = "küçükkurt",
                IdentityNo      = 1234567890
            };

            Customer customer2 = new Customer
            {
                customerId      = 2,
                customerName    = "Beyza",
                customerSurName = "Küçükkurt",
                IdentityNo      = 1122334455
            };


            Customer customer3 = new Customer
            {
                customerId      = 3,
                customerName    = "Turan",
                customerSurName = "Akyıldız",
                IdentityNo      = 1111111111
            };


            CustomerManager customerManager = new CustomerManager();


            customerManager.Add(customer1);

            customerManager.Add(customer2);

            customerManager.Add(customer3);

            Console.WriteLine("********************");


            customerManager.Delete(customer2);

            Console.WriteLine("********************");

            customerManager.GetAllCustomer();
        }
Beispiel #26
0
        private static void CustomerCrudTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            customerManager.Add(new Customer
            {
                CompanyName = "abc",
            });
            customerManager.Update(new Customer
            {
                CustomerId  = 2,
                CompanyName = "Seat"
            });
            customerManager.Delete(new Customer
            {
                CustomerId = 3
            });
        }
Beispiel #27
0
        private static void CustomerTest()
        {
            int             secim           = CRUDMenu();
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());
            Customer        customer        = new Customer();

            switch (secim)
            {
            case 1:
                Console.Write("User ID: ");
                customer.UserId = int.Parse(Console.ReadLine());;
                Console.Write("Company Name: ");
                customer.CompanyName = Console.ReadLine();
                Console.WriteLine(customerManager.Add(customer).Message);
                break;

            case 2:
                Console.Write("User Id: ");
                customer.Id = int.Parse(Console.ReadLine());
                Console.WriteLine(customerManager.Delete(customer).Message);
                break;

            case 3:
                Console.Write("Customer Id: ");
                customer.Id = int.Parse(Console.ReadLine());
                Console.Write("User ID: ");
                customer.UserId = int.Parse(Console.ReadLine());;
                Console.Write("Company Name: ");
                customer.CompanyName = Console.ReadLine();
                Console.WriteLine(customerManager.Update(customer).Message);
                break;

            case 4:
                foreach (var item in customerManager.GetAll().Data)
                {
                    Console.WriteLine(item.CompanyName);
                }
                break;

            default:
                Console.WriteLine("Hatalı giriş");
                break;
            }
        }
        public static void CustomerDelete()
        {
            Customer        _customer       = new Customer();
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            Console.WriteLine("-------------MÜŞTERİ SİLME İŞLEMİ--------------");
            Console.Write("Müşteri No = ");
            int customerId = int.Parse(Console.ReadLine());
            var result     = customerManager.Delete(customerId);

            if (result.Success == true)
            {
                Console.WriteLine(result.Message);
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
Beispiel #29
0
        private static void CustomerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());
            var             result          = customerManager.GetAll();

            foreach (var customer in result.Data)
            {
                Console.WriteLine(customer.CompanyName);
            }
            customerManager.Add(new Customer {
                CustomerId = 4, UserId = 1, CompanyName = "şirket1"
            });
            customerManager.Update(new Customer {
                CustomerId = 4, UserId = 1, CompanyName = "Berk Şirket"
            });
            customerManager.Delete(new Customer {
                CustomerId = 4
            });
        }
        private static void CustomerManagerTest()
        {
            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            customerManager.Add(new Customer {
                UserId = 1, CompanyName = "Tesla"
            });
            customerManager.Add(new Customer {
                CompanyName = "Epic Games"
            });
            customerManager.Add(new Customer {
                CompanyName = "Steam"
            });
            customerManager.Add(new Customer {
                CompanyName = "Valve"
            });

            var result = customerManager.GetAll();

            if (result.Success)
            {
                foreach (var customer in result.Data)
                {
                    Console.WriteLine($@"{customer.CompanyName}");
                }
            }

            customerManager.Delete(new Customer {
                CustomerId = 2
            });

            var result2 = customerManager.GetAll();

            if (result2.Success)
            {
                foreach (var customer in result2.Data)
                {
                    Console.WriteLine($@"{customer.CompanyName}");
                }
            }
        }