Example #1
0
        private void btEditar_Click(object sender, EventArgs e)
        {
            if (dgvServico.SelectedRows.Count > 0)
            {
                var id = Convert.ToInt32(dgvServico.CurrentRow.Cells[0].Value.ToString());

                if (txtDescricao.Text == "")
                {
                    MessageBox.Show("Por favor escreva o nome do serviço !!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDescricao.BackColor = Color.Yellow;
                    txtDescricao.Focus();
                    return;
                }

                if (txtPrecoServico.Text == string.Empty || txtPrecoServico.Text == "0" || txtPrecoServico.Text == "")
                {
                    MessageBox.Show("Campo preço do serviço esta vázio!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtPrecoServico.BackColor = Color.Yellow;
                    txtPrecoServico.Focus();
                    return;
                }

                Servico servico = new Servico();
                servico.Id = id;
                servico.DescricaoSERVICO = txtDescricao.Text;
                servico.PrecoSERVICO     = Convert.ToDecimal(txtPrecoServico.Text.ToString());

                ServicoBLL bll      = new ServicoBLL();
                bool       mensagem = bll.AlterarServico(servico);

                DesabiltarBotoes();
                LimpaCampos();
                CarregarServico(ListaServico());
            }
        }
Example #2
0
        private void btEditar_Click(object sender, EventArgs e)
        {
            if (dgvFuncionarios.SelectedRows.Count > 0)
            {
                var id = Convert.ToInt32(dgvFuncionarios.CurrentRow.Cells[0].Value.ToString());

                Servico servico = new Servico();
                servico.Id = id;
                servico.DescricaoSERVICO = dgvFuncionarios.Text;
                servico.PrecoSERVICO     = Convert.ToDecimal(dgvFuncionarios.Text.ToString());

                ServicoBLL bll      = new ServicoBLL();
                bool       mensagem = bll.AlterarServico(servico);

                DesabiltarBotoes();
                CarregarServico(ListaServico());
            }
        }