public void ExisteTest()
        {
            bool paso = false;

            paso = ClienteBLL.Existe(1);
            Assert.AreEqual(paso, true);
        }
コード例 #2
0
        //editando
        private void editar(Cliente cliente)
        {
            ClienteBLL clientebll = new ClienteBLL();

            cliente.nome            = txbnome.Text;
            cliente.CPF             = txbcpf.Text;
            cliente.rg              = txbrg.Text;
            cliente.org_exp         = txbOe.Text;
            cliente.uf_exp          = txbUfexp.Text;
            cliente.cnh             = txbcnh.Text;
            cliente.vencimento_cnh  = txbVcnh.Text;
            cliente.nascimento_data = txbData.Text;
            cliente.endereco        = txbendereco.Text;
            cliente.municipio       = txbmunicipio.Text;
            cliente.uf              = txbuf.Text;
            cliente.complemento     = txbcomplemento.Text;
            cliente.bairro          = txbbairro.Text;
            cliente.numero_endereco = txbnumero.Text;
            cliente.email           = txbemail.Text;
            cliente.telefone        = txbtelefone.Text;
            cliente.celular         = txbcelular.Text;

            clientebll.editar(cliente);
            MessageBox.Show("Cliente editado com sucesso!");
            listar();
        }
コード例 #3
0
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            if (txtId.Text != "")
            {
                DialogResult confirm = MessageBox.Show("Deseja realmente apagar esse cliente.\n " +
                                                       "Ao continuar será apagado também todos os animais cadastrados para esse cliente\n " +
                                                       "Você quer Apagar?", "Apagar dados do cliente", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

                if (confirm.ToString().ToUpper() == "YES")
                {
                    Cliente cliente = new Cliente
                    {
                        id       = Convert.ToInt32(txtId.Text),
                        nome     = txtNome.Text,
                        cpf      = txtCPF.Text,
                        rg       = txtRG.Text,
                        cidade   = txtCidade.Text,
                        uf       = txtUF.Text,
                        telefone = txtTelefone.Text,
                        email    = txtEmail.Text
                    };
                    ClienteBLL bll = new ClienteBLL();
                    bll.Delete(cliente);
                }
            }
            else
            {
                MessageBox.Show("Para apagar, precisa selecionar um cliente!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            AtualizaView();
            LimpaCampos();
            btnConfirm.Enabled = false;
            button2.Enabled    = true;
        }
コード例 #4
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Cliente    cliente    = new Cliente();
            ClienteBLL clienteBLL = new ClienteBLL();

            cliente.nm_nome        = this.txtNome.Text;
            cliente.nm_cpf_cnpj    = this.txtCpf.Text;
            cliente.cd_tipo        = int.Parse(this.ddpTipo.SelectedValue);
            cliente.nm_logradouro  = this.txtLogradouro.Text;
            cliente.cd_numero      = int.Parse(this.txtNumero.Text);
            cliente.nm_complemento = this.txtComplemento.Text;
            cliente.nm_bairro      = this.txtBairro.Text;
            cliente.nm_cep         = this.txtCEP.Text;
            cliente.nm_cidade      = this.txtCidade.Text;

            if (this.Session["ID"] != null)
            {
                cliente.id_cliente = int.Parse(this.Session["ID"].ToString());
                clienteBLL.Atualizar(cliente);
            }
            else
            {
                clienteBLL.Inserir(cliente);
            }

            Response.Redirect("PesqCliente.aspx");
        }
コード例 #5
0
        private void frmEmitir_Load(object sender, EventArgs e)
        {
            dateTimeInput1.MinDate = DateTime.Now;

            cmbTipPlan.DataSource    = completarplan.selecionar_categoria();
            cmbTipPlan.DisplayMember = "PlanCate";
            cmbTipPlan.SelectedIndex = 0;


            ClienteBLL cliente = new ClienteBLL();

            if (Planos_Detalhes.TipoPlan != "")
            {
                cmbTipPlan.Text       = Planos_Detalhes.TipoPlan;
                cmbPlan.Text          = Planos_Detalhes.Plano;
                cmbDias.Text          = Planos_Detalhes.Dias;
                integerInput1.Text    = Planos_Detalhes.Quant;
                cmbTipPlan.Enabled    = false;
                cmbPlan.Enabled       = false;
                cmbDias.Enabled       = false;
                integerInput1.Enabled = false;
            }


            //cmbTipPlan.SelectedIndex = 0;
        }
コード例 #6
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (!Validar())
            {
                return;
            }

            if (clientes.ClienteId == 0)
            {
                paso = ClienteBLL.Guardar(clientes);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatosCliente())
                {
                    MessageBox.Show("No se puede Modificar una persona que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = ClienteBLL.Modificar(clientes);
            }
            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo");
            }
        }
