public bool AddSituationsAttentions(Producer prod) { bool result = false; query = "INSERT INTO situation_attentions (id_game_title, status, situation, attention, creation_date) VALUES(" + prod.m_GameTitle + ",'" + prod.m_Status + "','" + prod.m_Situation + "','" + prod.m_Attention + "', '" + prod.m_CreationDate + "')"; try { connect.Open(); cmd = new MySqlCommand(query, connect); cmd.ExecuteNonQuery(); result = true; } catch (MySqlException ex) { MessageBox.Show(ex.Message.ToString()); result = false; } finally { connect.Close(); } return result; }
public bool AddRiskSolution(Producer prod) { bool result = false; query = "INSERT INTO risks_solutions (id_situation_attention, risk, likelyhood, impact, consequense, solution, eta, creation_date) VALUES((SELECT id_situation_attention FROM situation_attentions WHERE id_game_title = " + prod.m_IdSituation + " ),'" + prod.m_ListPossible + "','" + prod.m_Likehood + "','" + prod.m_Impact + "','" + prod.m_Consequences + "','" + prod.m_Minimize + "','" + prod.m_ETASol + "','" + prod.m_CreationDate + "')"; try { connect.Open(); cmd = new MySqlCommand(query, connect); cmd.ExecuteNonQuery(); result = true; } catch (MySqlException ex) { MessageBox.Show(ex.Message.ToString()); result = false; } finally { connect.Close(); } return result; }
private void btn_SubmitRisk_Click(object sender, EventArgs e) { s_Producer = new Producer(cmb_GameTitleRisk.SelectedValue.ToString(), txt_List.Text.ToString(), cmb_Likelyhood.SelectedItem.ToString(), cmb_Impact.SelectedItem.ToString(), txt_Cons.Text.ToString(), txt_Minimize.Text.ToString(), dtp_ETA.Text.ToString(), DateTime.Now.ToString("yyyy-MM-dd")); if (s_ProducerManager.AddRiskSolution(s_Producer)) { MessageBox.Show("Succesfully added", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //ClearField(); } else { MessageBox.Show("Failed to add", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_Submit_Click(object sender, EventArgs e) { if (cmb_GameTitle.SelectedIndex > -1 && cmbStatus.SelectedIndex > -1 && txt_Situation.TextLength > 0 && txt_Attention.TextLength > 0) { if (MessageBox.Show("Are you sure want to store those datas ? Please note, after you submit, the datas cannot be reverted", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { s_Producer = new Producer(cmb_GameTitle.SelectedValue.ToString(), cmbStatus.SelectedItem.ToString(), txt_Situation.Text.ToString(), txt_Attention.Text.ToString(), DateTime.Now.ToString("yyyy-MM-dd")); if (s_ProducerManager.AddSituationsAttentions(s_Producer)) { MessageBox.Show("Succesfully added","Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //ClearField(); } else { MessageBox.Show("Failed to add", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }