コード例 #1
0
        public void AtualizaTela()
        {
            if (modoTela == ModoTela.Consulta)
            {
                groupCadastra.Visible = false;
                groupPesquisa.Visible = true;
                groupLocacoes.Visible = false;
                codClienteLocacao = 0;
                LimpaCampos();
            }
            else if (modoTela == ModoTela.Alteracao)
            {
                groupCadastra.Visible = true;
                groupPesquisa.Visible = false;
                groupLocacoes.Visible = false;

                if (codClienteLocacao != 0)
                {
                    pClienteLocacao cliente = new pClienteLocacao();
                    DataSet retorno;

                    retorno = cliente.GetClientByCod(codClienteLocacao);

                    txtNome.Text = retorno.Tables[0].Rows[0]["Nome"].ToString();
                    txtData.Text = retorno.Tables[0].Rows[0]["DataNascimento"].ToString();
                    txtTelefone.Text = retorno.Tables[0].Rows[0]["Telefone"].ToString();
                    txtRg.Text = retorno.Tables[0].Rows[0]["Rg"].ToString();
                    txtCpf.Text = retorno.Tables[0].Rows[0]["Cpf"].ToString();
                    txtRua.Text = retorno.Tables[0].Rows[0]["Rua"].ToString();
                    txtNumero.Text = retorno.Tables[0].Rows[0]["Numero"].ToString();
                    txtBairro.Text = retorno.Tables[0].Rows[0]["Bairro"].ToString();
                    CarregaEstado();
                    ddlEstado.PosicionaCombo(Convert.ToInt32(retorno.Tables[0].Rows[0]["codEstado"]));
                    ddlCidade.PosicionaCombo(Convert.ToInt32(retorno.Tables[0].Rows[0]["codCidade"]));
                    //ddlEstado.SelectedItem = ((DuplaComboItem) ).Key.ToString();
                    txtNomeResponsavel.Text = retorno.Tables[0].Rows[0]["NomeResponsavel"].ToString();
                    txtRgResponsavel.Text = retorno.Tables[0].Rows[0]["RgResponsavel"].ToString();

                    if(retorno.Tables[0].Rows[0]["rDocRgCNH"].ToString() == "1")
                    {
                        chkboxDoc.Checked = true;
                    }
                    else
                    {
                        chkboxDoc.Checked = false;
                    }

                    if (retorno.Tables[0].Rows[0]["rDocComprovEnde"].ToString() == "1")
                    {
                        chkComprovanteEndereco.Checked = true;
                    }
                    else
                    {
                        chkComprovanteEndereco.Checked = false;
                    }


                }
            }
            else if (modoTela == ModoTela.Cadastro)
            {
                groupPesquisa.Visible = false;
                groupCadastra.Visible = true;
                groupLocacoes.Visible = false;
				codClienteLocacao = 0;

				ddlEstado.PosicionaCombo(26);
				ddlCidade.PosicionaCombo(8712);
                chkboxDoc.Checked = false;
                chkComprovanteEndereco.Checked = false;


            }
            else if (modoTela == ModoTela.Locacao)
            {
                 pClienteLocacao cliente = new pClienteLocacao();
                    DataSet retorno;

                retorno = cliente.GetClientByCod(codClienteLocacao);

                if (retorno.Tables[0].Rows.Count > 0)
                {
                    lblNomeLocacao.Text = retorno.Tables[0].Rows[0]["Nome"].ToString();
                }
                else
                {
                    MessageBox.Show("Sem registros");
                }

                //lblNOme.Text = retorno.Tables[0].Rows[0]["Nome"].ToString();
                //lblCodigo.Text = codClienteLocacao.ToString();
                CarregarStatusLocacao();

                groupPesquisa.Visible = false;
                groupCadastra.Visible = false;
                groupLocacoes.Visible = true;

                ConsultaLocacoes();

            }
        }
コード例 #2
0
        private void BtnExcluir_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja excluir este cliente?","Aviso",MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                pClienteLocacao _locacao = new pClienteLocacao();


                if (_locacao.ExcluirCliente(codClienteLocacao))
                {
                    MessageBox.Show("Cliente Excluido com sucesso");
                }
                else
                {
                    MessageBox.Show("Erro ao excluir cliente");
                }


                ConsultarCliente();


            }
        }
コード例 #3
0
        private void button7_Click(object sender, EventArgs e)
        {
            pLocacao _pLoca = new pLocacao();
            Locacao _locacao = new Locacao();
            DataSet dataCliente = new DataSet();
            _locacao.codClienteLocacao = codClienteLocacao;
            _locacao.codUsuario = 1;

            int CodLocacao;
            CodLocacao = _pLoca.CadastrarLocacao(_locacao);
            pClienteLocacao _cliente = new pClienteLocacao();
            dataCliente = _cliente.GetClientByCod(codClienteLocacao);

            dataCliente.Tables[0].Rows[0]["Nome"].ToString();


            LocacaoJogo _jogo = new LocacaoJogo(2, CodLocacao);
            _jogo.modoTela = LocacaoJogo.ModoTela.Cadastro;
            _jogo.MdiParent = this.ParentForm;
            _jogo.codClienteLocacao = codClienteLocacao;
            _jogo.Show();

        }