コード例 #7
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(DataCriacao.Text) ||
                String.IsNullOrEmpty(DataVencimento.Text) ||
                String.IsNullOrEmpty(Titulo.Text))
            {
                MessageBox.Show("Data Criação, Data Vencimento e Título são obrigatórios!");
            }
            else
            {
                tarefa.PessoaContato = EdtPessoaContato.Text;
                DateTime.TryParse(DataCriacao.Text, out DateTime date);
                tarefa.DataCriacao = date;
                DateTime.TryParse(DataVencimento.Text, out date);
                tarefa.DataVencimento = date;
                DateTime.TryParse(DataConclusao.Text, out date);
                tarefa.DataConclusao = date;
                tarefa.Titulo        = Titulo.Text;
                tarefa.Descricao     = Descricao.Text;
                tarefa.cliente       = cliente;
                tarefa.Cliente       = ClienteBLL.GetCliente(tarefa.cliente);

                tarefa = TarefaBLL.SalvarTarefa(tarefa);

                CarregaDadosTarefa();
            }
        }
コード例 #8
0
        private void CarregaDadosTarefa()
        {
            tarefas = TarefaBLL.RetornaTarefas();

            if (tarefa != null)
            {
                tarefa.Cliente        = ClienteBLL.GetCliente(tarefa.cliente);
                NomeCliente.Text      = tarefa.Cliente.NomeFantasia;
                Titulo.Text           = tarefa.Titulo;
                DataCriacao.Text      = Convert.ToDateTime(tarefa.DataCriacao) > Convert.ToDateTime("01/01/1970") ? Convert.ToDateTime(tarefa.DataCriacao).ToString("dd/MM/yyyy") : "";
                DataVencimento.Text   = Convert.ToDateTime(tarefa.DataVencimento) > Convert.ToDateTime("01/01/1970") ? Convert.ToDateTime(tarefa.DataVencimento).ToString("dd/MM/yyyy") : "";
                DataConclusao.Text    = Convert.ToDateTime(tarefa.DataConclusao) > Convert.ToDateTime("01/01/1970") ? Convert.ToDateTime(tarefa.DataConclusao).ToString("dd/MM/yyyy") : "";
                StatusTarefa.Text     = tarefa.Status;
                EdtPessoaContato.Text = tarefa.PessoaContato;
            }

            btnPrimeiro.Enabled = true;
            btnAnterior.Enabled = true;
            btnProximo.Enabled  = true;
            btnUltimo.Enabled   = true;
            btnNovo.Enabled     = true;
            BtnEditar.Enabled   = true;
            btnExcluir.Enabled  = true;
            btnCancelar.Enabled = false;
            btnSalvar.Enabled   = false;
        }
コード例 #9
0
        private void btnProximo_Click(object sender, EventArgs e)
        {
            if (cliente != null)
            {
                if (cliente != clientes.Last())
                {
                    int IdControle    = cliente.Id;
                    int ultimoCliente = ClienteBLL.CarregaUltimoCliente().Id;
                    cliente = null;

                    while (cliente == null && IdControle <= ultimoCliente)
                    {
                        cliente = ClienteBLL.GetCliente(IdControle + 1);
                        IdControle++;
                    }

                    if (cliente == null)
                    {
                        cliente = ClienteBLL.CarregaUltimoCliente();
                    }

                    CarregaDadosCliente();
                }
            }
        }
