예제 #1
0
        public void bindnewsfeed()
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc  = new SqlConnection(myConnection_String.Conn_string);
            SqlCommand           cmd = new SqlCommand("select TOP (5) * from ECT_SIS_News_Feed where isActive=1 order by dDate desc", sc);
            DataTable            dt  = new DataTable();
            SqlDataAdapter       da  = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(dt);
                sc.Close();

                RepeaterNews.DataSource = dt;
                RepeaterNews.DataBind();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
예제 #2
0
        public void ButtonFavoriteDelete_Click(object sender, EventArgs e)
        {
            string newsId        = (sender as Button).CommandArgument;
            bool   removeSuccess = RemoveNewsFromDB(newsId);

            RepeaterNews.DataBind();
        }
예제 #3
0
        protected void LoadNews()
        {
            DataTable dt = new DataTable();

            dt = dalN.SelectAllInformation();
            DataView dv = dt.DefaultView;

            dv.RowFilter = "Status = True";
            DataTable dtNew = dv.ToTable();

            RepeaterNews.DataSource = dtNew;
            RepeaterNews.DataBind();
        }
예제 #4
0
        public void GenerateNewsHTML(string keyword, string country)
        {
            NewsApi newsApiResponse = NewsApi.GetNewsFromApi(keyword, country);

            if (newsApiResponse == null)
            {
                Session["newsList"]     = null;
                RepeaterNews.DataSource = Session["newsList"];
                RepeaterNews.DataBind();
                return;
            }

            Session["newsList"]     = newsApiResponse.news;
            RepeaterNews.DataSource = Session["newsList"];
            RepeaterNews.DataBind();
        }
예제 #5
0
        private void getNews()
        {
            string sqlstring = @"SELECT  TOP (3) id,gettop,  date, title, previewArticle, previewPicture, article
FROM      news
order by gettop desc,[date] desc";

            string        connectstring = WebConfigurationManager.ConnectionStrings["tayanaConnectionString"].ToString();
            SqlConnection connect       = new SqlConnection(connectstring);

            SqlCommand     news        = new SqlCommand(sqlstring, connect);
            SqlDataAdapter newsAdapter = new SqlDataAdapter(news);
            DataTable      newsTable   = new DataTable();

            newsAdapter.Fill(newsTable);
            RepeaterNews.DataSource = newsTable;
            RepeaterNews.DataBind();
        }
예제 #6
0
        public void loadNews()
        {
            total = Convert.ToInt32(FoodN.DAO.FoodNews.getCountNewsWeb(Convert.ToInt32(Session["accID"].ToString())).Rows[0][0].ToString());

            maxPage = total / pageSize;

            if (total % pageSize != 0)
            {
                maxPage++;
            }

            int start = (index * pageSize) - (pageSize - 1);
            int end   = index * pageSize;

            lblpage.Text = "Page " + (index) + " of " + maxPage;

            RepeaterNews.DataSource = FoodN.DAO.FoodNews.getNewsByAccID(Convert.ToInt32(Session["accID"].ToString()), start, end);
            RepeaterNews.DataBind();
            pageIndices();
        }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SqlConnection conn = new SqlConnection(conString);
         SqlCommand    comm = new SqlCommand();
         comm.Connection  = conn;
         comm.CommandType = CommandType.Text;
         comm.CommandText = "SELECT Top 5 NewsID,Title FROM News ORDER BY NewsID DESC";
         conn.Open();
         SqlDataReader dr = comm.ExecuteReader();
         if (dr.HasRows)
         {
             DataTable dt = new DataTable();
             dt.Load(dr);
             RepeaterNews.DataSource = dt;
             RepeaterNews.DataBind();
         }
         conn.Close();
     }
 }
예제 #8
0
        protected void bind()
        {
            //艺人艺事
            Maticsoft.BLL.ArtsMatterGroup artsmattergroup = new Maticsoft.BLL.ArtsMatterGroup();
            Repeater1.DataSource = dtbindbig(artsmattergroup.GetList(10, "", "No desc").Tables[0]);
            Repeater1.DataBind();

            //作品
            Maticsoft.BLL.WorksGroup works = new Maticsoft.BLL.WorksGroup();
            //由原图路径转化成缩略图路径W
            Works.DataSource = dtbind(works.GetList(10, "", "No desc").Tables[0]);
            Works.DataBind();

            //新闻动态
            Maticsoft.BLL.NewsGroup newsbll = new Maticsoft.BLL.NewsGroup();
            RepeaterNews.DataSource = dtbind(newsbll.GetList(10, "", "No desc").Tables[0]);
            RepeaterNews.DataBind();
            //同行评价
            Maticsoft.BLL.EvaluateGroup Evabll = new Maticsoft.BLL.EvaluateGroup();
            RepeaterEva.DataSource = dtbind(Evabll.GetList(10, "", "No desc").Tables[0]);
            RepeaterEva.DataBind();
        }