예제 #1
0
        public ActionResult Zoeken(MainView viewmodel, string returnURL)
        {
            try
            {
                if (Session["SESwkm"] == null)
                {
                    Session["SESwkm"] = new Winkelmand();
                }
                Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                mvvm.ListProduct = productdbcontroller.ZoekAllProducten(viewmodel.SearchViewModel.Query, -1, -1, 100);
                mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                mvvm.ListMand = qwkm.GetAllwinkelmand();

                //ViewBag.Zoek = viewmodel.SearchViewModel.Query;

                return View(mvvm);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception @Home/Index" + e);
                return View();
            }
        }
예제 #2
0
        public ActionResult LogOn(MainView viewmodel, String returnURL)
        {
            if (ModelState.IsValid)
            {
                AccountDBController accountdbcontroller = new AccountDBController();
                bool geldig = accountdbcontroller.IsGeldig(viewmodel.LogOnViewModel.Email, viewmodel.LogOnViewModel.Wachtwoord);
                if (geldig)
                {
                    FormsAuthentication.SetAuthCookie(viewmodel.LogOnViewModel.Email, false);

                    Gebruiker gebruiker = gebruikerdbcontroller.GetGebruiker(viewmodel.LogOnViewModel.Email);//gebruiker ophalen
                    orderdbcontroller.Goldmembership(gebruiker);//kijken of klant in aanmerking komt voor goldmembership

                    return Redirect(returnURL ?? Url.Action("Index", "Account"));
                }
                else
                {
                    ModelState.AddModelError("", "Email en wachtwoord komen niet overeen.");
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                    mvvm.ListProduct = productdbcontroller.GetAllProducten();
                    mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                    mvvm.ListMand = qwkm.GetAllwinkelmand();

                    return View(mvvm);
                }
            }
            else
            {
                if (Session["SESwkm"] == null)
                {
                    Session["SESwkm"] = new Winkelmand();
                }
                Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                mvvm.ListProduct = productdbcontroller.GetAllProducten();
                mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                mvvm.ListMand = qwkm.GetAllwinkelmand();

                return View(mvvm);
            }
        }
예제 #3
0
파일: Email.cs 프로젝트: dutchbot/IntoSport
        public void SendEmail()
        {
            try
            {

                //Om te testen moet je een valide emailadresVan invoeren met bijbehorend password.
                MainView mvvm = new MainView();
                string emailAdresVan = "*****@*****.**";
                string password = "******";
                string berichtnaar = berichtVan;

                //MailMessage object aanmaken.
                MailMessage msg = new MailMessage();
                //Properties van het zojuist aangemaakte MailMessage zetten
                msg.From = new MailAddress(emailAdresVan);
                msg.To.Add(new MailAddress(berichtnaar));
                msg.Subject = Onderwerp;
                msg.Body = Bericht;
                msg.IsBodyHtml = true;

                //Als SmtpClient ga ik in dit voorbeeld uit van gmail. Je bent natuurlijk vrij om een ander smtpclient te kiezen. 
                //SmtpClient aanmaken "smtp.gmail.com" (= smtp server gmail) 587 (= Port 587 is voor gebruikers om emails over te versturen.)
                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
                //NetworkCredential object aanmaken. Emailadres en password zijn de constructorparameters
                NetworkCredential loginInfo = new NetworkCredential(emailAdresVan, password);

                //Properties van het zojuist aangemaakte SmtpClient zetten
                smtpClient.EnableSsl = true;
                smtpClient.UseDefaultCredentials = true;
                smtpClient.Credentials = loginInfo;
                //Bericht daadwerkelijk versturen
                smtpClient.Send(msg);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Mail versturen goldmember error: " + e);
            }

        }
예제 #4
0
        public ActionResult Contact(MainView viewModel)
        {
            if (ModelState.IsValid)
            {
                viewModel.email.SendEmailToWebshop();
                contactSucces = true;
                return Contact();
            }
            else
            {
                if (Session["SESwkm"] == null)
                {
                    Session["SESwkm"] = new Winkelmand();
                }
                Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                mvvm.ListProduct = productdbcontroller.GetAllProducten();
                mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                mvvm.ListMand = qwkm.GetAllwinkelmand();

                return View(mvvm);
            }
        }
예제 #5
0
        public ActionResult Registreren(MainView main)
        {
            if (Session["SESwkm"] == null)
            {
                Session["SESwkm"] = new Winkelmand();
            }
            Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

            mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
            mvvm.ListProduct = productdbcontroller.GetAllProducten();
            mvvm.ListMerk = merkdbcontroler.GetAllMerken();
            mvvm.ListMand = qwkm.GetAllwinkelmand();

            try
            {
                if (ModelState.IsValid)
                {

                    gebruikerdbcontroller.InsertBeheerder(main.gebruiker);
                    return RedirectToAction("Beheerders", "Beheer");
                }
                else
                {
                    return View(mvvm);
                }
            }
            catch (Exception e)
            {
                return View(mvvm);
            }
        }
