public void viewSeller() { SellerRepositary obj = new SellerRepositary(); obj.addSellerIntoList(); foreach (KeyValuePair <int, Seller> seller in obj.sellerList) { Console.WriteLine("Name : {0}\nUserName : {1}\nMailID : {2}\nPhone Number : {3}\nRole : {4}\nSeller ID : {5}\n ", seller.Value.Name, seller.Value.UserName, seller.Value.MailId, seller.Value.PhoneNumber, seller.Value.Role, seller.Value.SellerID); } }
public void userLogIn() { CustomerRepositary custRepos = new CustomerRepositary(); SellerRepositary sellerRepos = new SellerRepositary(); AdminRepositary adminRepos = new AdminRepositary(); string Role = null; Console.WriteLine("\n***Log-In***\n"); Console.WriteLine("Enter User Name : "); string _UserName = Console.ReadLine(); Console.WriteLine("Enter Password : "******"Login Successfull...\n"); Role = customer.Value.Role; } } foreach (KeyValuePair <int, Seller> seller in sellerRepos.sellerList) { if (seller.Value.Password == _Password && seller.Value.UserName == _UserName) { Console.WriteLine("Login Successfull...\n"); Role = seller.Value.Role; } } foreach (KeyValuePair <int, Admin> admin in adminRepos.AdminList) { if (admin.Value.Password == _Password && admin.Value.UserName == _UserName) { Console.WriteLine("Login Successfull...\n"); Role = admin.Value.Role; } } // If Role is not Null the Control take in to the Specified Access if (Role != "") { Console.WriteLine("Welcome {0} \nAccess Granted As A {1}", _UserName, Role); if (Role == "Admin") { Admin adminObj = new Admin(); adminObj.accessAdmin(); } else if (Role == "Seller") { Seller sellerObj = new Seller(); sellerObj.accessSeller(); } else if (Role == "Customer") { Customer customerObj = new Customer(); customerObj.accessCustomer(); } } else { Console.WriteLine("Login Failed..."); } } catch (Exception e) { Console.WriteLine("Exception Occur : " + e.Message); } }