public ActionResult ShowIndustryWiseAssociate(string PromotionID) { PromotionLibraryDAO obj = new PromotionLibraryDAO(); int plId = Convert.ToInt32(PromotionID); TempData["PLibraryID"] = plId.ToString(); List<PromotionLibraryDAO.SelectListItem> Industrieslist = new List<PromotionLibraryDAO.SelectListItem>(); var _industries = (from p in db.Industries select new { p.IndustriesID, p.IndustriesName }).AsEnumerable(); Industrieslist.Add(new PromotionLibraryDAO.SelectListItem() { Text = "Select Industry", Value = 0 }); foreach (var item in _industries) { Industrieslist.Add(new PromotionLibraryDAO.SelectListItem() { Text = item.IndustriesName, Value = item.IndustriesID }); } obj.IndustriesListModel = Industrieslist; return View(obj); }
public ActionResult PromotionLibraryForm() { List<PromotionLibraryDAO> listResult = new List<PromotionLibraryDAO>(); PromotionLibraryDAO _objPl = new PromotionLibraryDAO(); List<PromotionLibraryDAO.SelectListItem> Industrieslist = new List<PromotionLibraryDAO.SelectListItem>(); var _industries = (from p in db.Industries select new { p.IndustriesID, p.IndustriesName }).AsEnumerable(); foreach (var item in _industries) { Industrieslist.Add(new PromotionLibraryDAO.SelectListItem() { Text = item.IndustriesName, Value = item.IndustriesID }); } _objPl.IndustriesListModel = Industrieslist; string Uid = Request.Cookies["UserId"].Value; int uid = Convert.ToInt32(Uid); var uName =(from c in db.RegisterUsers where c.Id==uid select c.UserNo).FirstOrDefault(); // HttpCookie userNameCookies = new HttpCookie("UserId"); //userNameCookies.Value = "asad"; if (!string.IsNullOrEmpty(uName)) { var userdetails = (from t in db.RegisterUsers join proj in db.WorldRefExcelDataProjects on t.Id equals proj.userid where t.UserNo == uName select new { t.Email, proj.CustomerName, t.Industries, t.phone, t.ProfileAttach }).Distinct().AsEnumerable(); foreach (var project in userdetails) { listResult.Add(new PromotionLibraryDAO() { PEmailId = project.Email, PContactNumber = project.phone, CertificateName = project.CustomerName, IndustriesName = project.Industries, PCompanyProfile = project.ProfileAttach }); } _objPl.details = listResult; _objPl.PEmailId = _objPl.details[0].PEmailId.ToString(); _objPl.PName = _objPl.details[0].CertificateName.ToString(); _objPl.PContactNumber = _objPl.details[0].PContactNumber.ToString(); _objPl.PCompanyProfile = _objPl.details[0].PCompanyProfile.ToString(); } return View(_objPl); }