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); } }
public void RetrieveExistingWithAddress() { var customerRepositary = new CustomerRepositary(); var expected = new Customer(1) { LastName = "Baggins", FirstName = "Bilbo", EmailAddress = "*****@*****.**", //We iumplement the relationship between customer and address AddressList = new List <Address>() { new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bag shot row", State = "Shire", PostalCode = "144", Country = "Middle Earth", City = "Hobbiton" }, new Address() { AddressType = 2, StreetLine1 = "Green Dragon", StreetLine2 = "Bag shot row", State = "Shire", PostalCode = "146", Country = "Middle Earth", City = "Bywater" } } }; var actual = customerRepositary.Retrieve(1); Assert.AreEqual(expected.CustomerId, actual.CustomerId); Assert.AreEqual(expected.EmailAddress, actual.EmailAddress); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.FirstName, actual.FirstName); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.AddressList[i].AddressType, actual.AddressList[i].AddressType); Assert.AreEqual(expected.AddressList[i].StreetLine1, actual.AddressList[i].StreetLine1); Assert.AreEqual(expected.AddressList[i].City, actual.AddressList[i].City); Assert.AreEqual(expected.AddressList[i].State, actual.AddressList[i].State); Assert.AreEqual(expected.AddressList[i].Country, actual.AddressList[i].Country); Assert.AreEqual(expected.AddressList[i].PostalCode, actual.AddressList[i].PostalCode); } }
public void SaveShouldReturnSavedId() { ICustomerRepositary customerRepository = new CustomerRepositary(); Data.Customer customer = new Data.Customer() { CustomerId = 0, FirstName = "test name", LastName = "last name", Email = "*****@*****.**", PhoneNumber = "123456", Status = true }; int id = customerRepository.Create(customer).CustomerId; Assert.AreNotEqual(0, id); }
public void RetrieveValid() { var customerRepositary = new CustomerRepositary(); var expected = new Customer(1) { LastName = "Baggins", FirstName = "Bilbo", EmailAddress = "*****@*****.**" }; var actual = customerRepositary.Retrieve(1); Assert.AreEqual(expected.CustomerId, actual.CustomerId); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.EmailAddress, actual.EmailAddress); }
public CustomerService() { customerRepo = new CustomerRepositary(CustomerDbContext.Instance); CustomerList = new List <Customer>(); CustomerList = customerRepo.GetAllCustomer(); }
public CustomerService() { customerRepositary = new CustomerRepositary(new ShopingDbContext()); }
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); } }
public CustomerService() { //customerRepositary = new CustomerRepositary(new ShopingDbContext()); customerRepositary = new CustomerRepositary(ShopingDbContext.Instance); }