コード例 #10
0
        public IActionResult NovoPedido2(int?codigoCliente, int?codigoPedido)
        {
            if (HttpContext.Request.Cookies["USUARIO"] == null)
            {
                return(RedirectToAction("Login", "Login", new { urlRetorno = HttpContext.Request.Path }));
            }

            string             mensagemErro;
            CabecalhoPedidoBLL cabecalhoPedidoBLL = new CabecalhoPedidoBLL();
            ClienteBLL         clienteBLL         = new ClienteBLL();

            if (codigoPedido.HasValue && codigoPedido != 0)
            {
                CabecalhoPedido cabecalho = cabecalhoPedidoBLL.GetPedidoByCodigo((int)codigoPedido, out mensagemErro);
                cabecalho.Cliente = clienteBLL.GetClientes((int)cabecalho.Cliente.Codigo, out mensagemErro).First();

                return(View(cabecalho));
            }
            else
            {
                CabecalhoPedido cabecalho = new CabecalhoPedido((int)codigoCliente, Convert.ToInt32(HttpContext.Request.Cookies["CODIGO_USUARIO"].ToString()));

                if (!cabecalhoPedidoBLL.insertCabecalhoPedido(cabecalho, out mensagemErro))
                {
                    TempData["mensagemErro"] = mensagemErro;

                    return(RedirectToAction("Index", "Home"));
                }

                cabecalho.Cliente = clienteBLL.GetClientes((int)cabecalho.Cliente.Codigo, out mensagemErro).First();

                return(View(cabecalho));
            }
        }
コード例 #11
0
        public void TestBuscarCliente()
        {
            string         nombreEsperado = "Adrian";
            List <Cliente> Clientes       = ClienteBLL.BuscarClientesPorDNI("22464657");

            Assert.AreEqual(nombreEsperado, Clientes[0].Nombre);
        }
