protected void Login(string loginEmail, string loginPassword) { var customer = Context.GetCustomer(loginEmail, loginPassword); if (customer != null) { var cus = new CustomerLoginModel(); cus.SetLogin(customer.Id, customer.CustomerName, customer.CustomerEmail); CacheHelper._CacheHelper.SetCustomer(cus); var cart = CacheHelper._CacheHelper.GetCartFromSession(); cart.CustomerId = cus.Id; cart.SetCustomerInfo(customer.CustomerName, customer.CustomerPhone); cart.SetCustomerEmail(customer.CustomerEmail); cart.SetShipmentAddressAndFee(CacheHelper._CacheHelper.LoadShipmentFee().SingleOrDefault(i => i.District == customer.ShipDistrict), customer.ShipAddress); } else { throw new Exception("Login fail"); } }
public void SetCustomer(CustomerLoginModel cus) { HttpContext.Current.Session[CustomerLoginSession] = cus; }