private void LoadDropDownListPageLink() { ddlLink.Items.Clear(); ddlLink.Items.Add(new ListItem("Trang chủ", "/")); DataTable dt = new DataTable(); dt = GroupNewsService.GroupNews_GetByTop("", "Active=1", "Level, Ord"); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Index"].ToString() == "0") { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString()), PageHelper.GeneralGroupUrl(Consts.CON_TIN_TUC, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString()))); } else { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString()), PageHelper.GeneralGroupUrl(Consts.CON_VAN_BAN, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString()))); } } List <Data.GroupImages> listG = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Level, Ord"); if (listG.Count > 0) { for (int i = 0; i < listG.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listG[i].Name, listG[i].Level), "/thu-vien-anh/" + listG[i].Id + "/" + StringClass.NameToTag(listG[i].Name))); } } ddlLink.Items.Add(new ListItem("Liên hệ", "/lien-he")); ddlLink.Items.Add(new ListItem("Videos", "/video-hoi")); ddlLink.DataBind(); }
private void LoadDropDownListPageLink() { ddlLink.Items.Clear(); ddlLink.Items.Add(new ListItem("■Trang chủ", "/")); GroupProduct obj = new GroupProduct(); List <GroupProduct> lstGr = obj.SelectByTop("", "Active=1", "Level,Ord"); //ddlLink.Items.Add(new ListItem("■Dịch vụ", "#")); for (int i = 0; i < lstGr.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel("■" + lstGr[i].Name, lstGr[i].Level), "/" + Consts.SAN_PHAM + "/" + lstGr[i].Id + "/" + StringClass.NameToTag(lstGr[i].Name))); //List<Product> pro = Product.SelectByTop("", "Active=1 AND GroupId=" + lstGr[i].Id, "Ord"); //for (int j = 0; j < pro.Count; j++) //{ // ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(pro[j].Name, lstGr[i].Level + "00000"), StringClass.GeneralDetailUrl(Consts.SAN_PHAM, pro[j].GroupName, pro[j].Id.ToString(), pro[j].Name))); //} } List <GroupNews> listN = GroupNews.SelectByTop("", "Active=1", "Level, Ord"); //ddlLink.Items.Add(new ListItem("■Tin tức", "#")); // if (listN.Count > 0) // { // for (int i = 0; i < listN.Count; i++) // { // ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listN[i].Name, listN[i].Level + "00000"), "/" + Consts.TIN_TUC + "/" + listN[i].Id + "/" + StringClass.NameToTag(listN[i].Name))); // } // } ddlLink.Items.Add(new ListItem("■Liên hệ", "/lien-he")); ddlLink.DataBind(); }
public ActionResult MenuAddSub() { var module = db.GroupProducts.OrderBy(m => m.Level).ToList(); var groupnews = db.GroupNews.OrderBy(m => m.Level).ToList(); List <SelectListItem> listpage = new List <SelectListItem>(); listpage.Clear(); for (int i = 0; i < module.Count; i++) { listpage.Add(new SelectListItem { Text = "Nhóm sản phẩm - " + StringClass.ShowNameLevel(module[i].Name, module[i].Level), Value = "/danh-muc/" + module[i].Tag.ToString() }); } for (int j = 0; j < groupnews.Count; j++) { listpage.Add(new SelectListItem { Text = "Nhóm tin tức - " + StringClass.ShowNameLevel(groupnews[j].Name, groupnews[j].Level), Value = "/danh-muc-tin/" + groupnews[j].Tag.ToString() }); } ViewBag.LinkModule = listpage; ViewBag.Position = new SelectList(ShowPosition(), "value", "text"); ViewBag.Target = new SelectList(ShowTarget(), "value", "text"); ViewBag.Type = new SelectList(ShowType(), "value", "text"); ViewBag.LinkDDL = new SelectList(ShowLinkDDL(), "value", "text"); return(View()); }
protected void Page_Load(object sender, EventArgs e) { try { id = BizUtils.GetQueryString("Id", Request); if (!IsPostBack) { GroupProduct objGr = new GroupProduct(); List <GroupProduct> lstGr = objGr.SelectByTop("", "Active = 1 AND Position = 1", "Level, Ord"); ddlGroup.Items.Clear(); ddlGroup.Items.Add(new ListItem("--Chọn nhóm dịch vụ--", "")); for (int i = 0; i < lstGr.Count; i++) { objGr = lstGr[i]; ddlGroup.Items.Add(new ListItem(StringClass.ShowNameLevel(objGr.Name, objGr.Level), objGr.Id.ToString())); } ddlGroup.DataBind(); if (id != string.Empty) { btnUpdate_T.Visible = true; btnUpdate_B.Visible = true; btnAdd_B.Visible = false; btnAdd_T.Visible = false; Product objPr = new Product(); objPr.Id = int.Parse(id); objPr = objPr.SelectById(); txtName.Value = objPr.Name; txtImage1.Value = objPr.Image1; imgImage1.ImageUrl = objPr.Image1; txtImage2.Value = objPr.Image2; imgImage2.ImageUrl = objPr.Image2; txtImage3.Value = objPr.Image3; imgImage3.ImageUrl = objPr.Image3; txtImage4.Value = objPr.Image4; imgImage4.ImageUrl = objPr.Image4; txtContent.Value = objPr.Content; ddlGroup.Value = objPr.GroupId.ToString(); fckDetail.Value = objPr.Detail; txtKeywords.Value = objPr.Keywords; txtDescription.Value = objPr.Description; chkPopular.Checked = objPr.IsPopular == 1; txtOrd.Value = objPr.Ord.ToString(); chkActive.Checked = objPr.Active == 1; lblTitle.Text = "Cập nhật dịch vụ"; } else { txtOrd.Value = Config.GetMaxOrd("Product", ""); } } } catch (Exception) { throw; } }
public ActionResult MenuEdit(int id) { if (Request.Cookies["Username"] != null) { string Lang = Session["Lang"].ToString(); var menu = db.Menus.Find(id); var module = db.GroupProducts.OrderBy(m => m.Level).ToList(); var groupnews = db.GroupNews.Where(x => x.Lang == Lang).OrderBy(m => m.Level).ToList(); List <SelectListItem> listpage = new List <SelectListItem>(); listpage.Clear(); for (int i = 0; i < module.Count; i++) { listpage.Add(new SelectListItem { Text = "Nhóm sản phẩm - " + StringClass.ShowNameLevel(module[i].Name, module[i].Level), Value = "/danh-muc/" + module[i].Tag.ToString() }); } for (int j = 0; j < groupnews.Count; j++) { listpage.Add(new SelectListItem { Text = "Nhóm tin tức - " + StringClass.ShowNameLevel(groupnews[j].Name, groupnews[j].Level), Value = "/danh-muc-tin/" + groupnews[j].Tag.ToString() }); } var menuList = db.Menus.Where(x => x.Lang == Lang).OrderBy(m => m.Level).ToList(); foreach (var item in menuList) { item.Name = StringClass.ShowNameLevel(item.Name, item.Level); } if (menu.Level.Length > 5) { string t = menu.Level.Substring(0, menu.Level.Length - 5); ViewBag.lstMenu = new SelectList(menuList, "Level", "Name", t); } else { ViewBag.lstMenu = new SelectList(menuList, "Level", "Name"); } //ViewBag.lstMenu = lstMenu; ViewBag.LinkModule = listpage; ViewBag.LinkDDL = new SelectList(ShowLinkDDL(), "value", "text"); ViewBag.PageTypeDDL = new SelectList(PageTypeDDL(), "value", "text"); ViewBag.Position = new SelectList(ShowPosition(), "value", "text"); ViewBag.Target = new SelectList(ShowTarget(), "value", "text"); ViewBag.Type = new SelectList(ShowType(), "value", "text"); return(View(menu)); } else { return(Redirect("/Admins/admins")); } }
public ActionResult CreateSub(string level) { var priceCities = db.PriceCities.OrderBy(p => p.Level).ToList(); foreach (var item in priceCities) { item.Name = StringClass.ShowNameLevel(item.Name, item.Level); } ViewBag.PriceCity = new SelectList(priceCities, "Level", "Name", level); return(View()); }
public ActionResult MenuCreate() { string Lang = Session["Lang"].ToString(); var module = db.GroupProducts.OrderBy(m => m.Level).ToList(); var groupnews = db.GroupNews.Where(x => x.Lang == Lang).OrderBy(m => m.Level).ToList(); List <SelectListItem> listpage = new List <SelectListItem>(); listpage.Clear(); for (int i = 0; i < module.Count; i++) { listpage.Add(new SelectListItem { Text = "Nhóm sản phẩm - " + StringClass.ShowNameLevel(module[i].Name, module[i].Level), Value = "/danh-muc/" + module[i].Tag.ToString() }); } for (int j = 0; j < groupnews.Count; j++) { listpage.Add(new SelectListItem { Text = "Nhóm tin tức - " + StringClass.ShowNameLevel(groupnews[j].Name, groupnews[j].Level), Value = "/danh-muc-tin/" + groupnews[j].Tag.ToString() }); } var menuModel = db.Menus.Where(x => x.Lang == Lang).OrderBy(m => m.Level).ToList(); List <SelectListItem> lstMenu = new List <SelectListItem>(); lstMenu.Clear(); for (int i = 0; i < menuModel.Count; i++) { if (menuModel[i].Level.Length == 5) { lstMenu.Add(new SelectListItem { Text = StringClass.ShowNameLevel(menuModel[i].Name, menuModel[i].Level), Value = menuModel[i].Level.ToString() }); } else { lstMenu.Add(new SelectListItem { Text = StringClass.ShowNameLevel(menuModel[i].Name, menuModel[i].Level), Value = menuModel[i].Level.ToString() }); } } ViewBag.lstMenu = lstMenu; ViewBag.LinkModule = listpage; ViewBag.LinkDDL = new SelectList(ShowLinkDDL(), "value", "text"); ViewBag.PageTypeDDL = new SelectList(PageTypeDDL(), "value", "text"); ViewBag.Position = new SelectList(ShowPosition(), "value", "text"); ViewBag.Target = new SelectList(ShowTarget(), "value", "text"); ViewBag.Type = new SelectList(ShowType(), "value", "text"); return(View()); }
protected void Page_Load(object sender, EventArgs e) { try { id = BizUtils.GetQueryString("Id", Request); if (!IsPostBack) { GroupImages objGr = new GroupImages(); List <GroupImages> lstGr = GroupImages.SelectByTop("", "Active = 1", "Level, Ord"); ddlGroup.Items.Clear(); ddlGroup.Items.Add(new ListItem("--Chọn nhóm hình ảnh--", "")); for (int i = 0; i < lstGr.Count; i++) { objGr = lstGr[i]; ddlGroup.Items.Add(new ListItem(StringClass.ShowNameLevel(objGr.Name, objGr.Level), objGr.Id.ToString())); } ddlGroup.DataBind(); if (id != string.Empty) { btnUpdate_T.Visible = true; btnUpdate_B.Visible = true; btnAdd_B.Visible = false; btnAdd_T.Visible = false; Images objPr = new Images(); objPr.Id = int.Parse(id); objPr = objPr.SelectById(); txtName.Value = objPr.Thumbnail; txtImage.Value = objPr.Image; imgImage.ImageUrl = objPr.Image; ddlGroup.Value = objPr.GroupId.ToString(); chkPriority.Checked = objPr.Priority == 1; txtOrd.Value = objPr.Ord.ToString(); chkActive.Checked = objPr.Active == 1; lblTitle.Text = "Cập nhật hình ảnh"; } else { txtOrd.Value = Config.GetMaxOrd("Images", ""); } } } catch (Exception) { throw; } }
public ActionResult PriceCityCreate() { var priceCities = db.PriceCities.OrderBy(p => p.Level).ToList(); List <SelectListItem> listPriceCity = new List <SelectListItem>(); listPriceCity.Clear(); for (int i = 0; i < priceCities.Count; i++) { listPriceCity.Add(new SelectListItem { Text = StringClass.ShowNameLevel(priceCities[i].Name, priceCities[i].Level), Value = priceCities[i].Level.ToString() }); } ViewBag.PriceCity = listPriceCity; return(View()); }
private void LoadDropDownListPageLink() { ddlLink.Items.Clear(); ddlLink.Items.Add(new ListItem("Trang chủ", "/")); DataTable dt = new DataTable(); dt = GroupNewsService.GroupNews_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Tin tức", "#")); for (int i = 0; i < dt.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString() + "00000"), PageHelper.GeneralGroupUrl(Consts.CON_TIN_TUC, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString()))); } List <Data.GroupImages> listG = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Hình ảnh", "#")); if (listG.Count > 0) { for (int i = 0; i < listG.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listG[i].Name, listG[i].Level + "00000"), "/Thu-vien-anh/" + listG[i].Id + "/" + StringClass.NameToTag(listG[i].Name))); } } DataTable listGProduct = GroupProductService.GroupProduct_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Sản phẩm", "#")); if (listGProduct.Rows.Count > 0) { for (int i = 0; i < listGProduct.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listGProduct.Rows[i]["Name"].ToString(), listGProduct.Rows[i]["Level"].ToString() + "00000"), PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listGProduct.Rows[i]["Id"].ToString(), listGProduct.Rows[i]["Name"].ToString()))); } } DataTable listChude = ChudeService.Chude_GetByTop("", "Active=1", "Ord"); ddlLink.Items.Add(new ListItem("Chủ đề", "#")); if (listChude.Rows.Count > 0) { for (int i = 0; i < listChude.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listChude.Rows[i]["Name"].ToString(), "0000000000"), "/chu-de/chu-de-" + listChude.Rows[i]["Id"].ToString() + "/" + StringClass.NameToTag(listChude.Rows[i]["Name"].ToString()))); } } ddlLink.Items.Add(new ListItem("Liên hệ", "/lien-he")); ddlLink.DataBind(); }
public static List <DropDownList> showlistPagerodule() { ModeoutleddbContext db = new ModeoutleddbContext(); var listg = db.Menus.OrderByDescending(m => m.Level).ToList(); List <DropDownList> list = new List <DropDownList>(); //list.Add(new DropDownList { value = "", text = "Trang chủ" }); if (listg.Count > 0) { for (int i = 0; i < listg.Count; i++) { list.Add(new DropDownList { value = listg[i].Link, text = StringClass.ShowNameLevel(listg[i].Name, listg[i].Level) }); } } //list.Add(new DropDownList { value = "/thu-vien/", text = "Tài liệu" }); //list.Add(new DropDownList { value = "/hoc-cung-doanh-nghiep/", text = "Liên hệ" }); //list.Add(new DropDownList { value = "/dang-ky-online/", text = "Đăng ký Online" }); return(list); }
private List <SelectListItem> listDropDownList() { List <SelectListItem> listpage = new List <SelectListItem>(); listpage.Clear(); var list = db.Menus.OrderBy(m => m.Level).ToList(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { listpage.Add(new SelectListItem { Text = StringClass.ShowNameLevel(list[i].Name, list[i].Level), Value = "/sanpham/sp/" + StringClass.NameToTag(list[i].Name) + "/" }); } } //listpage.Add(new SelectListItem { Text = "Tài liệu", Value = "/thu-vien/" }); //listpage.Add(new SelectListItem { Text = "Liên hệ", Value = "/hoc-cung-doanh-nghiep/" }); //listpage.Add(new SelectListItem { Text = "Đăng ký Online", Value = "/dang-ky-online/" }); return(listpage); }
public ActionResult PriceCityEdit(int id) { var priceCity = db.PriceCities.Find(id); var priceCities = db.PriceCities.OrderBy(p => p.Level).ToList(); foreach (var item in priceCities) { item.Name = StringClass.ShowNameLevel(item.Name, item.Level); } if (priceCity.Level.Length > 5) { string parentLevel = priceCity.Level.Substring(0, priceCity.Level.Length - 5); ViewBag.PriceCity = new SelectList(priceCities, "Level", "Name", parentLevel); } else { ViewBag.PriceCity = new SelectList(priceCities, "Level", "Name"); } return(View(priceCity)); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { GroupProduct objGr = new GroupProduct(); List <GroupProduct> lstGr = objGr.SelectByTop("", "Active = 1 AND Position = 0", "Level, Ord"); ddlGroup.Items.Clear(); ddlGroup.Items.Add(new ListItem("--Chọn nhóm sản phẩm--", "")); for (int i = 0; i < lstGr.Count; i++) { objGr = lstGr[i]; ddlGroup.Items.Add(new ListItem(StringClass.ShowNameLevel(objGr.Name, objGr.Level), objGr.Id.ToString())); } ddlGroup.DataBind(); BinData(); } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { id = BizUtils.GetQueryString("Id", Request); if (!IsPostBack) { GroupNews objGr = new GroupNews(); List <GroupNews> lstGr = GroupNews.SelectByTop("", "Active = 1", "Level, Ord"); ddlGroup.Items.Clear(); ddlGroup.Items.Add(new ListItem("--Chọn nhóm tin tức--", "")); for (int i = 0; i < lstGr.Count; i++) { objGr = lstGr[i]; ddlGroup.Items.Add(new ListItem(StringClass.ShowNameLevel(objGr.Name, objGr.Level), objGr.Id.ToString())); } ddlGroup.DataBind(); Product objPro = new Product(); List <Product> lstPro = Product.SelectByTop("", "Active = 1", "Ord"); ddlService.Items.Clear(); for (int i = 0; i < lstPro.Count; i++) { objPro = lstPro[i]; ddlService.Items.Add(new ListItem(objPro.Name, objPro.Id.ToString())); } ddlService.DataBind(); if (id != string.Empty) { btnUpdate_T.Visible = true; btnUpdate_B.Visible = true; btnAdd_B.Visible = false; btnAdd_T.Visible = false; News objPr = new News(); objPr.Id = int.Parse(id); objPr = objPr.SelectById(); txtName.Value = objPr.Name; txtImage.Value = objPr.Image; imgImage.ImageUrl = objPr.Image; txtContent.Value = objPr.Content; fckDetail.Value = objPr.Detail; ddlGroup.Value = objPr.GroupNewsId.ToString(); foreach (ListItem item in ddlService.Items) { if (objPr.LinkDemo.Contains(item.Value.Replace("'", ""))) { item.Selected = true; } } txtKeywords.Value = objPr.Keyword; txtDescription.Value = objPr.Description; chkPriority.Checked = objPr.Priority == 1; txtOrd.Value = objPr.Ord.ToString(); chkActive.Checked = objPr.Active == 1; lblTitle.Text = "Cập nhật tin tức"; } else { txtOrd.Value = Config.GetMaxOrd("News", ""); } } } catch (Exception) { throw; } }