コード例 #12
0
        private void ExecutaPesquisaCliente()
        {
            frmPesquisaClientes pesquisa = new frmPesquisaClientes();

            if (pesquisa.ExibeDialogo(txtCodCliIntegracao.Text) == DialogResult.OK)
            {
                if (pesquisa.Id != null)
                {
                    clienteBLL = new ClienteBLL();
                    Cliente cliente = clienteBLL.Localizar(pesquisa.Id);
                    if (cliente != null)
                    {
                        txtCodCliIntegracao.Text = cliente.codigo_cliente_integracao;
                        txtClienteNome.Text      = cliente.nome_fantasia;
                        txtIdCliente.Text        = cliente.Id.ToString();
                        if (cliente.cliente_vendedor.Count > 0)
                        {
                            Id         = cliente.cliente_vendedor.FirstOrDefault().Id;
                            txtId.Text = Convert.ToString(Id);
                            cbVendedor.SelectedValue = cliente.cliente_vendedor.FirstOrDefault().Id_Vendedor;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Cliente não localizado.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCodCliIntegracao.Text = String.Empty;
                }
            }
            else
            {
                txtCodCliIntegracao.Focus();
            }
        }
コード例 #13
0
        public string IncluirClientes(Cliente cliente)
        {
            string retorno = string.Empty;

            try
            {
                clientes_cadastro _cliente = fromCliente(cliente);

                clientes_status resp = soapClient.IncluirCliente(_cliente);

                if (resp != null)
                {
                    clienteBLL = new ClienteBLL();
                    clienteBLL.UsuarioLogado    = usuario;
                    cliente.codigo_cliente_omie = Convert.ToInt64(resp.codigo_cliente_omie);
                    cliente.sincronizar         = "N";
                    clienteBLL.AlterarCliente(cliente);
                    retorno = resp.descricao_status;
                }

                return(retorno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #14
0
        protected void btnRecuperaSenha_Click(object sender, EventArgs e)
        {
            CLIENTE cliente = new CLIENTE();
            ClienteBLL clientebll = new ClienteBLL();

            if (txtEmail.Text != "")
            {
                if (clientebll.VerificarExistenciaCliente(txtEmail.Text.Trim()))
                {
                    cliente = clientebll.RecuperaSenhaCliente(txtEmail.Text.Trim());

                    Session.Add("cliente", cliente);

                    //Cliente Existe
                    lblMsg.Text = "Sua senha cadastrada é :" + cliente.SENHA.ToString();
                    lblMsg.Visible = true;
                }
                else
                {
                    lblMsg.Text = "Você não se encontra cadastrado.";
                    lblMsg.Visible = true;
                }
            }
            else
            {
                //Cliente Existe
                lblMsg.Text = "Informe seu email para buscarmos a senha.";
                lblMsg.Visible = true;
            }
        }
コード例 #15
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            CLIENTE cliente = new CLIENTE();
            ClienteBLL clientebll = new ClienteBLL();

            cliente.NOME = txtNome.Text.Trim();
            cliente.EMAIL = txtEmail.Text.Trim();
            cliente.SENHA = txtSenha.Text.Trim();
            cliente.DATA_CADASTRO = DateTime.Now;

            bool clienteExiste = clientebll.VerificarExistenciaCliente(txtEmail.Text.Trim());

            if (clienteExiste)
            {
                //Cliente Existe
                lblMsg.Text = "Você já se encontra cadastrado !";
                lblMsg.Visible = true;
            }
            else
            {
                clientebll.CadastrarCliente(cliente);

                Session.Add("cliente", cliente);
                Response.Redirect("Default.aspx");
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Carga los datos si se requiere actualiar o editar
            /// </summary>
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    lblTitulo.Text = "Modificar Recinto";
                    RecintoBLL recintoBLL = new RecintoBLL();
                    RecintoBEL recBEL     = recintoBLL.traerRecintoPorId(Int32.Parse(Request.QueryString["id"]));
                    ClienteBLL cliBLL     = new ClienteBLL();
                    txtNombre.Text    = recBEL.NombreRecinto;
                    txtDireccion.Text = recBEL.DireccionRecinto;
                    idRecinto.Text    = recBEL.IdRecinto.ToString();
                    lblEstado.Text    = recBEL.IdEstado.ToString();
                    comuna            = recBEL.IdComuna;
                    clicomuna         = cliBLL.traerComuna(comuna);
                    cliregion         = cliBLL.traerRegion(clicomuna.IdRegion);
                }
                RegionBLL regionBLL = new RegionBLL();

                List <RegionBEL> regBEL = regionBLL.traerRegiones();

                ddlRegion.DataSource     = regBEL;
                ddlRegion.DataValueField = "IdRegion";
                ddlRegion.DataTextField  = "Nombre";
                ddlRegion.DataBind();
                ddlRegion.Items.Insert(0, new ListItem(cliregion.Nombre, clicomuna.IdRegion.ToString()));
                ddlComuna.Items.Insert(0, new ListItem(clicomuna.Nombre, clicomuna.IdComuna.ToString()));
            }
        }
コード例 #17
0
        private void LoadDadosCliente(long?id = null, string CodInteg = "")
        {
            clienteBLL = new ClienteBLL();
            Cliente cliente = new Cliente();

            if (id != null)
            {
                cliente = clienteBLL.Localizar(id);
            }
            else if (!string.IsNullOrEmpty(CodInteg))
            {
                if (CodInteg.Where(c => char.IsNumber(c)).Count() >= 11)
                {
                    string strCPF, strCNPJ = string.Empty;
                    strCPF  = Convert.ToInt64(CodInteg).ToString(@"000\.000\.000\-00");
                    strCNPJ = Convert.ToInt64(CodInteg).ToString(@"00\.000\.000\/0000\-00");
                    cliente = clienteBLL.getCliente(p => p.cnpj_cpf == strCPF || p.cnpj_cpf == strCNPJ).FirstOrDefault();
                }
                else if ((CodInteg.Where(c => char.IsNumber(c)).Count() > 0) && (CodInteg.Where(c => char.IsNumber(c)).Count() < 11))
                {
                    cliente = clienteBLL.getCliente(p => p.codigo_cliente_integracao == CodInteg).FirstOrDefault();
                }
            }

            if (cliente != null)
            {
                txtIdCliente.Text        = cliente.Id.ToString();
                txtCodCliIntegracao.Text = cliente.codigo_cliente_integracao;
                txtClienteNome.Text      = cliente.nome_fantasia;
                cbCategoria.Focus();
            }
        }
コード例 #18
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (txtIdCliente.Text != string.Empty)
            {
                AtualizarProduto();
            }
            else
            {
                cliente.NOME = txtNomeCliente.Text;
                cliente.EMAIL = txtEmail.Text;
                cliente.SENHA = txtSenha.Text;
                cliente.DATA_CADASTRO = DateTime.Now;

                clientesBLL.Add(cliente);
                clientesBLL.SaveChanges();

                int codi = cliente.IDT_CLIENTE;

                BuscarClientes();

                clientesBLL = null;
                cliente = null;
                LimparCampos();
            }
        }
コード例 #19
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorPanel.Visible = false;
                int clienteId = Convert.ToInt32(ClienteIdHiddenField.Value);

                Cliente obj = new Cliente()
                {
                    ClienteId = clienteId,
                    Nombre    = NombreTextBox.Text,
                    Nit       = NitTextBox.Text
                };

                if (clienteId == 0)
                {
                    ClienteBLL.InsertarCliente(obj);
                }
                else
                {
                    ClienteBLL.ActualizarCliente(obj);
                }
            }
            catch (Exception ex)
            {
                ErrorPanel.Visible = true;
                return;
            }

            Response.Redirect("~/ListaClientes.aspx");
        }
