コード例 #1
0
ファイル: frmCliente.cs プロジェクト: elielleal/Farmacia
 private void frmCliente_Load(object sender, EventArgs e)
 {
     Camadas.BLL.Cliente bllCliente = new Camadas.BLL.Cliente();
     dgvClientes.DataSource = bllCliente.Select();
     Habilitar(false);
     pnlPesquisa.Visible = false;
 }
コード例 #2
0
ファイル: frmCliente.cs プロジェクト: elielleal/Farmacia
        private void btnRemover_Click(object sender, EventArgs e)
        {
            string msg;

            if (lblId.Text != string.Empty)
            {
                msg = "Confirma Remoção do Cliente " + txtNome.Text + "?";
                DialogResult resp;
                resp = MessageBox.Show(msg, "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (resp == DialogResult.Yes)
                {
                    int id = Convert.ToInt32(lblId.Text);
                    Camadas.BLL.Cliente   bllCliente = new Camadas.BLL.Cliente();
                    Camadas.Model.Cliente cliente    = new Camadas.Model.Cliente();
                    cliente.Id = id;
                    bllCliente.Delete(cliente);
                    dgvClientes.DataSource = "";
                    dgvClientes.DataSource = bllCliente.Select();
                }
            }
            else
            {
                msg = "Não há registro para remoção...";
                MessageBox.Show(msg, "Remover", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            limparCampos();
            Habilitar(false);
        }
コード例 #3
0
ファイル: frmCliente.cs プロジェクト: elielleal/Farmacia
 private void rdbTodos_CheckedChanged(object sender, EventArgs e)
 {
     lblPesquisa.Visible = false;
     txtPesquisa.Visible = false;
     btnFiltrar.Visible  = false;
     Camadas.BLL.Cliente bllCliente = new Camadas.BLL.Cliente();
     dgvClientes.DataSource = "";
     dgvClientes.DataSource = bllCliente.Select();
 }
コード例 #4
0
ファイル: frmCliente.cs プロジェクト: elielleal/Farmacia
        private void btnGrvar_Click(object sender, EventArgs e)
        {
            Camadas.BLL.Cliente   bllCliente = new Camadas.BLL.Cliente();
            Camadas.Model.Cliente cliente    = new Camadas.Model.Cliente();
            int id = Convert.ToInt32(lblId.Text);

            string msg = "";

            if (id == -1)
            {
                msg = "Confirma Inclusão dos Dados?";
            }
            else
            {
                msg = "Confirma Atualização dos Dados?";
            }

            DialogResult resp;

            resp = MessageBox.Show(msg, "Gravar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (resp == DialogResult.Yes)
            {
                cliente.Id       = id;
                cliente.Nome     = txtNome.Text;
                cliente.CPF      = txtCpf.Text;
                cliente.RG       = txtRg.Text;
                cliente.Endereco = txtEndereco.Text;
                cliente.Bairro   = txtBairro.Text;
                cliente.Cidade   = txtCidade.Text;
                cliente.UF       = txtUf.Text.ToUpper();
                cliente.Telefone = txtTelefone.Text;
                cliente.Celular  = txtCelular.Text;
                cliente.Sexo     = txtSexo.Text;
                cliente.Email    = txtEmail.Text;
                if (id == -1)
                {
                    bllCliente.Insert(cliente);
                }
                else
                {
                    bllCliente.Update(cliente);
                }
            }
            dgvClientes.DataSource = "";
            dgvClientes.DataSource = bllCliente.Select();
            limparCampos();
            Habilitar(false);
        }
コード例 #5
0
ファイル: frmVenda.cs プロジェクト: elielleal/Farmacia
        private void frmVenda_Load(object sender, EventArgs e)
        {
            HabilitarControlesVenda(false);
            HabilitarControlesItemVenda(false);
            LimparControlesVenda();
            LimparControlesItemVenda();

            Camadas.BLL.Venda     bllVenda     = new Camadas.BLL.Venda();
            Camadas.BLL.ItemVenda bllItemVenda = new Camadas.BLL.ItemVenda();

            dgvVenda.DataSource     = bllVenda.Select();
            dgvItemVenda.DataSource = bllItemVenda.Select();

            //combox
            //cliente
            Camadas.BLL.Cliente bllCliente = new Camadas.BLL.Cliente();
            cmbCliente.DisplayMember = "nome";
            cmbCliente.ValueMember   = "id";
            cmbCliente.DataSource    = bllCliente.Select();

            //funcionario
            Camadas.BLL.Funcionario bllFuncionario = new Camadas.BLL.Funcionario();
            cmbFuncionario.DisplayMember = "nome";
            cmbFuncionario.ValueMember   = "id";
            cmbFuncionario.DataSource    = bllFuncionario.Select();

            //venda
            Camadas.BLL.Venda bllVendas = new Camadas.BLL.Venda();
            cmbVenda.DisplayMember = "id";
            cmbVenda.DataSource    = bllVendas.Select();

            //produto
            Camadas.BLL.Produto bllProduto = new Camadas.BLL.Produto();
            cmbProduto.DisplayMember = "nome";
            cmbProduto.ValueMember   = "id";
            cmbProduto.DataSource    = bllProduto.Select();

            txtIdCliente.Text     = cmbCliente.SelectedValue.ToString();
            txtIdFuncionario.Text = cmbFuncionario.SelectedValue.ToString();
        }