Beispiel #1
0
        /// <summary>
        /// 获取所有资讯类别列表
        /// </summary>
        /// <param name="Category"></param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.NewsStructure.NewsType> GetList(EyouSoft.Model.NewsStructure.NewsCategory?Category)
        {
            IList <EyouSoft.Model.NewsStructure.NewsType> list = new List <EyouSoft.Model.NewsStructure.NewsType>();
            StringBuilder strSql = new StringBuilder(SQL_NewsType_GetAll);

            if (Category.HasValue)
            {
                strSql.AppendFormat(" and Category={0} ", (int)Category.Value);
            }
            DbCommand dc = this._db.GetSqlStringCommand(strSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.NewsStructure.NewsType model = new EyouSoft.Model.NewsStructure.NewsType();
                    model.Id        = dr.GetInt32(dr.GetOrdinal("Id"));
                    model.ClassName = dr.IsDBNull(dr.GetOrdinal("ClassName")) ? string.Empty : dr[dr.GetOrdinal("ClassName")].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("Category")))
                    {
                        model.Category = (EyouSoft.Model.NewsStructure.NewsCategory) int.Parse(dr[dr.GetOrdinal("Category")].ToString());
                    }
                    model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.IsSystem  = dr[dr.GetOrdinal("IsSystem")].ToString() == "1" ? true : false;
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Beispiel #2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model"></param>
 /// <returns>true:成功 false:失败</returns>
 public bool Update(EyouSoft.Model.NewsStructure.NewsType model)
 {
     if (model == null)
     {
         return(false);
     }
     return(dal.Update(model));
 }
Beispiel #3
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns>true:成功 false:失败</returns>
        public virtual bool Update(EyouSoft.Model.NewsStructure.NewsType model)
        {
            DbCommand dc = this._db.GetSqlStringCommand(SQL_NewsType_Update);

            this._db.AddInParameter(dc, "ClassName", DbType.String, model.ClassName);
            this._db.AddInParameter(dc, "OperatorId", DbType.Int32, model.OperatorId);
            this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id);
            return(DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false);
        }
Beispiel #4
0
        /// <summary>
        /// 添加/编辑同业学堂类别
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSchoolAdd_Click(object sender, EventArgs e)
        {
            string cateName = txtSchoolName.Text.Replace(" ", "");

            try
            {
                bool result = false;
                newsTypeModel = new EyouSoft.Model.NewsStructure.NewsType()
                {
                    ClassName  = cateName,
                    Category   = EyouSoft.Model.NewsStructure.NewsCategory.业学堂,
                    OperatorId = base.MasterUserInfo.ID
                };
                if (btnSchoolAdd.CommandName.Equals("Add"))    //添加操作
                {
                    if (newsTypeBLL.SchoolExists(cateName, 0)) //检测类别是否存在
                    {
                        MessageBox.Show(this, "该同业学堂类别已经存在,请重新输入!!!");
                        return;
                    }
                    result = newsTypeBLL.Add(newsTypeModel);
                }
                else if (btnSchoolAdd.CommandName.Equals("Edit"))
                {
                    int ID;
                    result = int.TryParse(Request.QueryString["id"], out ID);
                    if (result)
                    {
                        if (newsTypeBLL.SchoolExists(cateName, ID))  //检测类别是否存在
                        {
                            MessageBox.Show(this, "该同业学堂类别已经存在,请重新输入!!!");
                            return;
                        }
                        newsTypeModel.Id = ID;
                        result           = newsTypeBLL.Update(newsTypeModel);
                    }
                }
                if (result)
                {
                    MessageBox.ShowAndRedirect(this, "同业学堂类别操作成功", "Category.aspx");
                }
                else
                {
                    MessageBox.Show(this, "操作失败");
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "操作失败");
            }
        }
Beispiel #5
0
        //初始化页面信息
        public void Initialize()
        {
            //获取热点资讯排行
            EyouSoft.IBLL.NewsStructure.INewsBll             bll_News = EyouSoft.BLL.NewsStructure.NewsBll.CreateInstance();
            IList <EyouSoft.Model.NewsStructure.WebSiteNews> HotList  = bll_News.GetHotNews(10);
            StringBuilder strHot = new StringBuilder();

            if (HotList != null && HotList.Count > 0)
            {
                foreach (EyouSoft.Model.NewsStructure.WebSiteNews item in HotList)
                {
                    if (item.GotoUrl.Length > 0)
                    {//含有跳转的
                        strHot.AppendFormat("<li><a href='{0}' title='{3}' target=\"_blank\" style='{2}'>{1}</a></li>", item.GotoUrl, EyouSoft.Common.Utils.GetText2(item.AfficheTitle, 16, true), "color:" + item.TitleColor, item.AfficheTitle);
                    }
                    else
                    {//不含跳转
                        strHot.AppendFormat("<li><a href='{0}' title='{3}' target=\"_blank\" style='{2}'>{1}</a></li>", EyouSoft.Common.URLREWRITE.Infomation.GetNewsDetailUrl(item.AfficheClass, item.Id), EyouSoft.Common.Utils.GetText2(item.AfficheTitle, 16, true), "color:" + item.TitleColor, item.AfficheTitle);
                    }
                }
            }
            else
            {
                strHot.Append("<li>暂无资讯排行信息</li>");
            }
            HotLists = strHot.ToString();

            //获取资讯信息类别
            EyouSoft.IBLL.NewsStructure.INewsType         BLL_NewsType = EyouSoft.BLL.NewsStructure.NewsType.CreateInstance();
            IList <EyouSoft.Model.NewsStructure.NewsType> InfoTypeList = BLL_NewsType.GetInformationType();

            EyouSoft.Model.NewsStructure.NewsType only = InfoTypeList.Where(p => p.ClassName == "行业新闻").FirstOrDefault();
            //获取最新行业新闻
            IList <EyouSoft.Model.NewsStructure.WebSiteNews> Trades = bll_News.GetListByNewType(6, only.Id);

            this.news.DataSource = Trades;
            this.news.DataBind();
            bll_News = null;

            //获取供求信息
            EyouSoft.IBLL.CommunityStructure.IExchangeList         Bchange = EyouSoft.BLL.CommunityStructure.ExchangeList.CreateInstance();
            IList <EyouSoft.Model.CommunityStructure.ExchangeList> excList = Bchange.GetTopList(6);

            this.star.DataSource = excList;
            this.DataBind();

            //获取最新线路
            EyouSoft.IBLL.NewTourStructure.IRoute          Btour    = EyouSoft.BLL.NewTourStructure.BRoute.CreateInstance();
            IList <EyouSoft.Model.NewTourStructure.MRoute> TourList = Btour.GetNewRouteList(6);
            StringBuilder NewRoute = new StringBuilder();

            if (TourList != null)
            {
                foreach (EyouSoft.Model.NewTourStructure.MRoute item in TourList)
                {
                    NewRoute.Append(string.Format("<li><a title='{0}' target='_blank' href='{1}'>{2}</a></li>", item.RouteName, EyouSoft.Common.URLREWRITE.Tour.GetTourToUrl(item.Id, CityId), Utils.GetText2(item.RouteName, 16, true)));
                }
            }
            RouteList = NewRoute.ToString();
            Btour     = null;
            //获取旅游企业
            EyouSoft.IBLL.CompanyStructure.ICompanyInfo Bcompany = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance();
            IList <EyouSoft.Model.CompanyStructure.MLatestRegCompanyInfo> ComList = Bcompany.GetTopNumNewCompanys(9, true);

            this.company.DataSource = ComList;
            this.company.DataBind();
            Bcompany = null;
        }