public void UpdateNews(tblNew tblnew) { _da.UpdateNews(tblnew); }
partial void DeletetblNew(tblNew instance);
public void InsertNews(tblNew tblnew) { _da.InsertNews(tblnew); }
partial void UpdatetblNew(tblNew instance);
partial void InserttblNew(tblNew instance);
public ActionResult EditNews(Guid? newsID, byte? type) { if (type.HasValue) { ViewData["CurrentType"] = type; } else { ViewData["CurrentType"] = NguyenHiep.Common.NewsTypes.News; } byte tmpType = NguyenHiep.Common.NewsTypes.News; if (type.HasValue) { tmpType = (byte)type; } #region delete if (Request["Delete"] != null) { if (newsID.HasValue && !newsID.Equals(Guid.Empty)) { _nguyenHiepService.DeleteNews((Guid)newsID); if (tmpType == NguyenHiep.Common.NewsTypes.News) { return RedirectToAction("IndexForNews"); } else if (tmpType == NguyenHiep.Common.NewsTypes.Contruction) { return RedirectToAction("IndexForContruction"); } else if (tmpType == NguyenHiep.Common.NewsTypes.HotNew) { return RedirectToAction("IndexForNews"); } else if (tmpType == NguyenHiep.Common.NewsTypes.Introduction) { return RedirectToAction("IndexForIntroduction"); } else if (tmpType == NguyenHiep.Common.NewsTypes.Recruitment) { return RedirectToAction("IndexForRecruitment"); } else if (tmpType == NguyenHiep.Common.NewsTypes.PromotionNew) { return RedirectToAction("IndexForNews"); } else { return RedirectToAction("IndexForNews"); } } } #endregion List<SelectListItem> lsEN = new List<SelectListItem>(); List<SelectListItem> lsVN = new List<SelectListItem>(); tblNew tblnew = null; if (newsID.HasValue && !newsID.Value.Equals(Guid.Empty)) { if (Request.Cookies["Culture"] != null && Request.Cookies["Culture"].Value == "en-US") { tblnew = _nguyenHiepService.GetNewsByID((Guid)newsID,true); } else { tblnew = _nguyenHiepService.GetNewsByID((Guid)newsID,false); } } #region Edit if (newsID.HasValue && !newsID.Equals(Guid.Empty) && tblnew != null) { if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.News) { lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.Contruction) { lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.HotNew) { lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.Introduction) { lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.NormalProduct) { lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.PromotionNew) { lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } else if (tblnew.Type.HasValue && tblnew.Type.Value == NewsTypes.Recruitment) { lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); } if (lsVN.Count<=0) { lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = true })); } if (lsEN.Count <= 0) { lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = false })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = false })); } if (Request.Cookies["Culture"] != null && Request.Cookies["Culture"].Value == "en-US") { ViewData["Type"] = lsEN; ViewData["ContentEN"] = tblnew.ContentEN; } else { ViewData["Type"] = lsVN; ViewData["ContentVN"] = tblnew.ContentVN; } ViewData["command"] = "upload"; return View(tblnew); } #endregion #region Add if (type.HasValue && type.Value == NewsTypes.News) { lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.Contruction) { lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.HotNew) { lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.Introduction) { lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.NormalProduct) { lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.PromotionNew) { lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString() })); } else if (type.HasValue && type.Value == NewsTypes.Recruitment) { lsVN.Add((new SelectListItem { Text = "Tuyển dụng", Value = NewsTypes.Recruitment.ToString(), Selected = true })); lsVN.Add((new SelectListItem { Text = "Công trình", Value = NewsTypes.Contruction.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin Tức", Value = NewsTypes.News.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin nóng", Value = NewsTypes.HotNew.ToString() })); lsVN.Add((new SelectListItem { Text = "Giới thiệu", Value = NewsTypes.Introduction.ToString() })); lsVN.Add((new SelectListItem { Text = "Sản phẩm", Value = NewsTypes.NormalProduct.ToString() })); lsVN.Add((new SelectListItem { Text = "Tin tức khuyến mãi", Value = NewsTypes.PromotionNew.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = "Recruitment", Value = NewsTypes.Recruitment.ToString(), Selected = true })); lsEN.Add((new SelectListItem { Text = " Construction Images", Value = NewsTypes.Contruction.ToString() })); lsEN.Add((new SelectListItem { Text = "News", Value = NewsTypes.News.ToString() })); lsEN.Add((new SelectListItem { Text = "Hot New", Value = NewsTypes.HotNew.ToString() })); lsEN.Add((new SelectListItem { Text = "About Us", Value = NewsTypes.Introduction.ToString() })); lsEN.Add((new SelectListItem { Text = "Products", Value = NewsTypes.NormalProduct.ToString() })); lsEN.Add((new SelectListItem { Text = "Promotion Program", Value = NewsTypes.PromotionNew.ToString() })); } if (Request.Cookies["Culture"] != null && Request.Cookies["Culture"].Value == "en-US") { ViewData["Type"] = lsEN; } else { ViewData["Type"] = lsVN; } ViewData["AddNews"] = true; tblnew = new tblNew(); return View(tblnew); #endregion }
public void UpdateNews(tblNew tblnew) { if (tblnew != null && tblnew.ID != null && !tblnew.ID.Equals(Guid.Empty)) { var query = _dataContext.tblNews.Where("ID.ToString()=@0", tblnew.ID.ToString()); if (query != null && query.ToList().Count > 0) { query.First().TitleVN = tblnew.TitleVN; query.First().TitleEN = tblnew.TitleEN; query.First().Type = tblnew.Type; query.First().ContentVN = tblnew.ContentVN; query.First().ContentEN = tblnew.ContentEN; query.First().Image = tblnew.Image; query.First().PostedBy = tblnew.PostedBy; query.First().SubjectEN = tblnew.SubjectEN; query.First().SubjectVN = tblnew.SubjectVN; query.First().EndedBy = tblnew.EndedBy; query.First().EndedDate = tblnew.EndedDate; _dataContext.SubmitChanges(); } } }
public void InsertNews(tblNew tblnew) { if (tblnew != null && tblnew.ID != null && !tblnew.ID.Equals(Guid.Empty)) { tblnew.PostedDate = DateTime.Now; tblnew.CreatedDate = DateTime.Now; _dataContext.tblNews.InsertOnSubmit(tblnew); _dataContext.SubmitChanges(); } }