示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Employee_ProfileID,Name,Job,Profile_PhotoPath,Region,CountryOrProvince")] Employee_Profile employee_Profile)
        {
            if (id != employee_Profile.Employee_ProfileID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee_Profile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Employee_ProfileExists(employee_Profile.Employee_ProfileID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee_Profile));
        }
示例#2
0
        public IActionResult Index()
        {
            ViewData["HeaderBackgroundImg"] = _context.Photos.ToList()[58].PhotoPath;
            PageContent HowWeWorkView = new PageContent(_context);
            PageContent LearnMore     = new PageContent(
                new int[0], //photo

                new int[]   //text
            {
                10, 11, 12, 13, 14, 33
            },
                _context);

            HowWeWorkView.addPage(LearnMore);

            Employee_Profile contact = _context.Employee_Profiles.FirstOrDefault();

            if (contact == null)
            {
                return(RedirectToAction("Foutmelding", new { message = "contact is not found" }));
            }
            ViewBag.contact             = contact;
            ViewBag.articles            = Articles();
            ViewBag.CustomVsStandardArt = CustomVsStandardArt();
            return(View(HowWeWorkView));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("Employee_ProfileID,Name,Job,Profile_PhotoPath,Region,CountryOrProvince")] Employee_Profile employee_Profile)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee_Profile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee_Profile));
        }
        public void AddDBOTestEmployee()
        {
            WebsiteContext   C  = GetInMemoryDB();
            SearchController SC = new SearchController(C);
            Employee_Profile P  = new Employee_Profile
            {
                Name = "Cheese"
            };

            SC.AddDBO(P, new EmployeeSearch(C));
            Assert.Equal("Cheese", SC.DBO.ElementAt(0).GetSearchAbleString());
        }
示例#5
0
 public override void SetObject(object Uknown)
 {
     if (E == null)
     {
         E = (Employee_Profile)Uknown;
         base.Count();
     }
     else
     {
         new ArgumentException("Object already set");
     }
 }
示例#6
0
 public override bool Check(object Uknown)
 {
     if (Uknown.GetType() == typeof(Employee_Profile))
     {
         Employee_Profile NeedsCheck = (Employee_Profile)Uknown;
         if (NeedsCheck.Name == E.Name && NeedsCheck.Employee_ProfileID == E.Employee_ProfileID)
         {
             base.Count();
             return(true);
         }
     }
     return(false);
 }
示例#7
0
        //When clicked on a specific product send to this page.
        public IActionResult SpecificProduct(int ID)
        {
            Product product = GetSpecificProduct(ID);

            if (product == null)
            {
                return(RedirectToAction("Foutmelding", new { message = "Product is not found" }));
            }

            Employee_Profile contact = GetContact();

            if (contact == null)
            {
                return(RedirectToAction("Foutmelding", new { message = "Contact not found" }));
            }

            PageContent SpecificProductView = new PageContent(_context);
            PageContent LearnMore           = new PageContent(
                new int[0], //photo

                new int[]   //text
            {
                10, 11, 12, 13, 14, 32
            },
                _context);

            SpecificProductView.addPage(LearnMore);

            //filling all data used on the specific product page
            ViewBag.relatedProducts = RelatedProduct(product);
            ViewBag.inspiratie      = InspirationRecipe();

            ViewBag.ShowHeaderImg = false;
            ViewBag.Product       = product;
            ViewBag.contact       = contact;
            return(View(SpecificProductView));
        }
