public static bool SetarUltimasCores(CoresGrafico cores) { var cntErros = ErrorHandler.GetAllErrors.Count; Utils.ExecutaQuery("UPDATE ULTIMOS SET COREST1 = '" + cores.T1RGB + "', COREST2 = '" + cores.T2RGB + "', COREST3 = '" + cores.T3RGB + "', COREST4 = '" + cores.T4RGB + "', CORESCA = '" + cores.CARGB + "';"); 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 static CoresGrafico RetornaUltimasCores() { var lista = Utils.ExecutaQueryDados( "SELECT corest1, corest2, corest3, corest4, coresca FROM ultimos order by id desc rows 1"); if (lista == null || lista.Count == 0) { return(null); } var retorno = new CoresGrafico(); var item = lista.First(); retorno.T1RGB = item["COREST1"].ToString(); retorno.T2RGB = item["COREST2"].ToString(); retorno.T3RGB = item["COREST3"].ToString(); retorno.T4RGB = item["COREST4"].ToString(); retorno.CARGB = item["CORESCA"].ToString(); return(retorno); }