Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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;
            }
        }