예제 #1
0
        private void frmClienteConsulta_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed.
            //this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido);
            // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed.
            //this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido);

            txtCod.Enabled = false;
            frmCliente usu = new frmCliente();

            if (!this.Propriedades.Equals(""))
            {
                txtCod.Text = this.Propriedades;
            }

            ClienteTableAdapter taPessoa = new ClienteTableAdapter();
            DataTable           dtPessoa;


            dtPessoa = taPessoa.Pesquisa_Cliente(int.Parse(txtCod.Text));
            if (dtPessoa.Rows.Count == 0)
            {
                MessageBox.Show("Pessosa Não Cadastrada");
                this.Close();
            }
            else
            {
                txtNome.Text      = dtPessoa.Rows[0]["Nome_Cliente"].ToString();
                txtSobrenome.Text = dtPessoa.Rows[0]["Sobrenome_Cliente"].ToString();
                dtpDataNasc.Value = DateTime.Parse(dtPessoa.Rows[0]["DataNascimento_Cliente"].ToString());
                cbxSex.Text       = dtPessoa.Rows[0]["Sexo_Cliente"].ToString();
                txtEnd.Text       = dtPessoa.Rows[0]["Endereco_Cliente"].ToString();
                txtNum.Text       = dtPessoa.Rows[0]["NumeroCasa_Cliente"].ToString();
                txtBairro.Text    = dtPessoa.Rows[0]["Bairro_Cliente"].ToString();
                txtCidade.Text    = dtPessoa.Rows[0]["Cidade_Cliente"].ToString();
                cbxUF.Text        = dtPessoa.Rows[0]["Estado_Cliente"].ToString();
                txtTel.Text       = dtPessoa.Rows[0]["Telefone_Cliente"].ToString();
                txtCel.Text       = dtPessoa.Rows[0]["Celular_Cliente"].ToString();
                txtFoto.Text      = dtPessoa.Rows[0]["Foto_Cliente"].ToString();
                if (txtFoto.Text == "")
                {
                }
                else
                {
                    pictureBox1.ImageLocation = txtFoto.Text;
                    pictureBox1.Load();
                }
                this.pedidoTableAdapter.FillBy2(this.lealDataSet.Pedido, Convert.ToInt32(txtCod.Text));

                //PedidoTableAdapter taPedido = new PedidoTableAdapter();
                //DataTable dt;
                //dt = taPedido.SelectCliente(Convert.ToInt32(txtCod.Text));
                //pedidoDataGridView.DataSource = dt;
            }
        }
