Esempio n. 1
0
        public bool CreateCliente(ClientesDTO DTO)
        {
            bool sucess = false;

            try
            {
                var data  = DateTime.Now.ToString();
                var query = "INSERT INTO cliente (rsocial, fantasia, data, USUARIO_id, CATEGORIA_CLIENTE_id) VALUES('" + DTO.Razao_Social + "', '" + DTO.Nome_Fantasia + "', '" + data + "', '" + Logindto.Id + "' , '" + DTO.Categoria_Id + "')";
                bd.Conectar();
                bd.ExecutarComandoSQL(query);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                sucess = true;
                bd.CloseConection();
            }
            if (sucess)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        GetLoginResponse ILoginService.LoginResponse(GetLoginRequest prmLoginRequest)
        {
            GetLoginResponse loginResponse = new GetLoginResponse();

            try
            {
                ClientesDTO clientesDTO;
                ICustomerServiceBusiness iCSBusiness;

                clientesDTO = new ClientesDTO
                {
                    User     = prmLoginRequest.Login.User,
                    Password = prmLoginRequest.Login.Password
                };

                iCSBusiness   = new CustomerServicesBusiness();
                loginResponse = iCSBusiness.GetResultLoginDTOs(clientesDTO);
            }
            catch (Exception ex)
            {
                loginResponse.status.CodeResp    = "01";
                loginResponse.status.MessageResp = "Error en el Servicio";
                Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO CustomerService:LoginCustomer " + ex.Message);
                throw ex;
            }


            return(loginResponse);
        }
Esempio n. 3
0
        public void insertOnDB(string query, ClientesDTO dto)
        {
            conn.ConnectionString = Conexao.cn;

            try{
                conn.Open();
                try
                {
                    conn.Execute(query, new { nome = dto.nome, email = dto.email });
                    Console.WriteLine("Dados inseridos com sucesso!");
                }
                catch (Exception e)
                {
                    Console.WriteLine("Erro ao inserir dados: " + e.Message);
                }
            }
            catch (Exception e) {
                Console.WriteLine("Erro ao abrir o banco: " + e.Message);
            }
            finally{
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
Esempio n. 4
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            txtbxNome.Enabled     = false;
            txtbxTelefone.Enabled = false;
            btnConfirmar.Enabled  = false;
            cbxID.Enabled         = true;
            btnAlterar.Enabled    = true;
            clienteDto            = this.clientes[cbxID.SelectedIndex];
            clienteDto.Nome       = txtbxNome.Text;
            clienteDto.Telefone   = txtbxTelefone.Text;
            bool foiPossivel = clienteBll.AttCliente(clienteDto);

            if (foiPossivel)
            {
                this.clientes = clienteBll.Read();
                cbxID.Items.Clear();
                if (this.clientes != null)
                {
                    foreach (ClientesDTO c in this.clientes)
                    {
                        cbxID.Items.Add(c.Id);
                    }
                }
                MessageBox.Show("Foi possível atualizar", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Não foi possível atualizar", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        public static int Update(ClientesDTO clientes)
        {
            int rowsAffected = 0;

            using (SqlConnection conn = new SqlConnection(DAOHelper.connectionString))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "UPDATE Clientes SET Nombre='[Nombre]', Direccion='[Direccion]', Telefono='[Telefono]', Email='[Email]' WHERE Id=" + clientes.Id;

                    //Reemplazo los valores de los campos en el query.
                    cmd.CommandText = cmd.CommandText.Replace("[Nombre]", clientes.Nombre);
                    cmd.CommandText = cmd.CommandText.Replace("[Direccion]", clientes.Direccion);
                    cmd.CommandText = cmd.CommandText.Replace("[Telefono]", clientes.Telefono);
                    cmd.CommandText = cmd.CommandText.Replace("[Email]", clientes.Email);

                    //Ejecuto el update.
                    rowsAffected = cmd.ExecuteNonQuery();
                }
            }

            return(rowsAffected);
        }
Esempio n. 6
0
        protected void btIniciar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(txUsuario.Text) ||
                    string.IsNullOrWhiteSpace(txContraseña.Text))
                {
                    lbMsg.Text = "Ingrese nombre de usuario y contraseña.";
                    return;
                }
                ClientesDTO cliente = null;
                cliente = ws.Login(txUsuario.Text, txContraseña.Text);

                if (cliente != null)
                {
                    cliente.Nombre = txUsuario.Text;
                    Session.Add("cliente", cliente);
                    Response.Redirect("Homepage.aspx");
                }
                else
                {
                    lbMsg.Text = "Nombre de usuario o contraseña incorrecta.";
                }
            }
            catch (Exception ex)
            {
                lbMsg.Text = ex.Message;
            }
        }