예제 #6
0
        public ActionResult ToevoegenMerk(MainView main)
        {            
            try
            {
                if (ModelState.IsValid)
                {
                    merkdbcontroler.InsertMerk(main.Merk);
                    return RedirectToAction("Merken", "Beheer");
                }
                else
                {
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    main.ListCategorie = categoriedbcontroller.GetAllCategories();
                    main.ListProduct = productdbcontroller.GetAllProducten();
                    main.ListMerk = merkdbcontroler.GetAllMerken();
                    main.ListMand = qwkm.GetAllwinkelmand();

                    return View(main);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return View();
            }
        }
예제 #7
0
        public ActionResult WijzigStatus(MainView main)
        {

            try
            {
                Status status = orderdbcontroller.GetGekozenStatus(main.SelectedStatusID);
                main.order.Status = status.ID;
                orderdbcontroller.UpdateStatus(main.order);
                return RedirectToAction("Bestellingen", "Beheer", new { klantID = main.order.Gebruiker });
            }
            catch (Exception e)
            {
               
                return View(mvvm);
            }
        }
예제 #8
0
        public ActionResult WijzigGebruiker(MainView main)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    gebruikerdbcontroller.UpdateGebruiker(main.gebruiker);
                    Session["userID"]=null; //sessie weer null maken, voor evt volgende wijziging
                    return RedirectToAction("GebruikerBeheer", "Beheer");
                }
                else
                {
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    main.ListCategorie = categoriedbcontroller.GetAllCategories();
                    main.ListProduct = productdbcontroller.GetAllProducten();
                    main.ListMerk = merkdbcontroler.GetAllMerken();
                    main.ListMand = qwkm.GetAllwinkelmand();

                    return View(main);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return View();
            }
        }
예제 #9
0
        public ActionResult ToevoegenProduct(MainView main)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    main.DetailProduct.merk = merkdbcontroler.GetMerk(main.SelectedMerkID);
                    main.DetailProduct.cat = categoriedbcontroller.GetCategorie(main.SelectedCategorieID);
                    main.DetailProduct.Image = "geenfoto.png";
                    productdbcontroller.InsertProduct(main.DetailProduct);

                    return RedirectToAction("Producten", "beheer");
                }
                else
                {
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    main.ListCategorie = categoriedbcontroller.GetAllCategories();
                    main.ListProduct = productdbcontroller.GetAllProducten();
                    main.ListMerk = merkdbcontroler.GetAllMerken();
                    main.ListMand = qwkm.GetAllwinkelmand();


                    List<Merk> merken = merkdbcontroler.GetAllMerken();


                    main.Merken = new SelectList(merken, "ID", "Naam");

                    List<Categorie> categorieen = categoriedbcontroller.GetAllCategories();


                    main.Categorieen = new SelectList(categorieen, "ID", "Naam");

                    return View(main);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return View();
            }
        }
예제 #10
0
        public ActionResult WijzigThumb(MainView main, HttpPostedFileBase imageName)
        {
            try
            {
                if (imageName != null && imageName.ContentLength > 0 && (imageName.ContentType.Equals("image/png") || imageName.ContentType.Equals("image/gif") || imageName.ContentType.Equals("image/jpeg")))
                {
                        var fileName = Path.GetFileName(imageName.FileName);
                        var path = Path.Combine(Server.MapPath("~/Content/Upload"), fileName);
                        imageName.SaveAs(path);

                        productdbcontroller.UpdateProductAfbeelding(main.DetailProduct.ID, fileName);

                        return RedirectToAction("Producten", "beheer");
                }
                else
                {
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                    mvvm.ListProduct = productdbcontroller.GetAllProducten();
                    mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                    mvvm.ListMand = qwkm.GetAllwinkelmand();

                    List<Merk> merken = merkdbcontroler.GetAllMerken();

                    mvvm.Merken = new SelectList(merken, "ID", "Naam");

                    List<Categorie> categorieen = categoriedbcontroller.GetAllCategories();

                    mvvm.Categorieen = new SelectList(categorieen, "ID", "Naam");

                    return View(mvvm);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Product Wijzigproduct(Product product)");
                return View(e);
            }
        }
예제 #11
0
        public ActionResult WijzigAccount(MainView main)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    gebruikerdbcontroller.UpdateGebruiker(main.gebruiker);
                    return LogOut();
                }
                else
                {
                    if (Session["SESwkm"] == null)
                    {
                        Session["SESwkm"] = new Winkelmand();
                    }
                    Winkelmand qwkm = (Winkelmand)Session["SESwkm"];

                    mvvm.ListCategorie = categoriedbcontroller.GetAllCategories();
                    mvvm.ListProduct = productdbcontroller.GetAllProducten();
                    mvvm.ListMerk = merkdbcontroler.GetAllMerken();
                    mvvm.ListMand = qwkm.GetAllwinkelmand();
                    mvvm.gebruiker = gebruikerdbcontroller.GetGebruiker(User.Identity.Name);

                    return View(mvvm);
                }
            }
            catch (Exception e)
            {
                return View(main);
            }
        }