internal void MasterApply(string name, string owner, IFlowchart flowchart) { string dt = DateTime.Now.ToString("u"); string query = @"UPDATE data SET flowchart_data = '" + flowchart.GetCodeLikeStringList() + "', date = '" + dt + "', comment = '' WHERE owner = '" + owner + "' AND flowchart_name = '" + name + "'"; MySqlConnection connection = initializeDatabaseConnection("localhost", "flowchart", "root", ""); MySqlCommand com = new MySqlCommand(query, connection); try { connection.Open(); MySqlDataReader dr = com.ExecuteReader(); connection.Close(); } catch (Exception e) { connection.Close(); } }
internal void ReviewerAddToDB(IFlowchart flowchart, string comment) { string dt = DateTime.Now.ToString("u"); string querySelect = @"SELECT flowchart_name FROM data WHERE flowchart_name = '" + flowchart.GetName() + "' AND owner = '" + this.owner + "' AND reviewer = ''"; MySqlConnection connection = initializeDatabaseConnection("localhost", "flowchart", "root", ""); MySqlCommand com = new MySqlCommand(querySelect, connection); try { connection.Open(); MySqlDataReader dr = com.ExecuteReader(); string query = ""; if (dr.HasRows) { query = @"INSERT INTO data (owner, flowchart_name, flowchart_data, date, reviewer, comment) VALUES ('" + this.owner + "', '" + flowchart.GetName() + "', '" + flowchart.GetCodeLikeStringList() + "','" + dt + "', '" + this.reviewer + "', '" + comment + "')"; connection.Close(); } com = new MySqlCommand(query, connection); connection.Open(); dr = com.ExecuteReader(); connection.Close(); } catch (Exception e) { connection.Close(); } }