예제 #1
0
        private void btnApagar_Click(object sender, EventArgs e)
        {
            DialogResult Result = MessageBox.Show("Realmente deseja Excluir? A Exclusão pode ocasionar inconsistencia no Banco de Dados! ", "Importante", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            int cod = 2;

            try { cod = Convert.ToInt32(txtCodigo.Text); } catch { cod = 2; }

            if (cod != 1)
            {
                if (Result == DialogResult.Yes)
                {
                    CadItemBLL BLL = new CadItemBLL();
                    Item       c   = new Item();
                    c = TelaToEntity();
                    if (BLL.Apaga(c.Id))
                    {
                        MessageBox.Show("Deletado com Sucesso");
                    }
                    else
                    {
                        MessageBox.Show("O Item já foi utilizado e não poderá ser excluido, ou Selecione um Item Válido!");
                    }

                    LimpaTela();
                    MensagemErro();
                }
            }
            else
            {
                MessageBox.Show("O item Óleo é o único que não pode ser deletado");
            }
        }
예제 #2
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Item       item = new Item();
            CadItemBLL BLL  = new CadItemBLL();

            item = TelaToEntity();
            if (item.Id.Length == 0)
            {
                if (BLL.Cadastra(item))
                {
                    MessageBox.Show("Cadastro Realizado com Sucesso");
                    LimpaTela();
                }
                else
                {
                    MessageBox.Show("Verifique os campos Obrigatórios, O nome deve conter ao menos 3 letras");
                    MensagemErro();
                }
            }
            else
            {
                MessageBox.Show("Não é possível editar");
            }

            MensagemErro();
        }
예제 #3
0
        private void btnAnterior_Click(object sender, EventArgs e)
        {
            CadItemBLL BLL  = new CadItemBLL();
            Item       item = new Item();

            item = TelaToEntity();

            item = BLL.BuscaAnt(item);

            if (item != null)
            {
                LimpaTela();
                EntityToTela(item);
            }
            else
            {
                MessageBox.Show("Erro ao Buscar, Reinicie o Programa, se Persistir entre em contato com o Suporte");
            }
            MensagemErro();
        }
예제 #4
0
        public CheckList()
        {
            InitializeComponent();

            ConfiguracoesBLL BLL3 = new ConfiguracoesBLL();

            conf = BLL3.Busca();

            if (conf != null)
            {
                int qtd;
                try { qtd = Convert.ToInt32(conf.QtdAreas); } catch { qtd = 1; }
                for (int i = 1; i <= qtd; i++)
                {
                    comboArea.Items.Add(i);
                }
            }



            OleoBLL BLL = new OleoBLL();

            veiculos = BLL.ListaVeiculos();
            if (veiculos != null)
            {
                foreach (Veiculo p in veiculos)
                {
                    if (p.Situacao == 0)
                    {
                        comboPlaca.Items.Add(p.Placa);
                        veiculosB.Add(p);
                    }
                }
            }

            CadItemBLL BLL2 = new CadItemBLL();

            item = BLL2.ListaItem();


            if (item != null)
            {
                check1.Visible = true;
                check1.Text    = item[0].Nome;

                if (item.Count > 1)
                {
                    check2.Visible = true;
                    check2.Text    = item[1].Nome;
                }
                if (item.Count > 2)
                {
                    check3.Visible = true;
                    check3.Text    = item[2].Nome;
                }
                if (item.Count > 3)
                {
                    check4.Visible = true;
                    check4.Text    = item[3].Nome;
                }
                if (item.Count > 4)
                {
                    check5.Visible = true;
                    check5.Text    = item[4].Nome;
                }
                if (item.Count > 5)
                {
                    check6.Visible = true;
                    check6.Text    = item[5].Nome;
                }
                if (item.Count > 6)
                {
                    check7.Visible = true;
                    check7.Text    = item[6].Nome;
                }
                if (item.Count > 7)
                {
                    check8.Visible = true;
                    check8.Text    = item[7].Nome;
                }
                if (item.Count > 8)
                {
                    check9.Visible = true;
                    check9.Text    = item[8].Nome;
                }
                if (item.Count > 9)
                {
                    check10.Visible = true;
                    check10.Text    = item[9].Nome;
                }
                if (item.Count > 10)
                {
                    check11.Visible = true;
                    check11.Text    = item[10].Nome;
                }
                if (item.Count > 11)
                {
                    check12.Visible = true;
                    check12.Text    = item[11].Nome;
                }
                if (item.Count > 12)
                {
                    check13.Visible = true;
                    check13.Text    = item[12].Nome;
                }
                if (item.Count > 13)
                {
                    check14.Visible = true;
                    check14.Text    = item[13].Nome;
                }
                if (item.Count > 14)
                {
                    check15.Visible = true;
                    check15.Text    = item[14].Nome;
                }
                if (item.Count > 15)
                {
                    check16.Visible = true;
                    check16.Text    = item[15].Nome;
                }
                if (item.Count > 16)
                {
                    check17.Visible = true;
                    check17.Text    = item[16].Nome;
                }
                if (item.Count > 17)
                {
                    check18.Visible = true;
                    check18.Text    = item[17].Nome;
                }
                if (item.Count > 18)
                {
                    check19.Visible = true;
                    check19.Text    = item[18].Nome;
                }
                if (item.Count > 19)
                {
                    check20.Visible = true;
                    check20.Text    = item[19].Nome;
                }
                if (item.Count > 20)
                {
                    check21.Visible = true;
                    check21.Text    = item[20].Nome;
                }
                if (item.Count > 21)
                {
                    check22.Visible = true;
                    check22.Text    = item[21].Nome;
                }
            }



            dateTimeInicio.Value = DateTime.Now;

            txtTatico.Text = Autenticacao.GetApelido();

            MensagemErro();
        }