示例#1
0
        /// <summary>
        /// 类别
        /// </summary>
        /// <param name="newsType"></param>
        /// <returns></returns>
        protected string GetNewsTypeParent(object newsType, object id)
        {
            //
            NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(newsType));

            if (nt != null)
            {
                if (nt.parentId != 0)
                {
                    nt = NewsTypeService.GetModel(nt.parentId);
                    if (nt.parentId == 5)
                    {
                        return("otherInfo.aspx?typeId=5&id=" + id);
                    }
                    else
                    {
                        return("info.aspx?typeId=" + nt.parentId + "&id=" + id);
                    }
                }
                else
                {
                    if (nt.id == 1)
                    {
                        return("info.aspx?typeId=" + nt.id + "&id=" + id);
                    }
                }
            }
            return("");
        }
示例#2
0
        /// <summary>
        /// 资讯类别名称
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        protected string GetNewsType(object typeId)
        {
            NewsType item = NewsTypeService.GetModel(Convert.ToInt32(typeId));

            if (item != null)
            {
                string sonName = item.name;
                item = NewsTypeService.GetModel(item.parentId);
                if (item != null)
                {
                    if (item.parentId == 5)
                    {
                        return(item.name + "-" + sonName);
                    }
                    return(item.name);
                }
                else
                {
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
示例#3
0
        /// <summary>
        /// 资讯类别名称
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        protected string GetNewsInfo(object typeId, int num)
        {
            News item = NewsService.GetModel(Convert.ToInt32(typeId));

            if (item != null)
            {
                if (num == 1)
                {
                    return(item.title);
                }
                else
                {
                    NewsType nt = NewsTypeService.GetModel(item.newsType);
                    if (nt != null)
                    {
                        return(nt.name);
                    }
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
示例#4
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;
                if (item.newsType == 1)
                {
                }
                else
                {
                    NewsType nt = NewsTypeService.GetModel(item.newsType);
                    if (nt != null)
                    {
                        ddlCate.SelectedValue = item.newsType.ToString();
                    }
                    else
                    {
                        ddlCate.SelectedValue = item.newsType.ToString();
                    }
                }

                lblURL.Text          = item.newImg;
                ViewState["addTime"] = item.addTime;
            }
        }
示例#5
0
        /// <summary>
        /// 获取模块名称
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        protected string GetModule(object status)
        {
            NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(status));

            if (nt != null)
            {
                return(nt.name);
            }
            return("");
        }
示例#6
0
        /// <summary>
        /// 获取父类名称
        /// </summary>
        /// <param name="parentId"></param>
        /// <returns></returns>
        protected string GetParent(object parentId)
        {
            NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(parentId));

            if (nt != null && nt.parentId == 5)
            {
                return(nt.name);
            }
            return("");
        }
示例#7
0
        /// <summary>
        /// 获取父类名称
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        protected string GetParentName(object pid)
        {
            NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(pid));

            if (nt != null)
            {
                return(nt.name);
            }
            return("<span style='color:red;'>根分类</span>");
        }
示例#8
0
        /// <summary>
        /// 资讯类别名称
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        protected string GetNewsType(object typeId)
        {
            NewsType item = NewsTypeService.GetModel(Convert.ToInt32(typeId));

            if (item != null)
            {
                return(item.name);
            }
            else
            {
                return("");
            }
        }
示例#9
0
        /// <summary>
        /// 资讯类型
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        protected int GetType(object typeId)
        {
            NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(typeId));

            if (nt.parentId == 69)
            {
                return(nt.parentId);
            }
            nt = NewsTypeService.GetModel(nt.parentId);
            if (nt.parentId == 5)
            {
                return(nt.parentId);
            }
            return(Convert.ToInt32(typeId));
        }
示例#10
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;
            }
        }
示例#11
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);
         NewsTypeService.Delete(id);
         sp.InitBindData(this.repInfo, pager1, "NewsType", "id", sear());
     }
     if (e.CommandName.Equals("mod"))
     {
         this.hidId.Value = e.CommandArgument.ToString();
         NewsType nt = NewsTypeService.GetModel(Convert.ToInt32(e.CommandArgument));
         if (nt != null)
         {
             ddlParent.SelectedValue = nt.parentId.ToString();
             txtTitle.Text           = nt.name;
             txtOrder.Text           = nt.status.ToString();
             lblImg.Text             = nt.remark;
         }
     }
 }