protected void gvRss_SelectedIndexChanged(object sender, EventArgs e) { Label1.Visible = true; ViewState["index"] = gvRss.SelectedIndex; if (Session["korisnik"] != null) { if (Session["lista"] == null) //ednas ke se izvrsi ova { List <Feeds> list = new List <Feeds>(); Feeds f = new Feeds { Team1 = gvRss.SelectedRow.Cells[0].Text, Team2 = gvRss.SelectedRow.Cells[1].Text, Stadium = gvRss.SelectedRow.Cells[2].Text, Date = gvRss.SelectedRow.Cells[3].Text, City = gvRss.SelectedRow.Cells[4].Text, cena = Convert.ToInt16(gvRss.SelectedRow.Cells[6].Text) }; list.Add(f); Session["lista"] = list; } else { List <Feeds> list = (List <Feeds>)Session["lista"]; Feeds f = new Feeds { Team1 = gvRss.SelectedRow.Cells[0].Text, Team2 = gvRss.SelectedRow.Cells[1].Text, Stadium = gvRss.SelectedRow.Cells[2].Text, Date = gvRss.SelectedRow.Cells[3].Text, City = gvRss.SelectedRow.Cells[4].Text, cena = Convert.ToInt16(gvRss.SelectedRow.Cells[6].Text) }; list.Add(f); Session["lista"] = list; } gvRss.Rows[gvRss.SelectedIndex].BackColor = Color.FromArgb(153, 255, 102); gvRss.Rows[gvRss.SelectedIndex].Enabled = false; if (Session["sostojba"] == null) { List <int> lista = new List <int>(); lista.Add(gvRss.SelectedIndex); Session["sostojba"] = lista; } else { List <int> list = (List <int>)Session["sostojba"]; list.Add(gvRss.SelectedIndex); Session["sostojba"] = list; } } else { Label1.Text = "Потребно е првин да се најавите!"; Label1.ForeColor = Color.DarkRed; Label1.Font.Bold = true; } }
protected void gvRss_SelectedIndexChanged(object sender, EventArgs e) { Label1.Visible = true; ViewState["index"] = gvRss.SelectedIndex; if (Session["korisnik"] != null) { if (Session["lista"] == null) //ednas ke se izvrsi ova { List<Feeds> list = new List<Feeds>(); Feeds f = new Feeds { Team1 = gvRss.SelectedRow.Cells[0].Text, Team2 = gvRss.SelectedRow.Cells[1].Text, Stadium = gvRss.SelectedRow.Cells[2].Text, Date = gvRss.SelectedRow.Cells[3].Text, City = gvRss.SelectedRow.Cells[4].Text, cena = Convert.ToInt16(gvRss.SelectedRow.Cells[6].Text) }; list.Add(f); Session["lista"] = list; } else { List<Feeds> list = (List<Feeds>)Session["lista"]; Feeds f = new Feeds { Team1 = gvRss.SelectedRow.Cells[0].Text, Team2 = gvRss.SelectedRow.Cells[1].Text, Stadium = gvRss.SelectedRow.Cells[2].Text, Date = gvRss.SelectedRow.Cells[3].Text, City = gvRss.SelectedRow.Cells[4].Text, cena = Convert.ToInt16(gvRss.SelectedRow.Cells[6].Text) }; list.Add(f); Session["lista"] = list; } gvRss.Rows[gvRss.SelectedIndex].BackColor = Color.FromArgb(153, 255, 102); gvRss.Rows[gvRss.SelectedIndex].Enabled = false; if (Session["sostojba"] == null) { List<int> lista = new List<int>(); lista.Add(gvRss.SelectedIndex); Session["sostojba"] = lista; } else { List<int> list = (List<int>)Session["sostojba"]; list.Add(gvRss.SelectedIndex); Session["sostojba"] = list; } } else { Label1.Text = "Потребно е првин да се најавите!"; Label1.ForeColor = Color.DarkRed; Label1.Font.Bold = true; } }
private void PopulateRssFeed() { string RssFeedUrl = "http://footballpool.dataaccess.eu/data/info.wso/AllGames"; feeds = new List<Feeds>(); try { XDocument xDoc = new XDocument(); xDoc = XDocument.Load(RssFeedUrl); var items = (from x in xDoc.Descendants("tGameInfo") select new { Team1 = x.Descendants("Team1").Elements("sName").First().Value, Team2 = x.Descendants("Team2").Elements("sName").First().Value, Stadium = x.Descendants("StadiumInfo").Elements("sStadiumName").First().Value, City = x.Descendants("StadiumInfo").Elements("sCityName").First().Value, Date = x.Element("dPlayDate").Value, Time = x.Element("tPlayTime").Value, image1 = x.Descendants("Team1").Elements("sCountryFlag").First().Value, image2 = x.Descendants("Team2").Elements("sCountryFlag").First().Value /*link = x.Element("link").Value; pubDate = x.Element("pubDate").Value, description = x.Element("description").Value */ }); if (items != null) { Random r = new Random(); foreach (var i in items) { if (DateTime.Compare(Convert.ToDateTime(i.Date), DateTime.Now) >= 0) { DateTime date1 = Convert.ToDateTime(i.Date); string pom = date1.ToLongDateString(); Feeds f = new Feeds { Team1 = i.Team1, Team2 = i.Team2, Date = pom, Time = i.Time, City = i.City, Stadium = i.Stadium, image1 = i.image1, image2 = i.image2, cena=r.Next(50, 100) }; feeds.Add(f); } } } Session["Games"] = feeds; gvRss.DataSource = feeds; gvRss.DataBind(); } catch (Exception ex) { } }
private void PopulateRssFeed() { string RssFeedUrl = "http://footballpool.dataaccess.eu/data/info.wso/AllGames"; feeds = new List <Feeds>(); try { XDocument xDoc = new XDocument(); xDoc = XDocument.Load(RssFeedUrl); var items = (from x in xDoc.Descendants("tGameInfo") select new { Team1 = x.Descendants("Team1").Elements("sName").First().Value, Team2 = x.Descendants("Team2").Elements("sName").First().Value, Stadium = x.Descendants("StadiumInfo").Elements("sStadiumName").First().Value, City = x.Descendants("StadiumInfo").Elements("sCityName").First().Value, Date = x.Element("dPlayDate").Value, Time = x.Element("tPlayTime").Value, image1 = x.Descendants("Team1").Elements("sCountryFlag").First().Value, image2 = x.Descendants("Team2").Elements("sCountryFlag").First().Value /*link = x.Element("link").Value; * pubDate = x.Element("pubDate").Value, * description = x.Element("description").Value */ }); if (items != null) { Random r = new Random(); foreach (var i in items) { if (DateTime.Compare(Convert.ToDateTime(i.Date), DateTime.Now) >= 0) { DateTime date1 = Convert.ToDateTime(i.Date); string pom = date1.ToLongDateString(); Feeds f = new Feeds { Team1 = i.Team1, Team2 = i.Team2, Date = pom, Time = i.Time, City = i.City, Stadium = i.Stadium, image1 = i.image1, image2 = i.image2, cena = r.Next(50, 100) }; feeds.Add(f); } } } Session["Games"] = feeds; gvRss.DataSource = feeds; gvRss.DataBind(); } catch (Exception ex) { } }