protected override void excluirRegistro(int Id) { base.excluirRegistro(Id); ProdutoBLL = new ProdutoBLL(); try { if (Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value) > 0) { Produto Produto = ProdutoBLL.Localizar(Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value)); if (MessageBox.Show("Deseja realmente excluir o registro : " + Produto.id.ToString() + " - " + Produto.descricao, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ProdutoBLL.ExcluirProduto(Produto); bool intOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateProdutoOmie = Convert.ToBoolean(Parametro.GetParametro("updateProdutoOmie")); ProdutoProxy proxy = new ProdutoProxy(); if (intOmie & updateProdutoOmie) { if (Produto.codigo_produto > 0) { proxy.ExcluirProduto(Produto); } } } } } finally { ProdutoBLL.Dispose(); } }
protected override void excluirRegistro(int Id) { base.excluirRegistro(Id); VendedorBLL = new VendedorBLL(); if (Convert.ToInt32(dgvDados[COL_ID, dgvDados.CurrentRow.Index].Value) > 0) { Vendedor Vendedor = VendedorBLL.Localizar(Convert.ToInt32(dgvDados[COL_ID, dgvDados.CurrentRow.Index].Value)); if (MessageBox.Show("Deseja realmente excluir o registro : " + Vendedor.codInt + " - " + Vendedor.nome, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { bool intOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateVendedorOmie = Convert.ToBoolean(Parametro.GetParametro("updateVendedorOmie")); string retorno = string.Empty; retorno = "Vendedor excluído com sucesso."; VendedorBLL.ExcluirVendedor(Vendedor); if ((intOmie) & (updateVendedorOmie)) { VendedorProxy proxy = new VendedorProxy(); retorno = proxy.ExcluirVendedor(Vendedor); } MessageBox.Show(retorno, Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
protected override void excluirRegistro(int Id) { base.excluirRegistro(Id); clienteBLL = new ClienteBLL(); if (Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value) > 0) { Cliente Cliente = clienteBLL.Localizar(Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value)); if (MessageBox.Show("Deseja realmente excluir o registro : " + Cliente.nome_fantasia, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { clienteBLL.ExcluirCliente(Cliente); bool intOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateClienteOmie = Convert.ToBoolean(Parametro.GetParametro("updateClienteOmie")); ClienteProxy proxy = new ClienteProxy(); proxy.usuario = Program.usuario_logado; if ((intOmie) & (updateClienteOmie)) { if (Cliente.codigo_cliente_omie > 0) { proxy.ExcluirClientes(Cliente); } } } } }
protected override bool salvar(object sender, EventArgs e) { bool Retorno = epValidaDados.Validar(true); if (Retorno) { try { ProdutoBLL = new ProdutoBLL(); ProdutoBLL.UsuarioLogado = Program.usuario_logado; ProdutoProxy proxy = new ProdutoProxy(); Produto Produto = LoadFromControls(); Produto.sincronizar = "S"; bool IntOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateProdutoOmie = Convert.ToBoolean(Parametro.GetParametro("updateProdutoOmie")); if (Id != null) { ProdutoBLL.AlterarProduto(Produto); } else { Produto.codigo_produto_integracao = Sequence.GetNextVal("sq_produto_sequence").ToString(); ProdutoBLL.AdicionarProduto(Produto); Id = Produto.id; txtId.Text = Id.ToString(); } if (IntOmie & updateProdutoOmie) { if (Produto.codigo_produto == 0) { proxy.IncluirProduto(Produto); } else { proxy.AlterarProduto(Produto); } } if (Produto.id != 0) { txtCodInt.Text = Produto.codigo_produto_integracao; } Retorno = true; } catch (Exception ex) { Retorno = false; throw ex; } } return(Retorno); }
protected override void setTamanhoPagina() { string NrRegPagListagem = Parametro.GetParametro("NrRegPag"); if (!string.IsNullOrEmpty(NrRegPagListagem)) { tamanhoPagina = Convert.ToInt32(NrRegPagListagem); } }
protected override bool salvar(object sender, EventArgs e) { bool Retorno = epValidaDados.Validar(true); if (Retorno) { try { VendedorBLL = new VendedorBLL(); VendedorBLL.UsuarioLogado = Program.usuario_logado; VendedorProxy proxy = new VendedorProxy(); bool intOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateVendedorOmie = Convert.ToBoolean(Parametro.GetParametro("updateVendedorOmie")); Vendedor Vendedor = LoadFromControls(); Vendedor.sincronizar = "S"; if (Id != null) { VendedorBLL.AlterarVendedor(Vendedor); } else { VendedorBLL.AdicionarVendedor(Vendedor); } if (Vendedor.Id != 0) { Id = Vendedor.Id; txtCodInt.Text = Vendedor.codInt; } if ((intOmie) & (updateVendedorOmie)) { if (Vendedor.codigo <= 0) { proxy.IncluirVendedor(Vendedor); } else { proxy.AlterarVendedor(Vendedor); } } Retorno = true; } catch (Exception ex) { Retorno = false; throw ex; } } return(Retorno); }
private bool ValidaDadosEspecifico() { bool retorno = true; List <Cliente> cliList = null; bool layoutLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); if (layoutLaboratorio) { ClienteBLL = new ClienteBLL(); cliList = ClienteBLL.getCliente(p => p.cnpj_cpf.Contains(txtCNPJCPF.Text), true); if (cliList.Count() > 0) { if (Id != cliList.FirstOrDefault().Id) { epValidaDados.SetError(txtCNPJCPF, "CNPJ / CPF Já está cadastrado."); MessageBox.Show("CNPJ / CPF Já está cadastrado.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); retorno = false; } } } if (Id == null) { ClienteBLL = new ClienteBLL(); cliList = ClienteBLL.getCliente(p => p.razao_social == txtRazaoSocial.Text & p.cliente_tag.Any(c => c.tag == "Cliente"), true); if (cliList.Count() > 0) { epValidaDados.SetError(txtRazaoSocial, "Razão social / Nome Completo informada já está cadastrada."); MessageBox.Show("Razão social / Nome Completo informada já está cadastrada.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); retorno = false; } if (retorno) { cliList = ClienteBLL.getCliente(p => p.nome_fantasia == txtNomeFantasia.Text & p.cliente_tag.Any(c => c.tag == "Cliente"), true); if (cliList.Count() > 0) { epValidaDados.SetError(txtNomeFantasia, "Nome Fantasia / Nome Abreviado informado já está cadastrado."); MessageBox.Show("Nome Fantasia / Nome Abreviado informado já está cadastrado.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); retorno = false; } } } return(retorno); }
private void SetupTransportadora() { bool vwLaboratorio = false; string layoutLaboratorio = Parametro.GetParametro("layoutLaboratorio"); if (!string.IsNullOrEmpty(layoutLaboratorio)) { vwLaboratorio = Convert.ToBoolean(layoutLaboratorio); } gbCaixa.Visible = vwLaboratorio; gbCaixa.Enabled = vwLaboratorio; gbTransportadora.Visible = vwLaboratorio; gbTransportadora.Enabled = vwLaboratorio; }
public virtual EndpointAddress setDadosAutenticacao(EndpointAddress Adress) { EndpointAddressBuilder builder = new EndpointAddressBuilder(Adress); string app_key = Parametro.GetParametro("app_key"); string app_secret = Parametro.GetParametro("app_secret"); builder.Headers.Add(AddressHeader.CreateAddressHeader("app_key", "", app_key)); // Coloque aqui a sua KEY de acesso builder.Headers.Add(AddressHeader.CreateAddressHeader("app_secret", "", app_secret)); // Coloque aqui a SECRET de acesso //builder.Headers.Add(AddressHeader.CreateAddressHeader("app_key", "", "1142656109")); // Coloque aqui a sua KEY de acesso //builder.Headers.Add(AddressHeader.CreateAddressHeader("app_secret", "", "66b2a456a2c92eaf9646bc95587d47f0")); // Coloque aqui a SECRET de acesso return(builder.ToEndpointAddress()); }
private void mnuCadPedidoVendas_Click(object sender, EventArgs e) { Boolean instanciar = true; bool ViewOtica = Convert.ToBoolean(Parametro.GetParametro("layoutOtica")); bool ViewLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); if (ViewOtica) { foreach (var mdiChildForm in MdiChildren) { if (mdiChildForm is frmListPedidos_Otica) { instanciar = false; mdiChildForm.BringToFront(); mdiChildForm.Show(); } } if (instanciar) { var frm = new frmListPedidos_Otica(); frm.ConfigurarForm(this); frm.Tag = ((ToolStripMenuItem)sender).Tag; frm.Show(); } } else if (ViewLaboratorio) { foreach (var mdiChildForm in MdiChildren) { if (mdiChildForm is frmListPedidos_Laboratorio) { instanciar = false; mdiChildForm.BringToFront(); mdiChildForm.Show(); } } if (instanciar) { var frm = new frmListPedidos_Laboratorio(); frm.ConfigurarForm(this); frm.Tag = ((ToolStripMenuItem)sender).Tag; frm.Show(); } } }
public virtual void AdicionarPedido_Otica(Pedido_Otica Pedido_Otica) { try { #region Parcela Pedido decimal?totalValor = 0; totalValor = Pedido_Otica.itempedido_otica.Sum(p => p.valor_total); Pedido_Otica_ParcelasBLL popBLL = new Pedido_Otica_ParcelasBLL(); if (totalValor > 0) { Pedido_Otica.pedido_otica_parcelas = popBLL.GerarParcelas(Pedido_Otica.condicao_pagamento, totalValor, DateTime.Now); } #endregion Pedido_Otica.inclusao = DateTime.Now; Pedido_Otica.usuario_inclusao = UsuarioLogado.nome; Pedido_Otica.codigo = Utils.Sequence.GetNextVal("sq_pedido_otica_sequence"); if (UsuarioLogado.Id_empresa != null) { Pedido_Otica.Id_empresa = UsuarioLogado.Id_empresa; } if (UsuarioLogado.Id_filial != null) { Pedido_Otica.Id_filial = UsuarioLogado.Id_filial; } _Pedido_OticaRepositorio.Adicionar(Pedido_Otica); _Pedido_OticaRepositorio.Commit(); var layoutLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); if (layoutLaboratorio) { GravarArquivo(Pedido_Otica); } } catch (Exception ex) { throw ex; } }
private void confParametros() { string layoutLaboratorio = Parametro.GetParametro("layoutLaboratorio"); if (!string.IsNullOrEmpty(layoutLaboratorio)) { vwLaboratorio = Convert.ToBoolean(layoutLaboratorio); } string layoutOtica = Parametro.GetParametro("layoutOtica"); if (!string.IsNullOrEmpty(layoutOtica)) { vwOtica = Convert.ToBoolean(layoutOtica); } string intOmie = Parametro.GetParametro("intOmie"); if (!string.IsNullOrEmpty(intOmie)) { intERP = Convert.ToBoolean(intOmie); } }
public void GravarArquivo(Pedido_Otica pedido) { bool IntGenLab = false; string CaminhoArquivos = string.Empty; string NomeArq = string.Empty; string[] TextoArq = new string[31]; const int CAIXA = 0; const int OLHO = 1; const int CLIENTE = 2; const int ESF_OD = 3; const int CIL_OD = 4; const int EIXO_OD = 5; const int ADICAO_OD = 6; const int ESF_OE = 7; const int CIL_OE = 8; const int EIXO_OE = 9; const int ADICAO_OE = 10; const int PRISMA1_OD = 11; const int EIXO_PRISMA1_OD = 12; const int PRISMA2_OD = 13; const int EIXO_PRISMA2_OD = 14; const int PRISMA1_OE = 15; const int EIXO_PRISMA1_OE = 16; const int PRISMA2_OE = 17; const int EIXO_PRISMA2_OE = 18; const int DP_LONGE_OD = 19; const int DP_PERTO_OD = 20; const int DP_LONGE_OE = 21; const int DP_PERTO_OE = 22; const int DCOTP_OD = 23; const int APA_OD = 24; const int DCOTP_OE = 25; const int APA_OE = 26; const int DESCH_OD = 27; const int DESCH_OE = 28; const int DESCV_OD = 29; const int DESCV_OE = 30; for (int Index = 0; Index < TextoArq.Length; Index++) { TextoArq[Index] = string.Empty; } IntGenLab = Convert.ToBoolean(Parametro.GetParametro("intGenLab")); if (IntGenLab) { CaminhoArquivos = Parametro.GetParametro("strPathFileLab"); if (pedido.caixa != null) { TextoArq[CAIXA] = pedido.caixa.numero; } else { TextoArq[CAIXA] = "0"; } //1 ambos , 2 Direito, 3 esquerdo if ((!string.IsNullOrEmpty(pedido.od_gl_esf) && (!string.IsNullOrEmpty(pedido.oe_gl_esf)))) { TextoArq[OLHO] = "1"; } else if ((!string.IsNullOrEmpty(pedido.od_gl_esf) && (string.IsNullOrEmpty(pedido.oe_gl_esf)))) { TextoArq[OLHO] = "2"; } else if ((string.IsNullOrEmpty(pedido.od_gl_esf) && (!string.IsNullOrEmpty(pedido.oe_gl_esf)))) { TextoArq[OLHO] = "3"; } ClienteBLL clienteBLL = new ClienteBLL(); pedido.cliente = clienteBLL.Localizar(pedido.Id_cliente); if (pedido.cliente != null) { string codCliente = string.Empty; if (pedido.cliente.codigo_cliente_integracao.Length <= 3) { codCliente = pedido.cliente.codigo_cliente_integracao.PadLeft(pedido.cliente.codigo_cliente_integracao.Length + 1, '0'); } else { codCliente = pedido.cliente.codigo_cliente_integracao; } TextoArq[CLIENTE] = "\"" + pedido.cliente.nome_fantasia + ";" + codCliente + ";" + pedido.numero_pedido_cliente + "\""; } TextoArq[ESF_OD] = pedido.od_gl_esf; TextoArq[CIL_OD] = pedido.od_gl_cil; TextoArq[EIXO_OD] = pedido.od_eixo.ToString(); TextoArq[ADICAO_OD] = pedido.od_adicao.ToString(); TextoArq[ESF_OE] = pedido.oe_gl_esf; TextoArq[CIL_OE] = pedido.oe_gl_cil; TextoArq[EIXO_OE] = pedido.oe_eixo.ToString(); TextoArq[ADICAO_OE] = pedido.oe_adicao.ToString(); TextoArq[PRISMA1_OD] = pedido.od_prisma_valor; TextoArq[EIXO_PRISMA1_OD] = pedido.od_prisma_eixo.ToString(); TextoArq[PRISMA2_OD] = string.Empty; TextoArq[EIXO_PRISMA2_OD] = string.Empty; TextoArq[PRISMA1_OE] = pedido.oe_prisma_valor; TextoArq[EIXO_PRISMA1_OE] = pedido.oe_prisma_eixo.ToString(); TextoArq[PRISMA2_OE] = string.Empty; TextoArq[EIXO_PRISMA2_OE] = string.Empty; TextoArq[DP_LONGE_OD] = pedido.od_dnp_longe; TextoArq[DP_PERTO_OD] = pedido.od_dnp_perto; TextoArq[DP_LONGE_OE] = pedido.oe_dnp_longe; TextoArq[DP_PERTO_OE] = pedido.oe_dnp_perto; TextoArq[DCOTP_OD] = string.Empty; TextoArq[APA_OD] = pedido.od_alt; TextoArq[DCOTP_OE] = string.Empty; TextoArq[APA_OE] = pedido.oe_alt; TextoArq[DESCH_OD] = pedido.od_dech; TextoArq[DESCH_OE] = pedido.oe_dech; TextoArq[DESCV_OD] = string.Empty; TextoArq[DESCV_OE] = string.Empty; string linha = string.Empty; foreach (var item in TextoArq) { if (string.IsNullOrEmpty(linha)) { linha += item; } else { linha += "," + item; } } NomeArq = pedido.codigo.ToString(); if (string.IsNullOrEmpty(CaminhoArquivos)) { CaminhoArquivos = @"C:\temp\"; } File.WriteAllText(@CaminhoArquivos + @"\" + NomeArq, linha); } }
public virtual void AlterarPedido_Otica(Pedido_Otica Pedido_Otica) { #region ItemPedido try { ItemPedido_OticaBLL itemPedido_OticaBLL = new ItemPedido_OticaBLL(); //lista de itens do banco ICollection <ItemPedido_Otica> itemPedido_OticaDB = itemPedido_OticaBLL.getItemPedido_Otica(p => p.Id_pedido_otica == Pedido_Otica.Id); ICollection <ItemPedido_Otica> itemPedido_OticaTela = Pedido_Otica.itempedido_otica; foreach (ItemPedido_Otica item in itemPedido_OticaTela) { //Marca todos com ID = 0 como adicionados. if (item.Id == 0) { item.state = EstadoEntidade.Added; } else { item.state = EstadoEntidade.Modified; } } //marcar todas como alteradas e verifica se ele existe na lista da tela. foreach (ItemPedido_Otica item in itemPedido_OticaDB) { if (itemPedido_OticaTela.FirstOrDefault(p => p.Id == item.Id) == null) { //clonar o item para marca-lo para exclusão ItemPedido_Otica clone = new ItemPedido_Otica() { Id = item.Id, Id_pedido_otica = item.Id_pedido_otica, Id_produto = item.Id_produto, quantidade = item.quantidade, valor_unitario = item.valor_unitario, percentual_desconto = item.percentual_desconto, valor_desconto = item.valor_desconto, valor_total = item.valor_total, unidade = item.unidade }; clone.state = EstadoEntidade.Deleted; itemPedido_OticaTela.Add(clone); } } #endregion #region Parcela Pedido List <Pedido_Otica> poList = getPedido_Otica(p => p.Id == Pedido_Otica.Id, true); Pedido_Otica pedBanco = null; if (poList.Count() > 0) { pedBanco = poList.First(); } decimal?totalValor = 0; totalValor = Pedido_Otica.itempedido_otica.Where(c => c.state != EstadoEntidade.Deleted).Sum(p => p.valor_total); Pedido_Otica_ParcelasBLL popBLL = new Pedido_Otica_ParcelasBLL(); bool RemoveParcela = false; if (pedBanco != null) { RemoveParcela = pedBanco.condicao_pagamento != Pedido_Otica.condicao_pagamento; decimal totalBanco = 0; totalBanco = pedBanco.itempedido_otica.Sum(p => p.valor_total); if (totalValor != totalBanco) { RemoveParcela = true; } } ICollection <Pedido_Otica_Parcelas> parcelasList = new List <Pedido_Otica_Parcelas>(); if (RemoveParcela) { parcelasList = Pedido_Otica.pedido_otica_parcelas; if (parcelasList.Count == 0) { parcelasList = popBLL.getPedido_Otica_Parcelas(p => p.Id_pedido_otica == Pedido_Otica.Id, true); } if (totalValor > 0) { Pedido_Otica.pedido_otica_parcelas = popBLL.GerarParcelas(Pedido_Otica.condicao_pagamento, totalValor, DateTime.Now); } } //else if (!RemoveParcela) //{ // parcelasList = popBLL.getPedido_Otica_Parcelas(p => p.Id_pedido_otica == Pedido_Otica.Id, true); //} foreach (Pedido_Otica_Parcelas item in parcelasList) { item.state = EstadoEntidade.Deleted; Pedido_Otica.pedido_otica_parcelas.Add(item); } #endregion Pedido_Otica.alteracao = DateTime.Now; Pedido_Otica.usuario_alteracao = UsuarioLogado.nome; _Pedido_OticaRepositorio.Atualizar(Pedido_Otica); _Pedido_OticaRepositorio.Commit(); var layoutLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); if (layoutLaboratorio) { GravarArquivo(Pedido_Otica); } } catch (Exception ex) { throw ex; } }
private void LoadViews() { bool ViewOtica = Convert.ToBoolean(Parametro.GetParametro("layoutOtica")); bool ViewLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); //Setup dos controles especificos da Ótica. #region Visão Otica if (ViewOtica) { lblPrevEntrega.Left = 550; txtDtPrevEntrega.Left = 647; txtHrPrevEntrega.Left = 735; lblNomeMedico.Visible = true; txtNomeMedico.Enabled = false; txtNomeMedico.Visible = true; txtNomeMedico.TabIndex = 9; txtNomeMedico.TabStop = true; lblCRM.Visible = true; txtCRM.Enabled = false; txtCRM.Visible = true; txtCRM.TabIndex = 10; txtCRM.TabStop = true; lblLaboratorio.Visible = true; txtLaboratorio.Enabled = false; txtLaboratorio.Visible = true; txtLaboratorio.TabIndex = 12; txtLaboratorio.TabStop = true; } else { lblNomeMedico.Visible = false; txtNomeMedico.Enabled = false; txtNomeMedico.Visible = false; txtNomeMedico.TabIndex = 57; txtNomeMedico.TabStop = false; lblCRM.Visible = false; txtCRM.Enabled = false; txtCRM.Visible = false; txtCRM.TabIndex = 60; txtCRM.TabStop = false; lblLaboratorio.Visible = false; txtLaboratorio.Enabled = false; txtLaboratorio.Visible = false; txtLaboratorio.TabIndex = 61; txtLaboratorio.TabStop = false; } #endregion //Setup dos controles especificos do laboratório. #region Visão Laboratorio if (ViewLaboratorio) { lblDtFechamento.Enabled = true; lblDtFechamento.Visible = true; txtDtFechamento.Enabled = false; txtDtFechamento.Visible = true; txtDtFechamento.TabIndex = 5; txtDtFechamento.TabStop = true; lblPrevEntrega.Left = 753; txtDtPrevEntrega.Left = 854; txtHrPrevEntrega.Left = 942; lblMotivoEntrega.Enabled = true; lblMotivoEntrega.Visible = true; cbMotivoEntrega.Enabled = false; cbMotivoEntrega.Visible = true; cbMotivoEntrega.TabStop = true; lblTransportadora.Enabled = true; lblTransportadora.Visible = true; cbTransportadora.Enabled = false; cbTransportadora.Visible = true; cbTransportadora.TabStop = true; lblNrPedCliente.Enabled = true; lblNrPedCliente.Visible = true; txtNrPedCliente.Enabled = false; txtNrPedCliente.Visible = true; txtNrPedCliente.TabStop = true; lblNrCaixa.Enabled = true; lblNrCaixa.Visible = true; cbCaixa.Enabled = false; cbCaixa.Visible = true; cbCaixa.TabStop = true; } else { lblDtFechamento.Enabled = false; lblDtFechamento.Visible = false; txtDtFechamento.Enabled = false; txtDtFechamento.Visible = false; txtDtFechamento.TabIndex = 5; txtDtFechamento.TabStop = false; lblMotivoEntrega.Enabled = false; lblMotivoEntrega.Visible = false; cbMotivoEntrega.Enabled = false; cbMotivoEntrega.Visible = false; cbMotivoEntrega.TabStop = false; lblTransportadora.Enabled = false; lblTransportadora.Visible = false; cbTransportadora.Enabled = false; cbTransportadora.Visible = false; cbTransportadora.TabStop = false; lblNrPedCliente.Enabled = false; lblNrPedCliente.Visible = false; txtNrPedCliente.Enabled = false; txtNrPedCliente.Visible = false; txtNrPedCliente.TabStop = false; lblNrCaixa.Enabled = false; lblNrCaixa.Visible = false; cbCaixa.Enabled = false; cbCaixa.Visible = false; cbCaixa.TabStop = false; } #endregion }
protected override bool salvar(object sender, EventArgs e) { bool layoutOtica = Convert.ToBoolean(Parametro.GetParametro("layoutOtica")); if (layoutOtica) { epValidaDados.SetObrigatorio(txtCNPJCPF, false); } bool Retorno = epValidaDados.Validar(true); if (Retorno) { Retorno = ValidaDadosEspecifico(); } if (Retorno) { try { ClienteBLL = new ClienteBLL(); ClienteBLL.UsuarioLogado = Program.usuario_logado; ClienteProxy proxy = new ClienteProxy(); proxy.usuario = Program.usuario_logado; bool intOmie = Convert.ToBoolean(Parametro.GetParametro("intOmie")); bool updateClienteOmie = Convert.ToBoolean(Parametro.GetParametro("updateFornecedorOmie")); Cliente Cliente = LoadFromControls(); Cliente.sincronizar = "S"; if (Id != null) { ClienteBLL.AlterarCliente(Cliente); } else { Cliente.codigo_cliente_integracao = Sequence.GetNextVal("sq_cliente_sequence").ToString(); TagBLL tagBLL = new TagBLL(); Tag tg = tagBLL.getTag("Fornecedor").FirstOrDefault(); Cliente.cliente_tag.Add(new Cliente_Tag { Id_tag = tg.Id, tag = tg.tag1 }); ClienteBLL.AdicionarCliente(Cliente); } if ((intOmie) & (updateClienteOmie)) { if (Cliente.codigo_cliente_omie <= 0) { proxy.IncluirClientes(Cliente); } else { proxy.AlterarClientes(Cliente); } } if (Cliente.Id != 0) { Id = Cliente.Id; txtId.Text = Cliente.Id.ToString(); } SalvarImagem(Cliente.Id); Retorno = true; } catch (Exception ex) { Retorno = false; throw ex; } } return(Retorno); }
protected override void LoadToControls() { if (Id != null) { pedido_OticaBLL = new Pedido_OticaBLL(); bool ViewOtica = Convert.ToBoolean(Parametro.GetParametro("layoutOtica")); bool ViewLaboratorio = Convert.ToBoolean(Parametro.GetParametro("layoutLaboratorio")); Pedido_Otica pedido_otica = pedido_OticaBLL.Localizar(Id); if (pedido_otica != null) { txtId.Text = pedido_otica.Id.ToString(); txtIdCliente.Text = pedido_otica.Id_cliente.ToString(); txtCodigo.Text = pedido_otica.codigo.ToString(); txtCodCliIntegracao.Text = pedido_otica.cliente.codigo_cliente_integracao; txtClienteNome.Text = pedido_otica.cliente.nome_fantasia; txtDtEmissao.Text = pedido_otica.data_emissao.Value.ToShortDateString(); if (ViewLaboratorio) { if (pedido_otica.data_fechamento != null) { txtDtFechamento.Text = pedido_otica.data_fechamento.Value.ToShortDateString(); } if (pedido_otica.Id_transportadora != null) { cbTransportadora.SelectedValue = pedido_otica.Id_transportadora; } txtNrPedCliente.Text = pedido_otica.numero_pedido_cliente; if (pedido_otica.Id_caixa != null) { cbCaixa.SelectedValue = pedido_otica.Id_caixa; } if (pedido_otica.motivo_entrega != null) { cbMotivoEntrega.SelectedValue = pedido_otica.motivo_entrega.Id; } } if (pedido_otica.date_previsao_entrega != null) { txtDtPrevEntrega.Text = pedido_otica.date_previsao_entrega.Value.ToShortDateString(); } if (pedido_otica.hora_previsao_entrega != null) { txtHrPrevEntrega.Text = pedido_otica.hora_previsao_entrega; } if (pedido_otica.condicao_pagamento != null) { cbCondPagamento.SelectedValue = pedido_otica.condicao_pagamento; } if (pedido_otica.vendedor != null) { cbVendedor.SelectedValue = pedido_otica.Id_vendedor; } if (ViewOtica) { if (pedido_otica.pedido_otica_infoadic.Count > 0) { Pedido_Otica_InfoAdic infoadic = pedido_otica.pedido_otica_infoadic.FirstOrDefault(); txtIdPedInfoadic.Text = infoadic.Id.ToString(); txtNomeMedico.Text = infoadic.nome_medico; if (infoadic.crm_medico != null) { txtCRM.Text = infoadic.crm_medico.ToString(); } txtLaboratorio.Text = infoadic.laboratorio; } } if (pedido_otica.pedido_otica_parcelas.Count() > 0) { ParcelasBLL = new Pedido_Otica_ParcelasBLL(); dgvParcelas.DataSource = ParcelasBLL.ToList_Pedido_OticaParcelaView(pedido_otica.pedido_otica_parcelas); formataGridParcelas(); loadCamposParcela(); } if (pedido_otica.cancelado == "S") { lblPedidoCancelado.Visible = true; foreach (Control item in pnlPrincipal.Controls) { item.Enabled = false; btnSalvar.Enabled = false; btnIncluir.Enabled = false; } lblPedidoCancelado.Enabled = true; } } } }