Example #1
0
        public void viewCustomer()
        {
            CustomerRepositary obj = new CustomerRepositary();

            obj.addCustomerIntoList();
            foreach (KeyValuePair <int, Customer> customer in obj.customerList)
            {
                Console.WriteLine("Name : {0}\nUserName : {1}\nMailID : {2}\nRole : {3}\nSeller ID : {4}\n ", customer.Value.Name, customer.Value.UserName, customer.Value.MailId, customer.Value.Role, customer.Value.CustomerID);
            }
        }
Example #2
0
        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);
            }
        }