Ejemplo n.º 1
0
        /// <summary>
        /// The btn login_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            // Textfields
            var emailadress = this.txtEmailAddress.Text;
            var password = this.txtPassword.Text;

            if (!string.IsNullOrEmpty(emailadress) || !string.IsNullOrEmpty(password))
            {
                var authentic = new CustomerLogic(new CustomerOracleContext());
                if (authentic.CheckEmailValidation(emailadress)) // checks emailadress & password
                {
                    var verified = authentic.GetByEmailAndPassword(emailadress, authentic.GetHashedPassword(password));
                    if (verified != null) // if user is found makes cookies
                    {
                        FormsAuthentication.RedirectFromLoginPage(verified.Emailaddress, this.chkRememberMe.Checked);
                    }
                    else
                    {
                        this.lblError.Visible = true;
                        this.lblError.Text = "Verkeerde inloggegevens";
                    }
                }
                else
                {
                    this.lblError.Visible = true;
                    this.lblError.Text = "Geen correct emailadres gebruikt";
                }
            }
            else
            {
                this.lblError.Visible = true;
                this.lblError.Text = "Bepaalde velden zijn leeg.";
            }
        }
 /// <summary>
 /// The page_ load.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _logicCustomer = new CustomerLogic(new CustomerOracleContext());
 }
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.User.Identity.IsAuthenticated)
            {
                this.Response.Redirect("~/Login.aspx");
            }

            // Loading articles
            this.workingman = new ShoppingCartActions();
            this.transportman = new OrderLogic(new DeliveryOracleContext(), new PickupOracleContext(), new OrderOracleContext());

            // Loading user
            var customerLogic = new CustomerLogic(new CustomerOracleContext());
            this.currentCustomer = customerLogic.GetByEmail(HttpContext.Current.User.Identity.Name);

            // Put information in form
            this.HcustomerID.Value = this.currentCustomer.Id.ToString();
            this.txtName.Text = this.currentCustomer.Name;
            this.txtAddress.Text = this.currentCustomer.Address;
            this.txtPostalCode.Text = this.currentCustomer.Postalcode;
            this.txtCity.Text = this.currentCustomer.City;
            this.txtTelePhoneNumber.Text = this.currentCustomer.Telephone;
            this.txtEmailAddress.Text = this.currentCustomer.Emailaddress;

            // Loading list of stores for picking up
            this.storeLogic  = new StoreLogic(new StoreOracleContext());

            foreach (var store in storeLogic.GetAllStores())
            {
                this.drpStores.Items.Add("MyCom - " + store.Address);
            }

            // Loading fields for delivery
            this.txtAlterAddress.Text = this.currentCustomer.Address;
            this.txtAlterCity.Text = this.currentCustomer.City;
            this.txtAlterPostal.Text = this.currentCustomer.Postalcode;
        }
Ejemplo n.º 4
0
 public void GetCustomerById()
 {
     var logic = new CustomerLogic(new CustomerOracleContext());
     var customer = logic.GetById(1);
     Assert.IsNotNull(customer, "Getting customer by id failed");
 }
Ejemplo n.º 5
0
 public void GetCustomerByEmailPassword()
 {
     var logic = new CustomerLogic(new CustomerOracleContext());
     var customer = logic.GetByEmailAndPassword("*****@*****.**", logic.GetHashedPassword("welkom"));
     Assert.IsNotNull(customer, "Getting customer by email & password failed");
 }
Ejemplo n.º 6
0
 public void GetCustomerByEmail()
 {
     var logic = new CustomerLogic(new CustomerOracleContext());
     var customer = logic.GetByEmail("*****@*****.**");
     Assert.IsNotNull(customer, "Getting customer by id failed");
 }
Ejemplo n.º 7
0
        public void UpdateCustomer()
        {
            var logic = new CustomerLogic(new CustomerOracleContext());
            var customer = logic.GetById(1);
            var exceptedcustomer = logic.GetById(1);
            exceptedcustomer.Password = logic.GetHashedPassword("winkel");

            customer.Password = logic.GetHashedPassword("winkel");
            logic.Update(customer);
            customer = logic.GetById(1);

            Assert.AreEqual(exceptedcustomer.Password, customer.Password, "Updating customer failed");
        }