Пример #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();
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    GroupNews objGr = new GroupNews();
                    objGr.Name        = txtName.Value.Trim();
                    objGr.Image       = "";
                    objGr.Level       = level + "00000";
                    objGr.Index       = 1;
                    objGr.Keyword     = txtKeywords.Value.Trim();
                    objGr.Description = txtDescription.Value.Trim();
                    objGr.Ord         = txtOrd.Value.Trim() != "" ? int.Parse(txtOrd.Value.Trim()) : 1;
                    objGr.Active      = chkActive.Checked ? 1 : 0;

                    if (id != string.Empty)
                    {
                        objGr.Id = int.Parse(id);
                        objGr.Update();
                    }
                    else
                    {
                        objGr.Insert();
                    }
                    Response.Redirect("GroupNewsList.aspx", false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id    = BizUtils.GetQueryString("Id", Request);
            level = BizUtils.GetQueryString("Level", Request);
            if (!IsPostBack)
            {
                if (id != string.Empty)
                {
                    btnUpdate_T.Visible = true;
                    btnUpdate_B.Visible = true;
                    btnAdd_B.Visible    = false;
                    btnAdd_T.Visible    = false;

                    GroupNews objGr = new GroupNews();
                    objGr.Id             = int.Parse(id);
                    objGr                = objGr.SelectById();
                    txtName.Value        = objGr.Name;
                    txtKeywords.Value    = objGr.Keyword;
                    txtDescription.Value = objGr.Description;
                    txtOrd.Value         = objGr.Ord.ToString();
                    chkActive.Checked    = objGr.Active == 1;
                    lblTitle.Text        = "Cập nhật nhóm tin tức";
                }
                else
                {
                    txtOrd.Value = Config.GetMaxOrd("GroupNews", level, true);
                }
            }
        }
Пример #4
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;
            }
        }
Пример #5
0
 public static bool GroupNews_Update(GroupNews data)
 {
     return(db.GroupNews_Update(data));
 }
Пример #6
0
 public static bool GroupNews_Insert(GroupNews data)
 {
     return(db.GroupNews_Insert(data));
 }