public Dictionary<string,ChanFav> GetFavoriteList(string server) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary<string,ChanFav>(); } _ChannelFavorites.Clear(); curServer = server; SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf = new ChanFav(); cf.channel = drv["channel"].ToString(); if (drv["NotifyMinute"] != DBNull.Value) cf.NotifyMinute = Convert.ToInt32(drv["NotifyMinute"]); if (drv["phonetic"] != DBNull.Value) cf.Phonetic = drv["phonetic"].ToString(); if (drv["last"] != DBNull.Value) cf.Last = Convert.ToDateTime(drv["last"]); _ChannelFavorites.Add(cf.channel,cf); } return _ChannelFavorites; }
public Dictionary <string, ChanFav> GetFavoriteList(string server) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary <string, ChanFav>(); } _ChannelFavorites.Clear(); curServer = server; SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf = new ChanFav(); cf.channel = drv["channel"].ToString(); if (drv["NotifyMinute"] != DBNull.Value) { cf.NotifyMinute = Convert.ToInt32(drv["NotifyMinute"]); } if (drv["phonetic"] != DBNull.Value) { cf.Phonetic = drv["phonetic"].ToString(); } if (drv["last"] != DBNull.Value) { cf.Last = Convert.ToDateTime(drv["last"]); } _ChannelFavorites.Add(cf.channel, cf); } return(_ChannelFavorites); }
public void AddChannels(string server, string[] channellist) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary <string, ChanFav>(); } _ChannelFavorites.Clear(); SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf = new ChanFav(); cf.channel = drv["channel"].ToString(); _ChannelFavorites.Add(cf.channel, cf); } foreach (string fav in channellist) { if (!_ChannelFavorites.ContainsKey(fav)) { //Add favorite to list ChanFav cf = new ChanFav(fav); _ChannelFavorites.Add(cf.channel, cf); SavedSet.ChannelFavoritesRow cfr = dtFavs.NewChannelFavoritesRow(); cfr.Channel = fav; cfr.servername = server; dtFavs.AddChannelFavoritesRow(cfr); } } data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml"); }
public void RemoveChannels(string server, string[] channellist) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary <string, ChanFav>(); } _ChannelFavorites.Clear(); SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf = new ChanFav(); cf.channel = drv["channel"].ToString(); _ChannelFavorites.Add(cf.channel, cf); } SavedSet.ChannelFavoritesRow cfr; foreach (string fav in channellist) { if (_ChannelFavorites.ContainsKey(fav)) { //Add favorite to list _ChannelFavorites.Remove(fav); for (int i = 0; i < data.ChannelFavorites.Count; i++) { cfr = data.ChannelFavorites[i]; if (cfr["Channel"] != DBNull.Value && cfr.Channel == fav) { data.ChannelFavorites.RemoveChannelFavoritesRow(cfr); } } } } data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml"); }
public void AddChannels(string server, string[] channellist) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary<string,ChanFav>(); } _ChannelFavorites.Clear(); SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf= new ChanFav(); cf.channel = drv["channel"].ToString(); _ChannelFavorites.Add(cf.channel,cf); } foreach (string fav in channellist) { if (!_ChannelFavorites.ContainsKey(fav)) { //Add favorite to list ChanFav cf = new ChanFav(fav); _ChannelFavorites.Add(cf.channel,cf); SavedSet.ChannelFavoritesRow cfr = dtFavs.NewChannelFavoritesRow(); cfr.Channel = fav; cfr.servername = server; dtFavs.AddChannelFavoritesRow(cfr); } } data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml"); }
public void RemoveChannels(string server, string[] channellist) { if (_ChannelFavorites == null) { _ChannelFavorites = new Dictionary<string,ChanFav>(); } _ChannelFavorites.Clear(); SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites(); DataView dv = new DataView(dtFavs); dv.RowFilter = "servername = '" + server + "'"; foreach (DataRowView drv in dv) { ChanFav cf = new ChanFav(); cf.channel = drv["channel"].ToString(); _ChannelFavorites.Add(cf.channel,cf); } SavedSet.ChannelFavoritesRow cfr; foreach (string fav in channellist) { if (_ChannelFavorites.ContainsKey(fav)) { //Add favorite to list _ChannelFavorites.Remove(fav); for (int i = 0; i < data.ChannelFavorites.Count; i++) { cfr = data.ChannelFavorites[i]; if (cfr["Channel"] != DBNull.Value && cfr.Channel == fav) { data.ChannelFavorites.RemoveChannelFavoritesRow(cfr); } } } } data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml"); }