public MainWindowControlleur(MainWindow a_vue) { if (MainWindowControlleur.Instance == null) { m_Instance = this; } else { throw new Exception("Singleton Object Cannot be instantiated twice!"); } m_vue = a_vue; SubReddits = new List <SubReddit>(); YoutubeChannels = new List <YoutubeChannel>(); if (File.Exists(OldDataDirectory)) { try { XmlDocument t_Doc = new XmlDocument(); t_Doc.Load(OldDataDirectory); if (t_Doc.DocumentElement.SelectSingleNode("/Data/Upgrade").InnerText == "1") { SQLiteDAO.upgrade(t_Doc); File.Delete(OldDataDirectory); } } catch (Exception e) { } } ReloadProfileButtons(); LoadProfile(SQLiteDAO.LastConnectedProfile()); }
public void SaveBufferConfig(List <YoutubeChannel> a_yts, List <TwitchLive> a_twitchs, List <SubReddit> a_reddits, string a_ProfileName) { /*XmlNode t_Youtubeset = CurrentProfile.SelectSingleNode("./YoutubeSetting"); * XmlNode t_Redditset = CurrentProfile.SelectSingleNode("./RedditSetting"); * XmlNode t_Twitchset = CurrentProfile.SelectSingleNode("./TwitchSetting"); * t_Youtubeset.RemoveAll(); * t_Redditset.RemoveAll(); * t_Twitchset.RemoveAll(); * * foreach (YoutubeChannel t_yt in t_yts) { * if (t_yt.ChannelLink == "https://www.youtube.com/feeds/videos.xml?user=NAME") * continue; * * XmlNode t_channel = m_Doc.CreateElement("Channel"); * XmlNode t_channelName = m_Doc.CreateElement("Name"); * XmlNode t_channelLink = m_Doc.CreateElement("Link"); * XmlNode t_channelImage = m_Doc.CreateElement("Image"); * t_channelName.InnerText = t_yt.ChannelName; * t_channelLink.InnerText = t_yt.ChannelLink; * t_channelImage.InnerText = t_yt.ChannelImageLink; * t_channel.AppendChild(t_channelName); * t_channel.AppendChild(t_channelLink); * t_channel.AppendChild(t_channelImage); * t_Youtubeset.AppendChild(t_channel); * } * * foreach (TwitchLive t_twitch in t_twitchs) { * XmlNode t_channel = m_Doc.CreateElement("Channel"); * XmlNode t_channelLink = m_Doc.CreateElement("Link"); * XmlNode t_channelImage = m_Doc.CreateElement("Image"); * t_channelLink.InnerText = t_twitch.ChannelLink; * t_channelImage.InnerText = t_twitch.ChannelImageLink; * t_channel.AppendChild(t_channelLink); * t_channel.AppendChild(t_channelImage); * t_Twitchset.AppendChild(t_channel); * } * * foreach (SubReddit t_Subreddit in t_reddits) { * XmlNode t_SubredditNode = m_Doc.CreateElement("SubReddit"); * XmlNode t_SubredditNodeName = m_Doc.CreateElement("Name"); * XmlNode t_SubredditNodeLink = m_Doc.CreateElement("Link"); * t_SubredditNodeName.InnerText = t_Subreddit.SubRedditName; * t_SubredditNodeLink.InnerText = t_Subreddit.SubRedditLink; * t_SubredditNode.AppendChild(t_SubredditNodeName); * t_SubredditNode.AppendChild(t_SubredditNodeLink); * t_Redditset.AppendChild(t_SubredditNode); * } * * CurrentProfile.SelectSingleNode("./Name").InnerText = ProfileName; */ SQLiteDAO.saveProfile(a_yts, a_twitchs, a_reddits, a_ProfileName, ProfileActu); ReloadProfileButtons(); LoadProfile(ProfileActu.Id.ToString()); }
public void Refresh() { SQLiteDAO SQLiteDAO_Obj = SQLiteDAO.Instance; ListeFamilles = SQLiteDAO_Obj.GetAll_Famille(); ListeSousFamilles = SQLiteDAO_Obj.GetAll_SousFamille(); ConnectFamille(); ListeMarques = SQLiteDAO_Obj.GetAll_Marque(); ListeArticles = SQLiteDAO_Obj.GetAll_Article(); ConnectArticles(); }
private void ReloadProfileButtons() { m_vue.ClearProfilButtons(); foreach (Profile t_profil in SQLiteDAO.loadAllProfile()) { m_vue.AfficherProfilButton(t_profil.Name, t_profil.Id.ToString()); } /*foreach (XmlNode t_profil in m_Doc.DocumentElement.SelectNodes("/Data/Profil")) { * m_vue.AfficherProfilButton(t_profil.SelectSingleNode("./Name").InnerText, t_profil.SelectSingleNode("./Id").InnerText); * }*/ }
public void OpenAndCloseConnectionTest() { SQLiteDAO db = new SQLiteDAO(); try { db.OpenConnection(); db.CloseConnection(); } catch (Exception e) { Assert.Fail(e.Message); } }
private void Ajouter_Click(object sender, EventArgs e) { if (FilePath == String.Empty) { MessageBox.Show("Veuillez selectionnez un fichier .csv"); } else { SQLiteDAO SQLiteDAO_Obj = SQLiteDAO.Instance; sQLiteDAOBindingSource.DataSource = SQLiteDAO_Obj; SQLiteDAO_Obj.Insert_From_Csv(FilePath); MessageBox.Show("Nombre de ligne ajouter à la BDD : " + SQLiteDAO_Obj.Value); } }
public void DeleteCurrentProfile() { if (SQLiteDAO.loadAllProfile().Count > 1) { SQLiteDAO.removeProfile(ProfileActu); LoadProfile(SQLiteDAO.loadAllProfile()[0].Id.ToString()); } /*XmlNodeList t_profileList = m_Doc.SelectNodes("/Data/Profil"); * if (t_profileList.Count > 1) { * m_Doc.DocumentElement.RemoveChild(CurrentProfile); * m_vue.RetirerProfilButton(CurrentProfile.SelectSingleNode("./Name").InnerText); * LoadProfile(m_Doc.DocumentElement.LastChild.SelectSingleNode("./Id").InnerText); * }*/ }
/// <summary> /// Evenement appelant la fenetre modale exporter lorsque /// nous cliquons sur exporter dans le menu toolStrip /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ExporterToolStripMenuItem_Click(object sender, EventArgs e) { using (SaveFileDialog SaveFileDialog_obj = new SaveFileDialog()) { SaveFileDialog_obj.InitialDirectory = "c:\\"; SaveFileDialog_obj.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*"; SaveFileDialog_obj.FilterIndex = 1; SaveFileDialog_obj.RestoreDirectory = true; if (SaveFileDialog_obj.ShowDialog() == DialogResult.OK) { //Get the path of specified file string FilePath = SaveFileDialog_obj.FileName; SQLiteDAO SQLiteDAO_obj = SQLiteDAO.Instance; SQLiteDAO_obj.Export_To_Csv(FilePath); } } }
public void LoadProfile(string a_ID) { Profile profile = SQLiteDAO.loadProfile(Int32.Parse(a_ID)); ProfileActu = profile; m_vue.AfficherNomProfilActuel(profile.Name); //Vieux fontionnement /*XmlNodeList t_Ids = m_Doc.DocumentElement.SelectNodes("/Data/Profil/Id"); * foreach (XmlNode t_Id in t_Ids) { * if (t_Id.InnerText.Equals(a_ID)) * CurrentProfile = t_Id.ParentNode; * } * m_vue.AfficherNomProfilActuel(CurrentProfile.SelectSingleNode("./Name").InnerText); * m_Doc.DocumentElement.SelectSingleNode("/Data/LastIDConnected").InnerText = a_ID; * m_Doc.Save("./Resources/ProfilesData.xml");*/ RefreshDAO(); m_vue.DisplayMenu("Home"); }
public void SaveCompleteSnippetTest() { SQLiteDAO db = new SQLiteDAO(); db.OpenConnection(); Tag progTag = new Tag { Title = "Progsprache", Type = TagType.TAG_PROGRAMMING_LANGUAGE }; Tag tag = new Tag { Title = "Tag", Type = TagType.TAG_WITHOUT_TYPE }; List <Tag> tags = new List <Tag> { progTag, tag }; SnippetCode snippetCode = new SnippetCode(null, "Oh schau, ein Import!", "Ein Stück Code\nSogar mit Absatz!!"); SnippetInfo snippetInfo = new SnippetInfo() { Titel = "Test Snippet", Beschreibung = "Na ein Test Snippet halt,\nwie immer ohne viel Inhalt!", SnippetCode = snippetCode }; snippetInfo.Tags.AddRange(tags, true); db.saveSnippet(snippetInfo); db.CloseConnection(); Assert.Fail("Manueller Check! Schon verknüpfte Tags werden nochmal verknüpft"); }
public void AddProfile() { //SQLite Profile profile = SQLiteDAO.CreateProfile("Enter Name"); //Vieux fontionnement /*XmlNode t_ProfilNode = m_Doc.CreateElement("Profil"); * XmlNode t_IDNode = m_Doc.CreateElement("Id"); * t_IDNode.InnerText = (Int32.Parse(m_Doc.LastChild.LastChild.SelectSingleNode("./Id").InnerText) +1).ToString(); * XmlNode t_NameNode = m_Doc.CreateElement("Name"); * t_NameNode.InnerText = "Enter Name"; * t_ProfilNode.AppendChild(t_IDNode); * t_ProfilNode.AppendChild(t_NameNode); * t_ProfilNode.AppendChild(m_Doc.CreateElement("YoutubeSetting")); * t_ProfilNode.AppendChild(m_Doc.CreateElement("TwitchSetting")); * t_ProfilNode.AppendChild(m_Doc.CreateElement("RedditSetting")); * m_Doc.DocumentElement.AppendChild(t_ProfilNode);*/ ReloadProfileButtons(); //LoadProfile(t_IDNode.InnerText); LoadProfile(profile.Id.ToString()); }
public ResultEntity AdvertPlayLogIsExist(long advertId, DateTime containDate) { logInfo.InfoFormat("广告ID:{0} 调用接口【AdvertPlayLogIsExist】查询某日:{1} 的广告是否有记录", advertId, containDate); ResultEntity result = new ResultEntity(); result.ExcutRetStatus = false; try { using (IDAO dao = new SQLiteDAO(DefaultDBConn.DefaultDbConnectionString)) { result.ExcutRetStatus = AdvertPlayLogIsExist(advertId, containDate, dao); } } catch (Exception ex) { result.StrErrMsg = string.Format("广告ID:{0}调用接口【AdvertPlayLogIsExist】查询某日:{1} 的广告是否有记录,原因:{2}", advertId, containDate, ex.Message); logInfo.Error(result.StrErrMsg); } return(result); }
internal SQLiteCache(SQLiteDAO dao, AutoMapperService autoMapperService) { _dao = dao; _autoMapperService = autoMapperService; }
static void Main(string[] args) { var dao = new SQLiteDAO(); var item = dao.GenerateNewEquipmentItem(Constants.EquipmentCatalog.Body.FullPlate); }
internal SQLiteArrayCache(SQLiteDAO dao, AutoMapperService autoMapperService) : base(dao, autoMapperService) { }