Пример #1
0
        private void SalvarCor_Clicked(object sender, EventArgs e)
        {
            Boolean Salvar = true;
            int     codigo = 1;

            if (InputCdCor.Text == "" || InputCdCor.Text == null)
            {
                CommandCores CmCr = new CommandCores();
                CmCr.CriarBancoCores();
                List <Cor> Lcr = CmCr.GetMax();
                if (Lcr.Count > 0)
                {
                    codigo = Lcr[0].IdCor + 1;
                }
            }
            else
            {
                codigo = Convert.ToInt32(InputCdCor.Text);
            }

            if (InputCor.Text == "" || InputCor.Text == null)
            {
                DownInputCodCor.IsVisible = true;
                DownInputCodCor.Text      = "Informe a Cor";
                Salvar = false;
            }

            if (Salvar == true)
            {
                CommandCores CmdCores = new CommandCores();
                CmdCores.CriarBancoCores();

                Cor CodCor = new Cor();
                CodCor.IdCor     = codigo;
                CodCor.Descricao = InputCor.Text;
                CmdCores.InserirCor(CodCor);
            }
            MontaTab();
        }