public void AddChannel() { var add = new ChannelElement() { Name = "#" }; _selectedNetwork?.Channels.Add(add); SelectedChannel = add; }
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); }
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); }
public void RemoveChannel() { _selectedNetwork?.Channels?.Remove(_selectedChannel); _selectedChannel = _selectedNetwork?.Channels?.FirstOrDefault(); }
/// <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)