Esempio n. 1
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            DataSet ds = NewsTypeService.GetList("parentId = 0");

            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlParent.DataSource     = ds;
                ddlParent.DataTextField  = "name";
                ddlParent.DataValueField = "id";
                ddlParent.DataBind();
            }
            ddlParent.Items.Insert(0, new ListItem("请选择", "0"));
        }
Esempio n. 2
0
        /// <summary>
        /// /分类事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlCate_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataSet ds = NewsTypeService.GetList("parentId = " + ddlCate.SelectedValue);

            ddlSon.Items.Clear();
            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlSon.DataSource     = ds;
                ddlSon.DataTextField  = "name";
                ddlSon.DataValueField = "id";
                ddlSon.DataBind();
            }
            ddlSon.Items.Insert(0, new ListItem("请选择", "0"));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取对象
        /// </summary>
        private void LoadModelInfo()
        {
            News item = NewsService.GetModel(id);

            if (item != null)
            {
                this.txtTitle.Text   = item.title;
                this.content1.Value  = item.newsContent;
                content2.Value       = item.newsDesc;
                this.txtKeyWord.Text = item.keyword;
                this.txtDesc.Text    = item.newsDesc;
                txtZhaiYao.Text      = item.pageName;
                lblIndexImg.Text     = item.author;
                NewsType nt = NewsTypeService.GetModel(item.newsType);
                if (nt != null)
                {
                    nt = NewsTypeService.GetModel(nt.parentId);
                    if (nt != null && nt.parentId == 5)
                    {
                        ddlCate.SelectedValue = nt.id.ToString();

                        DataSet ds = NewsTypeService.GetList("parentId = " + nt.id);
                        ddlSon.Items.Clear();
                        ddlSon.DataSource     = ds;
                        ddlSon.DataTextField  = "name";
                        ddlSon.DataValueField = "id";
                        ddlSon.DataBind();
                        ddlSon.Items.Insert(0, new ListItem("请选择", "0"));
                        ddlSon.SelectedValue = item.newsType.ToString();
                    }
                    else
                    {
                        ddlCate.SelectedValue = item.newsType.ToString();
                    }
                }
                else
                {
                    ddlCate.SelectedValue = item.newsType.ToString();
                }

                lblURL.Text          = item.newImg;
                ViewState["addTime"] = item.addTime;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 加载信息
        /// </summary>
        private void LoadData()
        {
            DataSet ds = FriendsInfoService.GetList("infoType = 11");

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.repInfo.DataSource = ds;
                repInfo.DataBind();
            }
            // 加载模块
            ds = NewsTypeService.GetList("parentId = 2");
            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlModule.DataSource     = ds;
                ddlModule.DataTextField  = "name";
                ddlModule.DataValueField = "id";
                ddlModule.DataBind();
            }
            ddlModule.Items.Insert(0, new ListItem("请选择", "0"));
        }
Esempio n. 5
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("del"))
            {
                int id = Convert.ToInt32(e.CommandArgument);
                LinksService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int   id   = Convert.ToInt32(e.CommandArgument);
                Links item = LinksService.GetModel(id);
                if (item != null)
                {
                    DataSet ds   = NewsTypeService.GetList(4, "parentId = 2", "id");
                    int     flag = 0;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            if (Convert.ToInt32(dr["id"]) == item.istj)
                            {
                                flag = 1;
                                break;
                            }
                        }
                    }
                    if (flag == 1)
                    {
                        ddlPlace.SelectedValue = item.istj.ToString();
                    }

                    txtLinkUrl.Text   = item.linkurl;
                    txtLinkTitle.Text = item.linktitle;
                    txtLinkName.Text  = item.linkname;
                    lblId.Text        = item.id.ToString();
                    pnlAdd.Visible    = true;
                    pnlList.Visible   = false;
                }
            }
        }