コード例 #20
0
        private void LoadDadosCliente(long?id, string codCliente = "", TextBox txtId = null, TextBox txtCod = null, TextBox txtDesc = null)
        {
            ClienteBLL clienteBLL = new ClienteBLL();

            List <Cliente> ClienteList = new List <Cliente>();

            if (id != null)
            {
                ClienteList = clienteBLL.getCliente(id, true);
            }
            else if (!string.IsNullOrEmpty(codCliente))
            {
                ClienteList = clienteBLL.getCliente(p => p.codigo_cliente_integracao == codCliente, true);
            }

            if (ClienteList.Count() > 0)
            {
                Cliente cliente = ClienteList.FirstOrDefault();
                if (txtCod != null)
                {
                    txtCod.Text  = cliente.codigo_cliente_integracao;
                    txtDesc.Text = cliente.razao_social;
                    txtId.Text   = cliente.Id.ToString();
                }
            }
        }
コード例 #21
0
        public static IClienteDAL ObterClienteBLL()
        {
            var dal = new ClienteDAL();
            var bll = new ClienteBLL(dal);

            return(bll);
        }
コード例 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            string strId = Request.QueryString["id"];

            if (string.IsNullOrEmpty(strId))
            {
                return;
            }
            try
            {
                int     clienteId = Convert.ToInt32(strId);
                Cliente obj       = ClienteBLL.GetCLienteById(clienteId);

                NombreTextBox.Text = obj.Nombre;
                NitTextBox.Text    = obj.Nit;

                ClienteIdHiddenField.Value = strId;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #23
0
        private void ExecutaPesquisaCliente()
        {
            frmPesquisaFornecedor pesquisa = new frmPesquisaFornecedor();

            if (pesquisa.ExibeDialogo(txtCodCliIntegracao.Text) == DialogResult.OK)
            {
                if (pesquisa.Id != null)
                {
                    clienteBLL = new ClienteBLL();
                    Cliente cliente = clienteBLL.Localizar(pesquisa.Id);
                    if (cliente != null)
                    {
                        txtCodCliIntegracao.Text = cliente.codigo_cliente_integracao;
                        txtClienteNome.Text      = cliente.nome_fantasia;
                        txtIdCliente.Text        = cliente.Id.ToString();
                        cbCategoria.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Fornecedor não localizado.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCodCliIntegracao.Text = String.Empty;
                }
            }
            else
            {
                txtCodCliIntegracao.Text = string.Empty;
                txtCodCliIntegracao.Focus();
            }
        }
コード例 #24
0
        private void btn_alterar_Click(object sender, EventArgs e)
        {
            string email         = txtEmail.Text;
            string senhaNova     = txtSenhaNova.Text;
            string confirmaSenha = txtConfirmaSenha.Text;

            ClienteBLL objBLL = new ClienteBLL();

            if (objBLL.ValidarLogin(email) == false)
            {
                MessageBox.Show("O email informado não existe.");
            }
            else
            {
                if (senhaNova == confirmaSenha)
                {
                    objBLL.AlterarSenha(email, senhaNova);
                    MessageBox.Show("Senha alterada com sucesso.");
                }
                else
                {
                    MessageBox.Show("As senhas informadas estão diferentes.");
                }
            }
        }
コード例 #25
0
        public void ObtenerPresupuestos()

        {
            ListaPresupuestos = bllPresup.ListarPresupuestos();
            ClienteBLL bllCli = new ClienteBLL();
            UsuarioBLL bllUs  = new UsuarioBLL();
        }
コード例 #26
0
 protected void BtnEntrar_Click(object sender, EventArgs e)
 {
     try
     {
         // Instanciar o objeto ClienteDTO
         ClienteDTO clienteDTO = new ClienteDTO();
         clienteDTO.Email = txtEmail.Text;
         clienteDTO.Senha = txtSenha.Text;
         //Instanciar o objeto ClienteBLL
         ClienteBLL clienteBLL = new ClienteBLL();
         if (clienteBLL.Autenticar(clienteDTO.Email, clienteDTO.Senha))
         {
             Session["emailUsuario"] = clienteDTO.Email;
             msgOK.Visible           = true;
             msgOK.Text = "Seja bem-vindo!";
             Response.Redirect("formMeuPerfil.aspx");
         }
         else
         {
             msgErro.Visible = true;
             msgErro.Text    = "Cliente não encontrado!";
         }
     }
     catch (Exception ex)
     {
         msgErro.Visible = true;
         msgErro.Text    = ex.Message;
     }
 }
コード例 #27
0
        private void btn_entrar_Click(object sender, EventArgs e)
        {
            try
            {
                string emailUsuario  = txtEmail.Text;
                string senhalUsuario = txtSenha.Text;

                ClienteBLL objClienteBLL = new ClienteBLL();

                if (objClienteBLL.ValidarLogin(emailUsuario, senhalUsuario) == true)
                {
                    MessageBox.Show("Acesso Permitido.");
                    int acesso = objClienteBLL.ValidarAcesso(emailUsuario, senhalUsuario);
                    if (acesso != -1)
                    {
                        MessageBox.Show("Nível de acesso do usuário: " + acesso);
                    }
                }
                else if (objClienteBLL.ValidarLogin(emailUsuario) == false)
                {
                    MessageBox.Show("Email não existente.");
                }
                else
                {
                    MessageBox.Show("Acesso NEGADO. Dados incorretos. Verifique.");
                }
            }catch (FormatException ex)
            {
                MessageBox.Show("Atenção aos valores fornecidos. \n" + ex);
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #28
0
        public void IncluirNomeNotNullTest()
        {
            var cliente = new Cliente()
            {
                Nome     = "José da Silva",
                Email    = "*****@*****.**",
                Telefone = "9348934"
            };

            var dal = new ClienteDALMock();
            var bll = new ClienteBLL(dal);

            bool ok = false;

            try
            {
                bll.Incluir(cliente);
                ok = true;
            }
            catch (ApplicationException)
            {
                ok = false;
            }

            Assert.IsTrue(ok, "Deveria ter disparado um Exception");
        }
コード例 #29
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            InfoCliente ic = new InfoCliente();

            ic.Cliente  = txtCliente.Text;
            ic.Telefone = txtTel.Text;
            ic.Endereco = txtEnd.Text;

            /*
             * string cliente;
             * string telefone;
             * string endereco;
             *
             * cliente = "'";
             * cliente += txtCliente.Text;
             * cliente += "'";
             *
             * telefone = "'";
             * telefone += txtTel.Text;
             * telefone += "'";
             *
             * endereco = "'";
             * endereco += txtEnd.Text;
             * endereco += "'";
             */

            ClienteBLL obj = new ClienteBLL();

            lblStatus.Text = obj.Inserir(ic);

            AtualizaGrid();
            Limpa();
            txtCliente.Focus();
        }
コード例 #30
0
        //visualiza dados da tabela Cliente
        private void AtualizaGrid()
        {
            ClienteBLL obj = new ClienteBLL();

            dgvClientes.DataSource = obj.Listagem();
            //Format();
        }
コード例 #31
0
        public void GenerarPedido()
        {
            var PedidosRepo = new PedidosBLL();
            var auxPedido   = new PedidoCab();

            auxPedido.FechaAlta = DateTime.Now;
            auxPedido.Estado    = "I";

            var clienteLogueado = JsonConvert.DeserializeObject <Cliente>(Session.GetString("UsuarioLogueado"));

            var auxCliente = new ClienteBLL().Listar().FirstOrDefault(x => x.Dni == clienteLogueado.Dni);

            auxPedido.ClienteId = auxCliente.Id;

            foreach (var item in this.Compra.Items)
            {
                var auxPedidoDet = new PedidoDet();
                auxPedidoDet.Cantidad     = item.Cantidad;
                auxPedidoDet.InventarioId = item.ItemInventario.Id;
                item.Calcular();
                auxPedidoDet.Subtotal += item.SubTotal;
                auxPedido.PedidoDet.Add(auxPedidoDet);
            }

            PedidosRepo.Agregar(auxPedido);
        }
コード例 #32
0
        public ActionResult Create(ClienteViewModel model)
        {
            ClienteBLL bll     = new ClienteBLL();
            Cliente    cliente = CustomAutoMapper <ClienteViewModel, Cliente> .Map(model);

            try
            {
                bll.Inserir(cliente);
            }
            //Erro nas validações do BLL
            catch (HotelException ex)
            {
                //Forma de comunicar a View que existem erros!
                //Pode-se utilizar também o TempData["Errors"]
                ViewBag.Errors = ex.GetErrorMessage();
                return(View());
            }
            //Erro no banco
            catch (Exception ex)
            {
                ViewBag.Errors = "Erro no banco de dados, contate o adm";
                return(View());
            }
            return(RedirectToAction("Index", "Cliente"));
        }
コード例 #33
0
ファイル: ClienteDAL.cs プロジェクト: Danie8/InterfazRastreo
        //Metodo CRUD DELETE
        public bool Eliminar(ClienteBLL clienteBLL)
        {
            SqlCommand sqlCommand = new SqlCommand("DELETE FROM Cliente WHERE ID = @ID"); //Creamos el comando

            sqlCommand.Parameters.Add("@ID", SqlDbType.Int).Value = clienteBLL.ID;        //Agregamos los parametros
            return(conexion.EjecutarComandoSinRetornoDatos(sqlCommand));                  //Ejecutamos el comando
        }
コード例 #34
0
ファイル: PesqCliente.aspx.cs プロジェクト: vsantoscte/SOTRE
        protected void imgDeletar_Click(object sender, ImageClickEventArgs e)
        {
            ClienteBLL clienteBLL = new ClienteBLL();

            clienteBLL.Excluir(int.Parse(((ImageButton)sender).CommandArgument));

            this.CarregarTelaCliente();
        }
コード例 #35
0
ファイル: Teste.aspx.cs プロジェクト: repositoryBarros/Loja
        public void BuscarClientes()
        {
            ClienteBLL cliente = new ClienteBLL();

            grdClientes.DataSource = cliente.GetAll();
            grdClientes.DataBind();

            cliente = null;
        }
コード例 #36
0
ファイル: PesqCliente.aspx.cs プロジェクト: vsantoscte/SOTRE
        private void CarregarTelaCliente()
        {
            IQueryable<Cliente> queryCliente = new ClienteBLL().ObterTodos();

            IQueryable<Tipo_Cliente> queryTipoCliente = new TipoClienteBLL().ObterTodos();

            grvCliente.DataSource = (from c in queryCliente
                                     join t in queryTipoCliente on c.cd_tipo equals t.id_tipo
                                     select new { ID = c.id_cliente, cpf_cnpj = c.nm_cpf_cnpj, tipo = t.nm_descricao_tipo, nome = c.nm_nome, bairro = c.nm_bairro, cep = c.nm_cep });
            grvCliente.DataBind();

            this.upCadastroCliente.Update();
        }
コード例 #37
0
        protected void btnEntrar_Click(object sender, EventArgs e)
        {
            ClienteBLL clientebll = new ClienteBLL();
            CLIENTE cliente = new CLIENTE();

            cliente = clientebll.AutenticarCliente(txtEmail.Text.Trim(), txtSenha.Text.Trim());

            if (cliente != null)
            {
                Session.Add("cliente", cliente);

                //Tirar objeto da memória
                cliente = null;

                Response.Redirect("Default.aspx");
            }
            else
            {
                lblmsg.Visible = true;
                lblmsg.Text = "Email ou Senha inválidos.";
            }
        }