public XFerProject GetProjectFromDB(string projectName) { XFerProject loadedProject = null; using (var dbconn = new SqliteConnection("Data Source=CloudXFerConfig.db")) { dbconn.Open(); var command = dbconn.CreateCommand(); command.CommandText = @"SELECT projectname from xferprojects WHERE projectname = $projname"; command.Parameters.AddWithValue("$projname", projectName); using (var reader = command.ExecuteReader()) { while (reader.Read()) { loadedProject = new XFerProject() { ProjectConfig = new XFerProjectConfig() { ProjectName = reader["projectname"].ToString() } }; } } } return(loadedProject); }
public void CreateXFerProject(string projectName) { XFerProject newXFerProject = new XFerProject(); newXFerProject.ProjectConfig = new XFerProjectConfig() { ProjectName = projectName, ProjectCommands = new List <XFerProjectCommand>() }; using (var conn = new SqliteConnection(Statics.ConfigDBConnString)) { try { conn.Open(); if (!DBMaintenance.InstantiatedDB(conn)) { DBMaintenance.InstantiateDB(conn); } conn.Execute(@"INSERT INTO CXFProjects (ProjectName,ProjectCreationTime) VALUES (@ProjectName, @ProjectCreationTime)", new { ProjectName = projectName, ProjectCreationTime = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString() }); } catch { throw; } finally { conn.Close(); } } }
public XFerProject CreateEmptyProject(string projectName) { XFerProject newProject = new XFerProject() { ProjectConfig = new XFerProjectConfig() { ProjectName = projectName } }; return(newProject); }