示例#8
0
        public static void Seed(WebsiteContext C)
        {
            Branch_Category Chicken = new Branch_Category
            {
                Name = "Chicken"
            };

            Branch_Category Pork = new Branch_Category
            {
                Name = "Pork"
            };

            Branch_Category Fruit = new Branch_Category
            {
                Name = "Fruit"
            };

            Type_Category ChickenSoup = new Type_Category
            {
                Name           = "ChickenSoup",
                BranchCategory = Chicken,
            };

            Type_Category ChickenEgg = new Type_Category
            {
                Name           = "ChickenEgg",
                BranchCategory = Chicken,
            };

            Chicken.TypeCategory = new List <Type_Category>();
            Chicken.TypeCategory.Add(ChickenSoup);
            Chicken.TypeCategory.Add(ChickenEgg);
            ChickenSoup.BranchCategory = Chicken;
            ChickenEgg.BranchCategory  = Chicken;

            Normal_Category SaltChicken = new Normal_Category
            {
                Name = "SaltChicken"
            };

            Normal_Category SweetChicken = new Normal_Category
            {
                Name = "SweetChicken"
            };

            Normal_Category NoChicken = new Normal_Category
            {
                Name = "NoChicken"
            };

            Normal_Category GingerChicken = new Normal_Category
            {
                Name = "GingerChicken"
            };

            ChickenSoup.NormalCategory = new List <Normal_Category>();
            ChickenEgg.NormalCategory  = new List <Normal_Category>();
            ChickenSoup.NormalCategory.Add(SaltChicken);
            ChickenSoup.NormalCategory.Add(SweetChicken);
            ChickenSoup.NormalCategory.Add(NoChicken);
            ChickenEgg.NormalCategory.Add(GingerChicken);
            SaltChicken.TypeCategory   = ChickenSoup;
            SweetChicken.TypeCategory  = ChickenSoup;
            NoChicken.TypeCategory     = ChickenSoup;
            GingerChicken.TypeCategory = ChickenEgg;

            Recipe ChickenWings = new Recipe
            {
                Name = "ChickenWings"
            };

            Recipe ChickenNoodles = new Recipe
            {
                Name = "ChickenNoodles"
            };

            Recipe Spinach = new Recipe
            {
                Name = "Spinach"
            };

            TypeCategory_Recipe SpinachSoup = new TypeCategory_Recipe
            {
                Type_Category = ChickenSoup,
                Recipe        = Spinach,
                Percent       = 10,
                Weight        = 0.5
            };

            TypeCategory_Recipe ChickenRecipe = new TypeCategory_Recipe
            {
                Type_Category = ChickenEgg,
                Recipe        = ChickenWings,
                Percent       = 15,
                Weight        = 2.6
            };

            TypeCategory_Recipe ChickenRecipe2 = new TypeCategory_Recipe
            {
                Type_Category = ChickenEgg,
                Recipe        = ChickenNoodles,
                Percent       = 80,
                Weight        = 2.56
            };

            Product ChickenSticks = new Product
            {
                Name        = "ChickenSticks",
                Description = "small",
                Contents    = "very small",
            };

            Product Ketchup = new Product
            {
                Name        = "Ketchup",
                Description = "big",
                Contents    = "very big",
            };

            Product Curry = new Product
            {
                Name        = "Curry",
                Description = "Scary",
                Contents    = "thing",
            };

            Product Bread = new Product
            {
                Name        = "Bread",
                Description = "Useless",
                Contents    = "thing",
            };

            NormalCategory_Product ZeroChickenGiven = new NormalCategory_Product
            {
                Product         = ChickenSticks,
                Normal_Category = NoChicken
            };

            NormalCategory_Product BreadChicken = new NormalCategory_Product
            {
                Product         = Bread,
                Normal_Category = SaltChicken
            };

            NormalCategory_Product SaltyChicken = new NormalCategory_Product
            {
                Product         = Ketchup,
                Normal_Category = SaltChicken
            };

            Product_Details PD0 = new Product_Details
            {
                Product        = Curry,
                ProductDetails = "Tastes bad"
            };

            Product_Details PD1 = new Product_Details
            {
                Product        = Bread,
                ProductDetails = "White"
            };

            Curry.Details = new List <Product_Details>();
            Bread.Details = new List <Product_Details>();
            Curry.Details.Add(PD0);
            Bread.Details.Add(PD1);
            PD0.Product = Curry;
            PD1.Product = Bread;

            Text CurryText = new Text
            {
                Content       = "Bla Bla Pizza",
                WebsitePageID = 1
            };

            Text KetchupText = new Text
            {
                Content       = "Hi Hi Hi",
                WebsitePageID = 1
            };

            Text Important = new Text
            {
                Content       = "No Live",
                WebsitePageID = null
            };

            Text Important2 = new Text
            {
                Content       = "Oh No",
                WebsitePageID = 2
            };

            Product_Text PT0 = new Product_Text
            {
                Product = Bread,
                Text    = Important
            };

            Product_Text PT1 = new Product_Text
            {
                Product = Bread,
                Text    = Important2
            };

            Product_Text PT2 = new Product_Text
            {
                Product = ChickenSticks,
                Text    = CurryText
            };

            Recipe_Text RT0 = new Recipe_Text
            {
                Recipe = Spinach,
                Text   = KetchupText
            };

            Recipe_Text RT1 = new Recipe_Text
            {
                Recipe = ChickenNoodles,
                Text   = KetchupText
            };

            Recipe_Text RT2 = new Recipe_Text
            {
                Recipe = ChickenNoodles,
                Text   = Important2
            };

            News_Item MadPizza = new News_Item
            {
                Event_Date         = new DateTime().AddYears(2020).AddMonths(11).AddDays(2),
                Title              = "MadPizza",
                Last_Modified_Date = new DateTime().AddYears(1996).AddMonths(1).AddDays(5)
            };

            News_Item HappyPizza = new News_Item
            {
                Event_Date         = new DateTime().AddYears(2020).AddMonths(11).AddDays(3),
                Title              = "HappyPizza",
                Last_Modified_Date = new DateTime().AddYears(1996).AddMonths(1).AddDays(5)
            };

            Text_News TN0 = new Text_News
            {
                News = MadPizza,
                Text = CurryText
            };

            Text_News TN1 = new Text_News
            {
                News = MadPizza,
                Text = KetchupText
            };

            Text_News TN2 = new Text_News
            {
                News = HappyPizza,
                Text = CurryText
            };

            Language NL = new Language
            {
                LangTag = "nl"
            };

            Language EN = new Language
            {
                LangTag = "en"
            };

            Language DE = new Language
            {
                LangTag = "de"
            };

            CurryText.Language   = NL;
            Important.Language   = NL;
            Important2.Language  = EN;
            KetchupText.Language = DE;

            NL.Texts = new List <Text>();
            EN.Texts = new List <Text>();
            DE.Texts = new List <Text>();
            NL.Texts.Add(CurryText);
            NL.Texts.Add(Important);
            EN.Texts.Add(Important2);
            DE.Texts.Add(KetchupText);

            News_Category Mad = new News_Category
            {
                Category = "Mad"
            };

            News_Category Happy = new News_Category
            {
                Category = "Happy"
            };

            MadPizza.News_Category   = Mad;
            HappyPizza.News_Category = Happy;
            Mad.Items   = new List <News_Item>();
            Happy.Items = new List <News_Item>();
            Mad.Items.Add(MadPizza);
            Happy.Items.Add(HappyPizza);

            Photo AA = new Photo
            {
                PhotoPath = "/Img/uknownA.img"
            };

            Photo BB = new Photo
            {
                PhotoPath = "/Img/uknownB.img"
            };

            Photo CC = new Photo
            {
                PhotoPath = "/Img/uknownC.png"
            };

            Product_Photo AAA = new Product_Photo
            {
                Product = Ketchup,
                Photo   = AA
            };

            Product_Photo BBB = new Product_Photo
            {
                Product = Curry,
                Photo   = BB
            };

            Product_Photo CCC = new Product_Photo
            {
                Product = ChickenSticks,
                Photo   = CC
            };

            Recipe_Photo RP0 = new Recipe_Photo
            {
                Recipe = ChickenWings,
                Photo  = AA
            };

            Recipe_Photo RP1 = new Recipe_Photo
            {
                Recipe = ChickenWings,
                Photo  = BB
            };

            Recipe_Photo RP2 = new Recipe_Photo
            {
                Recipe = ChickenNoodles,
                Photo  = CC
            };

            Recipe_Photo RP3 = new Recipe_Photo
            {
                Recipe = ChickenNoodles,
                Photo  = AA
            };

            Photo_News PN0 = new Photo_News
            {
                Photo = AA,
                News  = MadPizza
            };

            Photo_News PN1 = new Photo_News
            {
                Photo = BB,
                News  = HappyPizza
            };

            Employee_Profile Henk = new Employee_Profile
            {
                Name = "Henk",
                Job  = "Sleeping",
                Profile_PhotoPath = "/images/Henk.png",
                CountryOrProvince = "Zuid-Holland",
                Region            = "Netherlands"
            };

            Employee_Profile Johan = new Employee_Profile
            {
                Name = "Johan",
                Job  = "Sales",
                Profile_PhotoPath = "/images/Johan.png",
                CountryOrProvince = "South-Africa",
                Region            = "Africa"
            };

            Employee_Profile Marit = new Employee_Profile
            {
                Name = "Marit",
                Job  = "ICT",
                Profile_PhotoPath = "/images/Marit.png"
            };

            Employee_Profile_Email EHenk = new Employee_Profile_Email
            {
                Email = "*****@*****.**"
            };

            Employee_Profile_Email EJohan = new Employee_Profile_Email
            {
                Email = "*****@*****.**"
            };

            Employee_Profile_Email EMarit = new Employee_Profile_Email
            {
                Email = "*****@*****.**"
            };

            Employee_Profile_Email EMarit2 = new Employee_Profile_Email
            {
                Email = "*****@*****.**",
            };

            EMarit.Employee  = Marit;
            EMarit2.Employee = Marit;
            EHenk.Employee   = Henk;
            EJohan.Employee  = Johan;
            Marit.Emails     = new List <Employee_Profile_Email>();
            Henk.Emails      = new List <Employee_Profile_Email>();
            Johan.Emails     = new List <Employee_Profile_Email>();
            Marit.Emails.Add(EMarit);
            Marit.Emails.Add(EMarit2);
            Henk.Emails.Add(EHenk);
            Johan.Emails.Add(EJohan);

            Employee_Profile_Phone_Number N0 = new Employee_Profile_Phone_Number
            {
                Number = "3160000000000"
            };

            Employee_Profile_Phone_Number N1 = new Employee_Profile_Phone_Number
            {
                Number = "3160000000001"
            };

            N0.Employee        = Henk;
            N1.Employee        = Henk;
            Henk.Phone_Numbers = new List <Employee_Profile_Phone_Number>();
            Henk.Phone_Numbers.Add(N0);
            Henk.Phone_Numbers.Add(N1);

            Subscriber Sleep = new Subscriber
            {
                Email = "*****@*****.**"
            };

            Subscriber Pizza = new Subscriber
            {
                Email = "*****@*****.**"
            };

            C.Branch_Categories.Add(Chicken);
            C.Branch_Categories.Add(Pork);
            C.Branch_Categories.Add(Fruit);
            C.Type_Categories.Add(ChickenSoup);
            C.Type_Categories.Add(ChickenEgg);
            C.Normal_Categories.Add(SaltChicken);
            C.Normal_Categories.Add(SweetChicken);
            C.Normal_Categories.Add(NoChicken);
            C.Normal_Categories.Add(GingerChicken);
            C.Recipes.Add(ChickenWings);
            C.Recipes.Add(ChickenNoodles);
            C.Recipes.Add(Spinach);
            C.TypeCategory_Recipes.Add(SpinachSoup);
            C.TypeCategory_Recipes.Add(ChickenRecipe);
            C.TypeCategory_Recipes.Add(ChickenRecipe2);
            C.Products.Add(ChickenSticks);
            C.Products.Add(Ketchup);
            C.Products.Add(Curry);
            C.Products.Add(Bread);
            C.NormalCategory_Products.Add(ZeroChickenGiven);
            C.NormalCategory_Products.Add(BreadChicken);
            C.NormalCategory_Products.Add(SaltyChicken);
            C.Product_Details.Add(PD0);
            C.Product_Details.Add(PD1);
            C.Text.Add(CurryText);
            C.Text.Add(KetchupText);
            C.Text.Add(Important);
            C.Text.Add(Important2);
            C.Product_Texts.Add(PT0);
            C.Product_Texts.Add(PT1);
            C.Product_Texts.Add(PT2);
            C.Recipe_Texts.Add(RT0);
            C.Recipe_Texts.Add(RT1);
            C.Recipe_Texts.Add(RT2);
            C.News_Items.Add(MadPizza);
            C.News_Items.Add(HappyPizza);
            C.Text_News.Add(TN0);
            C.Text_News.Add(TN1);
            C.Text_News.Add(TN2);
            C.Languages.Add(NL);
            C.Languages.Add(EN);
            C.Languages.Add(DE);
            C.News_Categories.Add(Mad);
            C.News_Categories.Add(Happy);
            C.Photos.Add(AA);
            C.Photos.Add(BB);
            C.Photos.Add(CC);
            C.Product_Photos.Add(AAA);
            C.Product_Photos.Add(BBB);
            C.Product_Photos.Add(CCC);
            C.Recipe_Photos.Add(RP0);
            C.Recipe_Photos.Add(RP1);
            C.Recipe_Photos.Add(RP2);
            C.Recipe_Photos.Add(RP3);
            C.Photo_News.Add(PN0);
            C.Photo_News.Add(PN1);
            C.Employee_Profiles.Add(Henk);
            C.Employee_Profiles.Add(Johan);
            C.Employee_Profiles.Add(Marit);
            C.Employee_Profile_Emails.Add(EHenk);
            C.Employee_Profile_Emails.Add(EJohan);
            C.Employee_Profile_Emails.Add(EMarit);
            C.Employee_Profile_Emails.Add(EMarit2);
            C.Employee_Profile_Phone_Numbers.Add(N0);
            C.Employee_Profile_Phone_Numbers.Add(N1);
            C.Subscribers.Add(Sleep);
            C.Subscribers.Add(Pizza);

            C.SaveChanges();
        }