コード例 #4
0
        private void ConsultarCliente()
        {

            DataSet rsData = new DataSet();

            pClienteLocacao pClienteLocacao = new pClienteLocacao();
            ClienteLocacao _cli = new ClienteLocacao();

            _cli.Nome = txtPesquisaNome.Text;
            _cli.NomeResponsavel = txtPesquisaNomeResponsavel.Text;
            _cli.Rg = txtPesquisaRG.Text;
            _cli.Cpf = txtPesquisaCPF.Text;


            rsData = pClienteLocacao.GridCLiente(_cli);
            if (rsData.Tables[0].Rows.Count > 0)
            {
                lvPesquisa.CarregaLv(rsData, true);
            }

        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validar())
                {

                    pClienteLocacao cliente = new pClienteLocacao();
                    ClienteLocacao _cli = new ClienteLocacao();

                    _cli.Nome = txtNome.Text.Trim();
                    _cli.DataNascimento = Convert.ToDateTime(txtData.Text);
                    _cli.Telefone = txtTelefone.Text.Trim();
                    _cli.Rg = txtRg.Text.Trim();
                    _cli.Cpf = txtCpf.Text.Trim();
                    _cli.Rua = txtRua.Text.Trim();

                    if (txtNumero.Text != "")
					{
						_cli.Numero = Convert.ToInt32(txtNumero.Text);
					}

                   
                    _cli.Bairro = txtBairro.Text.Trim();
                    _cli.Estado = Convert.ToInt32(ddlEstado.GetValueKey());
                    _cli.Cidade = Convert.ToInt32(ddlCidade.GetValueKey());
                    _cli.NomeResponsavel = txtNomeResponsavel.Text.Trim();
                    _cli.RgResponsavel = txtRgResponsavel.Text.Trim();

                    _cli.DocumentoComFoto = chkboxDoc.Checked ? "1" : "0";
                    _cli.ComprovanteEnde = chkComprovanteEndereco.Checked ? "1" : "0";

                    if (codClienteLocacao != 0)
                    {
                        _cli.codClienteLocacao = codClienteLocacao;
                        if (cliente.AlterarCliente(_cli))
                        {
                            MessageBox.Show("Cliente Alterado com sucesso");
                        }
                    }
                    else
                    {
                        if (cliente.CadastrarCliente(_cli))
                        {
                            MessageBox.Show("Cliente Cadastrado com sucesso");
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());

            }
        }
コード例 #6
0
ファイル: LocacaoJogo.cs プロジェクト: AlanAds03/MaisGamers
        public void AtualizaTela()
        {
            CentralizarGrupos();

            if (modoTela == ModoTela.Consulta)
            {
                groupPesquisa.Visible = true;
                groupCadastra.Visible = false;

                pClienteLocacao cliente = new pClienteLocacao();
                DataSet retorno;

                retorno = cliente.GetClientByCod(codClienteLocacao);

                lblCodigo.Text = retorno.Tables[0].Rows[0]["codClienteLocacao"].ToString();
                lblNome.Text = retorno.Tables[0].Rows[0]["Nome"].ToString();
                lblRG.Text = retorno.Tables[0].Rows[0]["Rg"].ToString();

                dataLocacaoInicio.Text = DateTime.Now.ToShortDateString();
                txtDataFinal.Text = DateTime.Now.ToShortDateString();


            }
            else if (modoTela == ModoTela.Alteracao)
            {
                DataSet retornoJogo = new DataSet();
                pLocacaoJogo _pLoccaoJogo = new pLocacaoJogo();

                retornoJogo = _pLoccaoJogo.QueryLocacaoJogo(codLocacao);

                if (retornoJogo.Tables[0].Rows.Count > 0)
                {
                    lvJogos.CarregaLv(retornoJogo);
                }
                
                //groupCadastra.Visible = true;
                //groupPesquisa.Visible = false;

                //if (codClienteLocacao != 0)
                //{


                //}
            }
            else if (modoTela == ModoTela.Cadastro)
            {
                groupCadastra.Visible = true;
                groupPesquisa.Visible = false;

                if (codClienteLocacao != 0)
                {
                    DataSet resultado = new DataSet();
                    pClienteLocacao _cliente = new pClienteLocacao();
                    resultado = _cliente.GetClientByCod(codClienteLocacao);

                    lblCodigo.Text = resultado.Tables[0].Rows[0]["codClienteLocacao"].ToString();
                    lblNome.Text = resultado.Tables[0].Rows[0]["Nome"].ToString();
                    lblRG.Text = resultado.Tables[0].Rows[0]["RG"].ToString();

                }

            }
        }