Esempio n. 7
0
        public JsonResult GuardarCliente(int idCliente, int frIdEmpresa, string Nombre, string RazonSocial, string RFC, string calle, string Exterior, string Interior, string Colonia, short CP, string DelMpio, string EstadoDomicilio, string diasPago, int estado)
        {
            var cliente = new ClientesDTO();

            cliente.Id_Cliente           = idCliente;
            cliente.Id_Empresa           = frIdEmpresa;
            cliente.Nombre_Cliente       = Nombre;
            cliente.Razon_Social_Cliente = RazonSocial;
            cliente.RFC_Cliente          = RFC;
            cliente.Calle_Cliente        = calle;
            cliente.Exterior_Cliente     = Exterior;
            cliente.Interior_Cliente     = Interior;
            cliente.Colonia_Cliente      = Colonia;
            cliente.DelMun_Cliente       = DelMpio;
            cliente.CP_Cliente           = CP;
            cliente.Estado_Dom_Cliente   = EstadoDomicilio;
            cliente.Dias_de_Pago_Cliente = diasPago;
            cliente.Estado = estado == 1;

            //public virtual ICollection<ContactosDTO> Contactos =
            var obj = new ClienteData().GuardarCliente(cliente);

            if (obj.Code != 0)
            {
                return(Json(new { success = false, message = obj.Message }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public List <ClientesDTO> Read()
        {
            MySqlDataReader    dR       = ReadDr();
            List <ClientesDTO> clientes = new List <ClientesDTO>();

            try
            {
                if (dR != null)
                {
                    do
                    {
                        ClientesDTO cliente = new ClientesDTO();
                        cliente.Id       = Convert.ToInt32(dR["ID"].ToString());
                        cliente.Nome     = dR["Nome"].ToString();
                        cliente.Compras  = Convert.ToInt32(dR["Pedidos"].ToString());
                        cliente.Telefone = dR["Telefone"].ToString();
                        clientes.Add(cliente);
                    } while (dR.Read());
                }
                if (clientes.Count == 0)
                {
                    return(null);
                }
                return(clientes);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 9
0
        public int LoginClientes(ClientesDTO clientesDTO)
        {
            int     rsta;
            DataSet dsLogin;

            try
            {
                strPLSQL = "SELECT CUSTID FROM CUSTOMER WHERE USUARIO = '" + clientesDTO.User.ToString() + "' AND PASSWORD = '******'";
                OracleServerHelper OrclConection = new OracleServerHelper();

                dsLogin = OrclConection.ExecuteSqlToDataSet(strPLSQL, new List <OracleParameter>());

                if (dsLogin != null && dsLogin.Tables[0].Rows.Count > 0)
                {
                    rsta = 1;
                }
                else
                {
                    rsta = 0;
                }
            }
            catch (Exception ex)
            {
                rsta = 0;
                Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN DAL Clientes: LOGIN");
                Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + ex.Message);
            }

            return(rsta);
        }
Esempio n. 10
0
        public int AgregaSorteo()
        {
            try
            {
                Premio            = new PremioDTO();
                Cliente           = new ClientesDTO();
                Voucher           = new VoucherDTO();
                Premio.IdPremio   = this.premioid;
                Cliente.Clienteid = this.clienteid;
                Voucher.IdVoucher = this.voucherid;

                if (Premio.GetPremioByID() && Cliente.GetClientByID() && (Voucher.GetVoucherById() == 0))
                {
                    SorteoDTO sorteo = new SorteoDTO();
                    sorteo.Clienteid = this.clienteid;
                    sorteo.IdPremio  = this.premioid;
                    sorteo.IdVoucher = this.voucherid;

                    this.IdSorteo = sorteo.addSorteo();

                    if (this.IdSorteo != -1)
                    {
                        return(IdSorteo);
                    }
                }
            }
            catch (Exception ex)
            {
                return(-1);
            }

            return(-1);
        }
Esempio n. 11
0
        private void btGuardar_Click(object sender, EventArgs e)
        {
            //Es update?
            if (clientes != null)
            {
                clientes.Nombre    = txNombre.Text;
                clientes.Direccion = txDireccion.Text;
                clientes.Telefono  = txTelefono.Text;
                clientes.Email     = txMail.Text;

                VentasCapas.Business.Clientes.Actualizar(clientes);
                this.Close();
            }
            else
            {
                //Es create.
                clientes = new ClientesDTO();

                clientes.Nombre    = txNombre.Text;
                clientes.Direccion = txDireccion.Text;
                clientes.Telefono  = txTelefono.Text;
                clientes.Email     = txMail.Text;

                VentasCapas.Business.Clientes.Crear(clientes);
                this.Close();
            }
        }
Esempio n. 12
0
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            try
            {
                UsuarioDTO        user       = UserSession.UsuarioLogado;
                UsuarioPermissoes chamar     = new UsuarioPermissoes();
                UsuarioPermissoes permissoes = chamar.Permissoes(user.Cod_Perm);

                if (permissoes.Cliente.Substring(0, 1) == "0")
                {
                    if (permissoes.Cliente.Substring(3, 1) == "0")
                    {
                        throw new ArgumentException("Você não tem autorização para fazer isto!");
                    }
                }

                ClientesDTO data = dgvClientes.CurrentRow.DataBoundItem as ClientesDTO;

                frmAlterar frm = new frmAlterar();
                Hide();
                frm.CarregarCampos(data.id_Cliente);
                frm.ShowDialog();
                Show();
                CarregarGrid();
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro não identificado.", "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            try
            {
                UsuarioDTO user = UserSession.UsuarioLogado;

                UsuarioPermissoes chamar     = new UsuarioPermissoes();
                UsuarioPermissoes permissoes = chamar.Permissoes(user.Cod_Perm);

                if (permissoes.Cliente.Substring(0, 1) == "0")
                {
                    if (permissoes.Cliente.Substring(4, 1) == "0")
                    {
                        throw new ArgumentException("Você não tem autorização para fazer isto!");
                    }
                }

                ClientesDTO data = dgvClientes.CurrentRow.DataBoundItem as ClientesDTO;

                ClientesBusiness business = new ClientesBusiness();
                business.RemoverCliente(data.id_Cliente);

                MessageBox.Show("Cliente Removido com Sucesso!", "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CarregarGrid();
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro não identificado.", "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 14
0
        private void btnEditarCliente_Click(object sender, EventArgs e)
        {
            {
                // instanciar o objeto
                EditarClientes editarclientes = new EditarClientes();
                ClientesDTO    dados          = new ClientesDTO();

                //Receber os dados dos TXT's
                dados.Nome      = txtNome.Text;
                dados.CNPJ      = txtCNPJ.Text;
                dados.Endereco  = txtEndereco.Text;
                dados.CEP       = txtCEP.Text;
                dados.Bairro    = txtBairro.Text;
                dados.Municipio = txtMunicipio.Text;
                dados.Estado    = txtEstado.Text;
                dados.IE        = txtIE.Text;
                dados.Telefone  = txtTelefone.Text;
                dados.Telefone2 = txtTelefone2.Text;
                dados.Email     = txtEmail.Text;
                dados.Email2    = txtEmail_2.Text;


                //executar o método
                editarclientes.EditarClientesGRID(dados);
                //Limpar grid
                dgvClientes.Rows.Clear();

                btnPesquisarCliente_Click(null, null);

                MessageBox.Show(dados.msg, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 15
0
        public static ClientesDTO Create(ClientesDTO clientes)
        {
            int rowsAffected = 0;

            using (SqlConnection conn = new SqlConnection(DAOHelper.connectionString))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = @"INSERT INTO Clientes (Id, Nombre, Direccion, Telefono, Email) 
                                        VALUES ([id],'[nombre]','[direccion]','[telefono]','[email]')";

                    int proximoId = DAOHelper.GetNextId("Clientes");
                    clientes.Id = proximoId;

                    //Reemplazo los valores de los campos en el query.
                    cmd.CommandText = cmd.CommandText.Replace("[id]", proximoId.ToString());
                    cmd.CommandText = cmd.CommandText.Replace("[nombre]", clientes.Nombre).ToString();
                    cmd.CommandText = cmd.CommandText.Replace("[direccion]", clientes.Direccion).ToString();
                    cmd.CommandText = cmd.CommandText.Replace("[telefono]", clientes.Telefono).ToString();
                    cmd.CommandText = cmd.CommandText.Replace("[email]", clientes.Email).ToString();

                    //Ejecuto el update.
                    rowsAffected = cmd.ExecuteNonQuery();
                }
            }

            return(clientes);
        }
Esempio n. 16
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                ClientesDTO dto = new ClientesDTO();
                dto.nm_Nome        = txtNome.Text;
                dto.ds_CPF         = txtCPF.Text;
                dto.ds_CEP         = txtCEP.Text;
                dto.ds_Logradouro  = txtLogradouro.Text;
                dto.ds_Bairro      = txtBairro.Text;
                dto.ds_UF          = txtUF.Text;
                dto.ds_Complemento = txtComplemento.Text;
                dto.ds_Email       = txtEmail.Text;
                dto.num_Celular    = txtNCelular.Text;
                dto.num_Telefone   = txtNTelefone.Text;

                ClientesBusiness business = new ClientesBusiness();
                business.AlterarCliente(dto);

                MessageBox.Show("Cliente cadastrado com sucesso!", "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro não identificado.", "Black Fit LTDA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 17
0
        private void btnok_Click(object sender, EventArgs e)
        {
            //Verificar se os campos foram preenchidos

            if (txtNomeCliente.Text == string.Empty)
            {
                MessageBox.Show("Favor preencher o campo", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtNomeCliente.Focus();
            }


            //Instaciar as classes do clientesDTO
            ClientesDTO   dados  = new ClientesDTO();
            SalvarCliente salvar = new SalvarCliente();

            mskCep.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;

            //popular
            //dados.codigocliente = Convert.ToInt32(txtCodigo.Text);
            dados.nomedocliente  = txtNomeCliente.Text;
            dados.datanascimento = msknascimento.Text;
            dados.CPF            = txtcpf.Text;
            dados.telefone       = txttelcliente.Text;
            dados.email          = txtemail.Text;
            dados.CEP            = mskCep.Text;
            dados.endereco       = txtendereco.Text;
            dados.cidade         = txtcidade.Text;
            dados.UF             = txtuf.Text;
            dados.como_nos_achou = txtachou.Text;


            //Chamar o método para gravar os dados
            salvar.IncluirClientes(dados);



            //Mensagem de retorno da DTO
            MessageBox.Show(dados.msg, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);

            txtcodcliente.Text = dados.codcliente.ToString();



            //Limpar os campos
            txtNomeCliente.Clear();
            txtcodcliente.Clear();
            txtcpf.Clear();
            msknascimento.Clear();
            txtemail.Clear();
            txttelcliente.Clear();
            mskCep.Clear();
            txtcidade.Clear();
            txtuf.Clear();
            txtendereco.Clear();
        }
Esempio n. 18
0
        private string ConfiguracionParametrosGetPaginado(ClientesDTO clientesDTO)
        {
            string strWhere = "WHERE AX.registro BETWEEN";

            if (clientesDTO.Pagina != 0 && clientesDTO.RegsxPagina != 0)
            {
                strWhere = strWhere + "(" + clientesDTO.Pagina.ToString() + " - 1) * " + clientesDTO.RegsxPagina.ToString() + " + 1 AND " + clientesDTO.Pagina.ToString() + " * " + clientesDTO.RegsxPagina.ToString();
            }

            return(strWhere);
        }
Esempio n. 19
0
        public static void Main(string[] args)
        {
            ClientesDTO dto = new ClientesDTO()
            {
                nome = "Gabriel Tamura Mamiya", email = "*****@*****.**"
            };
            ClientesBLL bll = new ClientesBLL();

            //bll.inserirDados(dto);
            bll.pegarDados();
        }
Esempio n. 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //--
            if (this.Page.Session["cliente"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            ClientesDTO cliente = (ClientesDTO)this.Page.Session["cliente"];

            lbUser.Text = "Cliente: " + cliente.Nombre.Trim();
        }
Esempio n. 21
0
        public async Task <IActionResult> GetLoginAsync([FromBody] ClientesDTO clienteDto)
        {
            var response = await _clienteApplication.GetLoginAsync(clienteDto.Correo, clienteDto.Password);

            if (response.IsSuccess)
            {
                response.Data.Token = BuildToken(response);
                return(Ok(response));
            }

            return(BadRequest(response.Message));
        }
Esempio n. 22
0
        GetCustomerResponse ICustomerService.GetCustomer(GetCustomerRequest prmcustomerRequest)
        {
            GetCustomerResponse customerResponse = new GetCustomerResponse();

            try
            {
                ClientesDTO clientesDTO;
                ICustomerServiceBusiness iCSBusiness;

                clientesDTO = new ClientesDTO
                {
                    CodTypeIdent = prmcustomerRequest.Customer.IdType,
                    CustID       = prmcustomerRequest.Customer.IdNumber,
                    FName        = prmcustomerRequest.Customer.FirstName,
                    LName        = prmcustomerRequest.Customer.LastNames,
                    Email        = prmcustomerRequest.Customer.Email,
                    PhoneNumber  = prmcustomerRequest.Customer.PhoneNumber,
                    Address      = prmcustomerRequest.Customer.Address,
                    City         = prmcustomerRequest.Customer.City,
                    Country      = prmcustomerRequest.Customer.Country,
                    User         = prmcustomerRequest.Customer.User,
                    Status       = prmcustomerRequest.Customer.StatusCustomer,
                    Pagina       = prmcustomerRequest.Customer.Page,
                    RegsxPagina  = prmcustomerRequest.Customer.RegsPerPage,
                    RegsTotales  = prmcustomerRequest.Customer.TotalsRegs,
                    FechaIniFact = prmcustomerRequest.Customer.DateIniFact,
                    FechaFinFact = prmcustomerRequest.Customer.DateFinFact,
                    Evento       = prmcustomerRequest.Customer.EventType,
                    ID           = prmcustomerRequest.Customer.IdUser
                };

                if (clientesDTO.Pagina == 0)
                {
                    iCSBusiness      = new CustomerServicesBusiness();
                    customerResponse = iCSBusiness.GetResultCustomerDTOs(clientesDTO);
                }
                else
                {
                    iCSBusiness      = new CustomerServicesBusiness();
                    customerResponse = iCSBusiness.GetResultCustomerDTOsPaginado(clientesDTO);
                }
            }
            catch (Exception ex)
            {
                customerResponse.status.CodeResp    = "";
                customerResponse.status.MessageResp = "";
                Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO CustomerService:GetCustomer " + ex.Message);
                throw ex;
            }

            return(customerResponse);
        }
        public ClientesDTO MapperDTO(Clientes clientes)
        {
            ClientesDTO clienteDTO = new ClientesDTO
            {
                Id             = clientes.Id,
                Nome           = clientes.Nome,
                Cpf            = clientes.Cpf,
                DataNascimento = clientes.DataNascimento,
                Idade          = clientes.Idade
            };

            return(clienteDTO);
        }
        public async Task <IActionResult> PostClientes([FromBody] ClientesDTO clientes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var map = Mapper.Map <Clientes>(clientes);

            _context.Clientes.Add(map);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetClientes", new { id = map.Id }, clientes));
        }
        public Clientes MapperUnidadeClientes(ClientesDTO clientesDTO)
        {
            Clientes clientes = new Clientes
            {
                Id             = clientesDTO.Id,
                Nome           = clientesDTO.Nome,
                Cpf            = clientesDTO.Cpf,
                Idade          = clientesDTO.Idade,
                DataNascimento = clientesDTO.DataNascimento
            };

            return(clientes);
        }
Esempio n. 26
0
 public bool ExcluirCliente(ClientesDTO cliente)
 {
     try
     {
         Delete(cliente);
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
Esempio n. 27
0
        public string GetClienteMorales(string search)
        {
            List <string> lSearch    = search.Split(new char[] { ' ' }).ToList();
            var           oneCliente = new ClientesDTO();

            oneCliente.Nombre = "%" + search.Trim() + "%";
            string query =
                "Select * from Table_Catalogo_Clientes where Nombre like @Nombre and Activo = 1 or RFC like @Nombre and Activo = 1";
            Helpers h    = new Helpers();
            var     lMed = h.GetAllParametized(query, oneCliente);
            string  json = JsonConvert.SerializeObject(lMed);

            return(json);
        }
Esempio n. 28
0
 public EditarCliente(ClientesDTO DTO)
 {
     InitializeComponent();
     MaxHeight                      = SystemParameters.MaximizedPrimaryScreenHeight;
     MaxWidth                       = SystemParameters.MaximizedPrimaryScreenWidth;
     txtRazao.Text                  = DTO.Razao_Social;
     txtFantasia.Text               = DTO.Nome_Fantasia;
     cmbCategoria.ItemsSource       = Categoriabll.LoadCategoriaCliente();
     cmbCategoria.DisplayMemberPath = "Descricao";
     cmbCategoria.SelectedValuePath = "Id";
     cmbCategoria.SelectedValue     = DTO.Categoria_Id;
     cbxStatus.IsChecked            = Convert.ToBoolean(DTO.Status);
     id = DTO.Id;
 }
Esempio n. 29
0
 public bool AttCliente(ClientesDTO cliente)
 {
     try
     {
         cliente.Nome     = cliente.Nome.Replace("'", "''");
         cliente.Telefone = cliente.Telefone.Replace("'", "''");
         Update(cliente);
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
        private void frmCadastrarOS_Load(object sender, EventArgs e)
        {
            DateTime now  = DateTime.Now;
            String   date = now.GetDateTimeFormats('d')[0];

            txtDataOS.Text = date;

            //Instanciar objeto
            PesquisaClienteOS pesquisaclienteos = new PesquisaClienteOS();
            ClientesDTO       dados             = new ClientesDTO();

            //recebe dados do combobox
            dados.Nome = "";

            //executa o método
            pesquisaclienteos.CarregarCOMBOBOXClientes(dados);



            //carrega o dados do DataTable atraves de um loop

            /*foreach (DataRow linha in pesquisaclienteos.ClientesDataTableOS.Rows)
             * {
             *  //Popula o ComboBox
             *  cmbCarregarClientes.Items.Add(linha.ItemArray[0]);
             *
             * }*/

            //Instanciar objeto
            PesquisaProdutosOS pesquisaprodutosos = new PesquisaProdutosOS();
            ProdutosDTO        dadosproduto       = new ProdutosDTO();

            //recebe dados do combobox
            dadosproduto.Descricao = "";

            //executa o método
            pesquisaprodutosos.CarregarCOMBOBOXProdutos(dadosproduto);


            //carrega o dados do DataTable atraves de um loop

            /*foreach (DataRow linha in pesquisaprodutosos.ProdutosDataTableOS.Rows)
             * {
             *  //Popula o ComboBox
             *  cmbCarregarProdutos.Items.Add(linha.ItemArray[1]);
             *
             * }*/
        }