public static bool SetarUltimasLegendas(LegendasGrafico legendas) { var cntErros = ErrorHandler.GetAllErrors.Count; Utils.ExecutaQuery("UPDATE ULTIMOS SET LEGENDAT1 = '" + legendas.T1 + "', LEGENDAT2 = '" + legendas.T2 + "', LEGENDAT3 = '" + legendas.T3 + "', LEGENDAT4 = '" + legendas.T4 + "', LEGENDACA = '" + legendas.CA + "';"); return(ErrorHandler.GetAllErrors.Count == cntErros); }
private void Aplicar_Click(object sender, EventArgs e) { var corT1Str = btnCorT1.BackColor.R.ToString() + "," + btnCorT1.BackColor.G.ToString() + "," + btnCorT1.BackColor.B.ToString(); var corT2Str = btnCorT2.BackColor.R.ToString() + "," + btnCorT2.BackColor.G.ToString() + "," + btnCorT2.BackColor.B.ToString(); var corT3Str = btnCorT3.BackColor.R.ToString() + "," + btnCorT3.BackColor.G.ToString() + "," + btnCorT3.BackColor.B.ToString(); var corT4Str = btnCorT4.BackColor.R.ToString() + "," + btnCorT4.BackColor.G.ToString() + "," + btnCorT4.BackColor.B.ToString(); var corCAStr = btnCorCA.BackColor.R.ToString() + "," + btnCorCA.BackColor.G.ToString() + "," + btnCorCA.BackColor.B.ToString(); var novasCores = new CoresGrafico() { T1RGB = corT1Str, T2RGB = corT2Str, T3RGB = corT3Str, T4RGB = corT4Str, CARGB = corCAStr }; var novasLegendas = new LegendasGrafico() { T1 = txtT1.Text, T2 = txtT2.Text, T3 = txtT3.Text, T4 = txtT4.Text, CA = txtCA.Text }; if (UltimosDAO.SetarUltimasLegendas(novasLegendas)) { MessageBox.Show("Legendas alteradas com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Erro ao alterar as legendas.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } if (UltimosDAO.SetarUltimasCores(novasCores)) { MessageBox.Show("Cores alteradas com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Erro ao alterar as cores.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //bool retorno = AtualizaUltimo(txtT1.Text, txtT2.Text, txtT3.Text, txtT4.Text, txtCA.Text); //if (retorno) MessageBox.Show("As Cores foram atualizadas com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.None); //else MessageBox.Show("Erro ao tentar alterar as Cores.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public bool AtualizaUltimo(string T1, string T2, string T3, string T4, string CA) { var novasLegendas = new LegendasGrafico { T1 = T1, T2 = T2, T3 = T3, T4 = T4, CA = CA }; return(UltimosDAO.SetarUltimasLegendas(novasLegendas)); }
public static LegendasGrafico RetornaUltimasLegendas() { var lista = Utils.ExecutaQueryDados( "SELECT legendat1, legendat2, legendat3, legendat4, legendaca FROM ultimos order by id desc rows 1"); if (lista == null || lista.Count == 0) { return(null); } var retorno = new LegendasGrafico(); var item = lista.First(); retorno.T1 = item["LEGENDAT1"].ToString(); retorno.T2 = item["LEGENDAT2"].ToString(); retorno.T3 = item["LEGENDAT3"].ToString(); retorno.T4 = item["LEGENDAT4"].ToString(); retorno.CA = item["LEGENDACA"].ToString(); return(retorno); }