示例#9
0
        public Employee_Profile GetContact()
        {
            Employee_Profile contact = _context.Employee_Profiles.FirstOrDefault();

            return(contact);
        }
示例#10
0
        public ActionResult HireProcess()
        {
            //ViewBag.idemp = id2;
            //var ID = int.Parse(id2);
            //var addmodel1 = dbcontext.Employee_Qualification_Profile.ToList();
            //var tr = 0;

            //if (addmodel1.Count() == 0)
            //{
            //    tr = 1;
            //}
            //else
            //{
            //    var te = addmodel1.LastOrDefault().ID;
            //    tr = te + 1;
            //}
            //DateTime statis = Convert.ToDateTime("1/1/1900");
            //var strus = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Personnel);
            //var text = new Employee_Qualification_Profile
            //{ Employee_ProfileId = emp.ID.ToString(), Code = strus.Structure_Code + tr.ToString(), Qualification_start_date = statis, Qualification_end_date = statis };
            //var e = dbcontext.Employee_Qualification_Profile.Add(text);
            //dbcontext.SaveChanges();

            //emp.Employee_Qualification_Profile = e;
            //dbcontext.SaveChanges();
            var Applicant_Profile = dbcontext.Applicant_Profile.ToList();
            var Application       = dbcontext.Application.FirstOrDefault(a => a.Applicant_ProfileId == a.Applicant_Profile.ID.ToString());

            var Employee_Profile = dbcontext.Employee_Profile.ToList();
            var tr = 0;

            if (Employee_Profile.Count() == 0)
            {
                tr = 1;
            }
            else
            {
                var te = Employee_Profile.LastOrDefault().ID;
                tr = te + 1;
            }
            DateTime statis = DateTime.Now;
            var      strus  = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Personnel);

            var Ability = new Ability {
                registration_date = statis
            };
            var Personnel_Information = new Personnel_Information {
                Hire_Date = statis, Join_Date = statis, Boarding_Date = statis, Sector_Join_Date = statis, Social_Insurance_Date = statis
            };
            var Service_Information = new Service_Information {
                EOS_date = statis, Last_working_date = statis, Retired_expected_EOS = statis
            };

            var ab  = dbcontext.Ability.Add(Ability);
            var per = dbcontext.Personnel_Information.Add(Personnel_Information);
            var ser = dbcontext.Service_Information.Add(Service_Information);

            dbcontext.SaveChanges();
            var emp = new Employee_Profile {
                ID = Employee_Profile.LastOrDefault().ID, Code = strus.Structure_Code + tr.ToString(), Name = Application.Applicant_Profile.Name, Full = Application.Applicant_Profile.Full, Full_Name = Application.Applicant_Profile.Full_Name, Birth_date = Application.Applicant_Profile.Birth_date, Expire_date = Application.Applicant_Profile.Expire_date, Issue_date = Application.Applicant_Profile.Issue_date, ReligionId = Application.Applicant_Profile.ReligionId.ToString(), NationalityId = Application.Applicant_Profile.NationalityId.ToString(), Active = true, Ability = ab, Personnel_Information = per, Service_Information = ser, Surname = Application.Applicant_Profile.Surname, Sur_Name = Application.Applicant_Profile.Sur_Name
            };
            var e = dbcontext.Employee_Profile.Add(emp);

            dbcontext.SaveChanges();

            return(RedirectToAction("index"));
        }