예제 #2
0
        private void frmCaixa_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'lealDataSet.Cliente' table. You can move, or remove it, as needed.
            this.clienteTableAdapter.Fill(this.lealDataSet.Cliente);
            // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed.
            this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido);
            try
            {
                txtPag.Text          = "Cancelado";
                dateTimePicker1.Text = DateTime.Now.ToString();
                PedidoTableAdapter taPedido     = new PedidoTableAdapter();
                string             ultimopedido = taPedido.UltimoCOD().ToString();
                txtNumPedido.Text = ultimopedido;
                if (!this.codcli.Equals(""))
                {
                    txtCodCli.Text = this.codcli;
                }
                ClienteTableAdapter taCliente = new ClienteTableAdapter();
                DataTable           dtCliente;
                dtCliente = taCliente.Pesquisa_Cliente(int.Parse(txtCodCli.Text));
                if (dtCliente.Rows.Count == 0)
                {
                    MessageBox.Show("Pessosa Não Cadastrada");
                    this.Close();
                }
                else
                {
                    txtNome.Text      = dtCliente.Rows[0]["Nome_Cliente"].ToString();
                    txtSobrenome.Text = dtCliente.Rows[0]["Sobrenome_Cliente"].ToString();
                    txtNomeCli.Text   = txtNome.Text + " " + txtSobrenome.Text;
                }

                //ClienteTableAdapter taCliente = new ClienteTableAdapter();
                //DataTable dtCliente;
                //dtCliente = taCliente.QueyBox2();
                //cbxClientes.Text = dtCliente.Rows[1]["NomeComp"].ToString(); ;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #3
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            ClienteTableAdapter tapessoa = new ClienteTableAdapter();
            DataTable           dtPessoa;

            dtPessoa = tapessoa.Pesquisa_Cliente(int.Parse(txtCod.Text));
            if (dtPessoa.Rows.Count == 0)
            {
                MessageBox.Show("Pessosa Não Cadastrada");
            }
            else
            {
                txtNome.Text      = dtPessoa.Rows[0]["Nome_Cliente"].ToString();
                txtSobrenome.Text = dtPessoa.Rows[0]["Sobrenome_Cliente"].ToString();
                dtpDataNasc.Value = DateTime.Parse(dtPessoa.Rows[0]["DataNascimento_Cliente"].ToString());
                cbxSex.Text       = dtPessoa.Rows[0]["Sexo_Cliente"].ToString();
                txtEnd.Text       = dtPessoa.Rows[0]["Endereco_Cliente"].ToString();
                txtNum.Text       = dtPessoa.Rows[0]["NumeroCasa_Cliente"].ToString();
                txtBairro.Text    = dtPessoa.Rows[0]["Bairro_Cliente"].ToString();
                txtCidade.Text    = dtPessoa.Rows[0]["Cidade_Cliente"].ToString();
                cbxUF.Text        = dtPessoa.Rows[0]["Estado_Cliente"].ToString();
                txtTel.Text       = dtPessoa.Rows[0]["Telefone_Cliente"].ToString();
                txtCel.Text       = dtPessoa.Rows[0]["Celular_Cliente"].ToString();
                txtFoto.Text      = dtPessoa.Rows[0]["Foto_Cliente"].ToString();
                if (MessageBox.Show("Deseja Excluir?", "Confirma", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    tapessoa.Delete2(int.Parse(txtCod.Text));
                }
                txtCod.Focus();
                if (DialogResult == DialogResult.Yes)
                {
                    MessageBox.Show("Pessoa Excluida");
                }
                frmCliente att = new frmCliente();
                att.Show();
                this.Close();
            }
        }
예제 #4
0
        private void frmCaixaCli_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'lealDataSet.ItemPedido' table. You can move, or remove it, as needed.
            this.itemPedidoTableAdapter.Fill(this.lealDataSet.ItemPedido);
            // TODO: This line of code loads data into the 'lealDataSet.ItemPedido' table. You can move, or remove it, as needed.
            this.itemPedidoTableAdapter.Fill(this.lealDataSet.ItemPedido);
            if (!this.Propriedade.Equals(""))
            {
                txtNumPedido.Text = this.Propriedade;
            }
            if (!this.codcli.Equals(""))
            {
                txtCodClie.Text = this.codcli;
            }

            try
            {
                ItemPedidoTableAdapter taItemPedido = new ItemPedidoTableAdapter();
                DataTable dtlista;
                dtlista = taItemPedido.ConsultaPedido(Convert.ToInt32(txtNumPedido.Text));
                dataGridView1.DataSource = dtlista;
                ClienteTableAdapter taCli = new ClienteTableAdapter();

                dtlista = taCli.Pesquisa_Cliente(int.Parse(txtCodClie.Text));
                if (dtlista.Rows.Count == 0)
                {
                    MessageBox.Show("Pedido Não Encontrado!");
                    this.Close();
                }
                else
                {
                    txtNome.Text      = dtlista.Rows[0]["Nome_Cliente"].ToString();
                    txtSobrenome.Text = dtlista.Rows[0]["Sobrenome_Cliente"].ToString();
                    txtNomeCli.Text   = txtNome.Text + " " + txtSobrenome.Text;
                }
                PedidoTableAdapter taPedido = new PedidoTableAdapter();
                dtlista = taPedido.Pesquisa_Pedido(int.Parse(txtNumPedido.Text));
                if (dtlista.Rows.Count == 0)
                {
                    MessageBox.Show("Pedido Não Encontrado");
                    this.Close();
                }
                else
                {
                    txtValorfin2.Text = dtlista.Rows[0]["SubTotal_Pedido"].ToString();
                    txtdebi.Text      = dtlista.Rows[0]["Debito_Pedido"].ToString();
                }
                if (txtdebi.Text == "0")
                {
                    decimal     valor = Convert.ToDecimal(txtValorfin2.Text);
                    CultureInfo ci    = new CultureInfo("pt-BR");
                    txtValorall.Text = valor.ToString("C2", ci);
                    txtTotalFin.Text = valor.ToString("C2", ci);
                }
                else if (txtdebi.Text != "0")
                {
                    decimal     valor = Convert.ToDecimal(txtValorfin2.Text);
                    decimal     debi  = Convert.ToDecimal(txtdebi.Text);
                    CultureInfo ci    = new CultureInfo("pt-BR");
                    txtValorall.Text = valor.ToString("C2", ci);
                    txtTotalFin.Text = debi.ToString("C2", ci);
                }
            }
            catch
            {
            }
        }