public static void getUserChoice() { CustomerRepositary customerRepositary; Customer customerObj; Seller sellerObj; SellerRepositary sellRepositary; LogInManager loginObj = new LogInManager(); Console.WriteLine(Text.FirstOption); short userOption = short.Parse(Console.ReadLine()); switch (userOption) { case 1: Console.WriteLine(Text.SecondOption); short temp = Int16.Parse(Console.ReadLine()); if (temp == 1) { customerObj = new Customer(); customerRepositary = new CustomerRepositary(); customerObj.getCustomerRegistration(); customerObj.Role = "Customer"; loginObj.userLogIn(); } else if (temp == 2) { sellRepositary = new SellerRepositary(); sellerObj = new Seller(); sellerObj.getSellerRegistration(); sellerObj.Role = "Seller"; loginObj.userLogIn(); } break; case 2: loginObj.userLogIn(); break; case 3: System.Environment.Exit(0); break; default: break; } Console.WriteLine(Text.ThirdOption); bool istrue = (Console.ReadLine() == "yes" || Console.ReadLine() == "Yes" || Console.ReadLine() == "YES"); if (istrue) { getUserChoice(); } }
public void getCustomerRegistration() { RegistrationValidation userRegister = new RegistrationValidation(); Customer customer = new Customer { Name = userRegister.getName(), UserName = userRegister.getUserName(), MailId = userRegister.getMailId(), Role = "Customer", Password = userRegister.getPassword() }; CustomerRepositary custRepos = new CustomerRepositary(); if (custRepos.addCustomer(customer) == 1) { Console.WriteLine("\nCustomer Added..."); } else { Console.WriteLine("\nCustomer Does Not Added..."); } }