private void CD_Clifor_Leave(object sender, EventArgs e) { string vParam = "a.cd_clifor|=|'" + CD_Clifor.Text.Trim() + "';isnull(a.st_registro, 'A')|<>|'C'"; object obj_regvenda = null; if (!string.IsNullOrEmpty(CD_CompVend.Text)) { obj_regvenda = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_RegiaoVenda().BuscarEscalar( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = "a.cd_vendedor", vOperador = "=", vVL_Busca = "'" + CD_CompVend.Text.Trim() + "'" } }, "1"); } if (obj_regvenda == null ? false : obj_regvenda.ToString().Trim().Equals("1")) { vParam += ";|exists|(select 1 from tb_fat_vendedor_x_regiaovenda x " + " where x.id_regiao = a.id_regiao " + " and x.cd_vendedor = '" + CD_CompVend.Text.Trim() + "')"; } DataRow linha = FormBusca.UtilPesquisa.EDIT_LEAVE(vParam, new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, new CamadaDados.Financeiro.Cadastros.TCD_CadClifor()); CD_Endereco.Clear(); DS_Endereco.Clear(); DS_Cidade.Clear(); UF.Text = string.Empty; Fone.Clear(); Busca_Endereco_Clifor(); bsOrcamento.ResetCurrentItem(); }
private void cd_contratante_Leave(object sender, EventArgs e) { string vParam = "a.cd_clifor|=|'" + cd_contratante.Text.Trim() + "';isnull(a.st_registro, 'A')|<>|'C'"; object obj_regvenda = null; if (!string.IsNullOrEmpty(cd_vendedor.Text)) { obj_regvenda = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_RegiaoVenda().BuscarEscalar( new Utils.TpBusca[] { new Utils.TpBusca() { vNM_Campo = "a.cd_vendedor", vOperador = "=", vVL_Busca = "'" + cd_vendedor.Text.Trim() + "'" } }, "1"); } if (obj_regvenda == null ? false : obj_regvenda.ToString().Trim().Equals("1")) { vParam += ";|exists|(select 1 from tb_fat_vendedor_x_regiaovenda x " + " where x.id_regiao = a.id_regiao " + " and x.cd_vendedor = '" + cd_vendedor.Text.Trim() + "')"; } UtilPesquisa.EDIT_LEAVE(vParam, new Componentes.EditDefault[] { cd_contratante, nm_contratante }, new CamadaDados.Financeiro.Cadastros.TCD_CadClifor()); this.Busca_Endereco_Clifor(); }
private void BB_Clifor_Click(object sender, EventArgs e) { DataRowView linha = FormBusca.UtilPesquisa.BTN_BuscaClifor(new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, string.Empty); this.Busca_Endereco_Clifor(); //Verificar se Cliente é consumidor final if (!string.IsNullOrEmpty(CD_Clifor.Text)) { if (rCfg.Cd_clifor != CD_Clifor.Text) { NM_Clifor.Enabled = false; ds_endereco.Enabled = false; numero.Visible = true; Bairro.Visible = true; proximo.Visible = true; lbprox.Visible = true; ds_endereco.Size = new Size(274, 20); } else { NM_Clifor.Enabled = true; ds_endereco.Enabled = true; numero.Visible = false; Bairro.Visible = false; proximo.Visible = false; lbprox.Visible = false; ds_endereco.Size = new Size(782, 20); } } //Verificar carteira do cliente se Usuario não tiver Vendedor padrão if (linha != null) { if (!string.IsNullOrEmpty(linha["id_regiao"].ToString())) { //Verificar se Cliente pertence alguma Carteira object obj = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_RegiaoVenda().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "a.id_regiao", vOperador = "=", vVL_Busca = "'" + linha["id_regiao"].ToString().Trim() + "'" } }, "a.cd_vendedor"); if (obj != null) { CD_CompVend.Text = obj.ToString(); CD_CompVend_Leave(this, new EventArgs()); } } else { CD_CompVend.Text = string.Empty; NM_CompVend.Text = string.Empty; CD_CompVend.Enabled = true; NM_CompVend.Enabled = true; BB_CompVend.Enabled = true; } } }