Example #1
0
        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);
        }