コード例 #1
0
        private void BinData()
        {
            List <GroupProduct> lstGr = objGr.SelectByTop("", "Position = 1", "Level");

            rptData.DataSource = lstGr;
            rptData.DataBind();
        }
コード例 #2
0
ファイル: PageAdd.aspx.cs プロジェクト: thinhbv/hamsterplanet
        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();
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 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;
     }
 }