public ActionResult WantJob() { if (Session["NewUser"] != null) { WantJobList JobList = new WantJobList(); JobList.WantList = new List<WantJobModel>(); UI.Utility.WantJob WantJobCulture = new Utility.WantJob(); var SubjectParent = DbEntities.Subjects.Where(p => p.ParentId == null); foreach (var TempParent in SubjectParent) { WantJobModel WantJob = new WantJobModel(); WantJob.SubjectsList = new List<Subjects>(); WantJob.ID = TempParent.ID; //WantJob.Name = TempParent.Name; WantJob.Name = WantJobCulture.GetItem(TempParent.ID); var SubjectSub = DbEntities.Subjects.Where(p => p.ParentId == TempParent.ID); foreach (var TempSub in SubjectSub) { Subjects TempSubject = new Subjects(); TempSubject.ID = TempSub.ID; TempSubject.Name = WantJobCulture.GetItem(TempSub.ID); TempSubject.ParentId = TempSub.ParentId; WantJob.SubjectsList.Add(TempSubject); } JobList.WantList.Add(WantJob); } return View(JobList); } else { return RedirectToAction("LogIn", "Account"); } }
public ActionResult WorkerIndex() { if (Session["UserLogin"] != null) { var UserInfo = (DAL.UserInfo)Session["UserLogin"]; BLL.MdPassWord DESPassWord = new BLL.MdPassWord(); ViewModels.WorkerInfo CurrentWorker = new ViewModels.WorkerInfo(); ViewModels.WorkerModel WorkerInfo = new ViewModels.WorkerModel(); WorkerInfo.UserID = UserInfo.UserID; WorkerInfo.FirstName = UserInfo.FirstName; WorkerInfo.LastName = UserInfo.LastName; WorkerInfo.Email = UserInfo.Email; ViewData["CountryName"] = DbEntities.Country.SingleOrDefault(p => p.CountryID == UserInfo.CountryID).CountryName; WorkerInfo.UserName = UserInfo.UserName; ViewData["PassWord"] = DESPassWord.Decrypt(UserInfo.PassWord); switch (UserInfo.How) { case 0: ViewData["HowHear"] = Internationalization.Resources.Select; break; case 1: ViewData["HowHear"] = Internationalization.Resources.Blog; break; case 2: ViewData["HowHear"] = Internationalization.Resources.Conference; break; case 3: ViewData["HowHear"] = Internationalization.Resources.Coworker; break; case 4: ViewData["HowHear"] = Internationalization.Resources.Facebook; break; case 5: ViewData["HowHear"] = Internationalization.Resources.Friend; break; case 6: ViewData["HowHear"] = Internationalization.Resources.Linkedln; break; case 7: ViewData["HowHear"] = Internationalization.Resources.OnlineAdvertisement; break; case 8: ViewData["HowHear"] = Internationalization.Resources.OnlineNewsArticle; break; case 9: ViewData["HowHear"] = Internationalization.Resources.SocialMediaSite; break; case 10: ViewData["HowHear"] = Internationalization.Resources.TV; break; case 11: ViewData["HowHear"] = Internationalization.Resources.Twitter; break; case 12: ViewData["HowHear"] = Internationalization.Resources.WebSearchEngine; break; case 13: ViewData["HowHear"] = Internationalization.Resources.Other; break; } switch (UserInfo.AccountType) { case 0: ViewData["AccountType"] = Internationalization.Resources.Individual; break; case 1: ViewData["AccountType"] = Internationalization.Resources.Business; break; } WorkerInfo.DisplayName = UserInfo.DisplayName; CurrentWorker.WorkerBasic = WorkerInfo; UI.ViewModels.BasicsModel BasicsModel = new ViewModels.BasicsModel(); UI.Utility.ModelCopier.CopyModel(DbEntities.BasicsInfo.SingleOrDefault(p => p.UserId == UserInfo.UserID), BasicsModel); CurrentWorker.BasicsInfo = BasicsModel; UI.ViewModels.SkillsModel SkillsModel = new ViewModels.SkillsModel(); UI.Utility.ModelCopier.CopyModel(DbEntities.SkillsInfo.SingleOrDefault(p => p.UserId == UserInfo.UserID), SkillsModel); CurrentWorker.SkillsInfo = SkillsModel; if (CurrentWorker.BasicsInfo != null) { var TempCountry = DbEntities.Country.FirstOrDefault(p => p.CountryID == CurrentWorker.BasicsInfo.CountryId); if (TempCountry != null) { ViewData["CountryInfo"] = TempCountry.CountryName; } var TempNumber = DbEntities.PhoneNumber.FirstOrDefault(p => p.PhoneNumberID == CurrentWorker.BasicsInfo.PhoneNumberId); if (TempNumber != null) { ViewData["PhoneNumber"] = TempNumber.PhoneNumberName; } } CurrentWorker.JobList = new ViewModels.WantJobList(); CurrentWorker.JobList.WantList = new List<ViewModels.WantJobModel>(); var CurrentWant = DbEntities.WantJob.Where(p => p.WorkerID == UserInfo.UserID); UI.Utility.WantJob WantJobCulture = new Utility.WantJob(); foreach (var CurrentTemp in CurrentWant) { var CurrentSubject = DbEntities.Subjects.SingleOrDefault(p => p.ID == CurrentTemp.SubjectsID); if (CurrentSubject != null && CurrentSubject.ParentId == null) { ViewModels.WantJobModel WantJob = new ViewModels.WantJobModel(); WantJob.SubjectsList = new List<Subjects>(); WantJob.ID = CurrentSubject.ID; WantJob.Name = WantJobCulture.GetItem(CurrentSubject.ID); var SubjectSub = DbEntities.Subjects.Where(p => p.ParentId == CurrentSubject.ID); foreach (var TempSub in SubjectSub) { Subjects TempSubject = new Subjects(); TempSubject.ID = TempSub.ID; TempSubject.Name = WantJobCulture.GetItem(TempSub.ID); TempSubject.ParentId = TempSub.ParentId; WantJob.SubjectsList.Add(TempSubject); } CurrentWorker.JobList.WantList.Add(WantJob); } } return View(CurrentWorker); } else { return RedirectToAction("LogIn", "Account"); } }