예제 #1
0
        public void AddChannel()
        {
            var add = new ChannelElement()
            {
                Name = "#"
            };

            _selectedNetwork?.Channels.Add(add);
            SelectedChannel = add;
        }
예제 #2
0
    public static ChannelElement[][] ReturnRectangularChannelElementArray(int size1, int size2)
    {
        ChannelElement[][] newArray = new ChannelElement[size1][];
        for (int array1 = 0; array1 < size1; array1++)
        {
            newArray[array1] = new ChannelElement[size2];
        }

        return(newArray);
    }
예제 #3
0
        public Channel GetArticlesByDateAndChannel(ChannelElement channelElement, string publishDate)
        {
            var channel = new Channel
            {
                Name = channelElement.Name,
                Icon = channelElement.Icon
            };

            var command = new SqlCommand
            {
                CommandText = "get_articles_by_date_and_channel",
                CommandType = CommandType.StoredProcedure
            };

            command.Parameters.Add(new SqlParameter("@Channel", channel.Name));
            command.Parameters.Add(new SqlParameter("@Date", publishDate));
            var reader = (SqlDataReader)DbHelper.ExecuteReader(ConnectionString, command);

            if (reader == null)
            {
                return(channel);
            }
            while (reader.Read())
            {
                var article = new Article
                {
                    Channel = Convert.ToString(reader["channel"].ToString()),
                    Title   = Convert.ToString(reader["title"].ToString()),
                    Body    = Convert.ToString(reader["body"].ToString()),
                    Url     = string.IsNullOrEmpty(reader["url"].ToString())
                            ? ""
                            : reader["url"].ToString(),
                    PublishDate = Convert.ToString(reader["publishDate"].ToString())
                };
                channel.Articles.Add(article);
            }
            reader.Close();
            return(channel);
        }
예제 #4
0
 public void RemoveChannel()
 {
     _selectedNetwork?.Channels?.Remove(_selectedChannel);
     _selectedChannel = _selectedNetwork?.Channels?.FirstOrDefault();
 }
예제 #5
0
 /// <summary>
 /// Gets all articles from database according to inputted channel and date published
 /// </summary>
 /// <param name="channelElement"></param>
 /// <param name="publishDate"></param>
 /// <returns>Channel containing all articles from inputted date</returns>
 public Channel GetArticlesByDateAndChannel(ChannelElement channelElement, string publishDate)