//atualizar objeto cliente com valores do formulario private Library.Cliente UpdateClienteFromForm() { Library.Cliente clienteTemp = this.cliente; clienteTemp.Id = long.Parse(this.codigoTB.Text); clienteTemp.Bairro = this.bairroTB.Text; clienteTemp.Celular = this.celularTB.Text; clienteTemp.Cep = this.cepTB.Text; clienteTemp.Cidade = this.cidadeTB.Text; clienteTemp.Cpf = this.cpfTB.Text; clienteTemp.Email = this.emailTB.Text; clienteTemp.Endereco = this.enderecoTB.Text; clienteTemp.Estado = this.estadoCB.Text; clienteTemp.Nascimento = DateTime.Parse(this.nascimentoDTP.Text); clienteTemp.Nome = this.nomeTB.Text; clienteTemp.Observacoes = this.observacoesTB.Text; clienteTemp.ReferenciaComercial = this.referenciaComercialTB.Text; clienteTemp.Rg = this.rgTB.Text; clienteTemp.Site = this.siteTB.Text; clienteTemp.Telefone = this.telefoneTB.Text; clienteTemp.EnderecoNumero = this.textBoxNumero.Text; //clienteTemp.DataCadastro = DateTime.Now; return(clienteTemp); }
private decimal PerformLimiteCliente(Library.Cliente cliente) { textBoxLimiteVendaAPrazo.Text = "0"; decimal limite = cliente.LimiteVendaAPrazo; decimal dividas = Library.ClienteBD.GetParcelasAtrasadasValorById(cliente.Id); decimal novoLimite = limite - dividas - this.produtos1.ValorProdutos; if (cliente.AptoVendaAPrazo == 0) { textBoxStatusVendaAPrazo.Text = "Negada"; textBoxStatusVendaAPrazo.BackColor = Color.FromArgb(250, 200, 187); textBoxLimiteVendaAPrazo.BackColor = Color.FromArgb(250, 200, 187); return(0); } else { if (novoLimite <= 0) { textBoxStatusVendaAPrazo.Text = "Sem limite"; textBoxStatusVendaAPrazo.BackColor = Color.FromArgb(250, 200, 187); textBoxLimiteVendaAPrazo.BackColor = Color.FromArgb(250, 200, 187); return(0); } else { textBoxLimiteVendaAPrazo.Text = novoLimite.ConvertToMoneyString(); textBoxStatusVendaAPrazo.Text = "Aprovado"; textBoxStatusVendaAPrazo.BackColor = Color.FromArgb(200, 240, 180); textBoxLimiteVendaAPrazo.BackColor = Color.FromArgb(200, 240, 180); return(novoLimite); } } }
//mostrar valores no formulario private void ShowValues(Library.Cliente cliente) { this.codigoTB.Text = string.Format("{0}", cliente.Id); this.bairroTB.Text = cliente.Bairro; this.celularTB.Text = cliente.Celular; this.cepTB.Text = cliente.Cep; this.cidadeTB.Text = cliente.Cidade; this.cpfTB.Text = cliente.Cpf; this.emailTB.Text = cliente.Email; this.enderecoTB.Text = cliente.Endereco; this.estadoCB.Text = cliente.Estado; this.nascimentoDTP.Value = cliente.Nascimento.Value; this.nomeTB.Text = cliente.Nome; this.observacoesTB.Text = cliente.Observacoes; this.referenciaComercialTB.Text = cliente.ReferenciaComercial; this.rgTB.Text = cliente.Rg; this.siteTB.Text = cliente.Site; this.telefoneTB.Text = cliente.Telefone; this.textBoxNumero.Text = cliente.EnderecoNumero.ToString(); //List<Library.Empresa> empresastmp = new List<Library.Empresa>(); //foreach (Library.ClienteEmpresa ce in Library.ClienteEmpresaBD.FindAdvanced(new QItem("c.id",cliente.Id))) //{ // empresastmp.Add(ce.Empresa); //} }
//mostrar valores no formulario private void ShowValues(Library.Cliente cliente) { this.codigoTB.Text = string.Format("{0}", cliente.Id); this.bairroTB.Text = cliente.Bairro; this.celularTB.Text = cliente.Celular; this.cepTB.Text = cliente.Cep; this.cidadeTB.Text = cliente.Cidade; this.cnpjTB.Text = cliente.Cnpj; this.emailTB.Text = cliente.Email; this.enderecoTB.Text = cliente.Endereco; this.estadoCB.Text = cliente.Estado; this.faxTB.Text = cliente.Fax; this.inscricaoEstadualTB.Text = cliente.InscricaoEstadual; this.nomeTB.Text = cliente.Nome; this.nomeContatoTB.Text = cliente.NomeContato; this.nomeFantasiaTB.Text = cliente.NomeFantasia; this.observacoesTB.Text = cliente.Observacoes; this.siteTB.Text = cliente.Site; this.telefoneTB.Text = cliente.Telefone; this.textBoxNumero.Text = cliente.EnderecoNumero.ToString(); //List<Library.Empresa> empresastmp = new List<Library.Empresa>(); //foreach (Library.ClienteEmpresa ce in Library.ClienteEmpresaBD.FindAdvanced(new QItem("c.id", cliente.Id))) //{ // empresastmp.Add(ce.Empresa); //} }
private void idClienteTB_TextChanged(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { long t = 0; long.TryParse(this.idClienteTB.Text, out t); Library.Cliente cliente = Library.ClienteBD.FindById(t); if (cliente != null) { PerformLimiteCliente(cliente); } else { textBoxLimiteVendaAPrazo.Text = ""; textBoxStatusVendaAPrazo.Text = ""; textBoxStatusVendaAPrazo.BackColor = DefaultBackColor; textBoxLimiteVendaAPrazo.BackColor = DefaultBackColor; } } catch (Exception ex) { Library.Diagnostics.Logger.Error(ex); } this.Cursor = Cursors.Default; }
//mostrar valores no formulario private void ShowValues(Library.Cliente cliente) { this.codigoTB.Text = string.Format("{0}", cliente.Id); this.bairroTB.Text = cliente.Bairro; this.celularTB.Text = cliente.Celular; this.cepTB.Text = cliente.Cep; this.cidadeTB.Text = cliente.Cidade; this.cnpjTB.Text = cliente.Cnpj; this.emailTB.Text = cliente.Email; this.enderecoTB.Text = cliente.Endereco; this.estadoCB.Text = cliente.Estado; this.faxTB.Text = cliente.Fax; this.inscricaoEstadualTB.Text = cliente.InscricaoEstadual; this.nomeTB.Text = cliente.Nome; this.nomeContatoTB.Text = cliente.NomeContato; this.nomeFantasiaTB.Text = cliente.NomeFantasia; this.observacoesTB.Text = cliente.Observacoes; this.siteTB.Text = cliente.Site; this.telefoneTB.Text = cliente.Telefone; this.numericUpDownVencimentoVendaAPrazo.Value = cliente.VencimentoVendaAPrazo; this.textBoxLimiteVendaAPrazo.Text = cliente.LimiteVendaAPrazo.ConvertToMoneyString(); if (cliente.AptoVendaAPrazo == 0) { this.checkBoxAptoVendaAPrazo.Checked = false; } else { this.checkBoxAptoVendaAPrazo.Checked = true; } }
private void excluirButton_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; this.InputDisabler(false); /************BEGIN************/ //achando idCliente selecionado na grid Library.Cliente cliente = null; for (int i = 0; i < dataGridView1.SelectedRows.Count; i++) { cliente = Library.ClienteBD.FindById((long)this.dataGridView1.SelectedRows[i].Cells["idDGVTBC"].Value); } if (MessageBox.Show(this.fcClienteJuridicaDeletarMsg, this.fcClienteJuridicaDeletarMsgTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { //se não tiver selecionado mostra mensagem se estiver deleta e atualiza formulario if (dataGridView1.SelectedRows.Count != 1) { MessageBox.Show(this.fcClienteJuridicaDeletarNoSelected); } else { Library.ClienteBD.Delete(cliente); this.RefreshForm(); } } /*************END*************/ this.Modo = "Excluir"; this.Cursor = Cursors.Default; }
//retornar objeto cliente com valores do formulario private Library.Cliente ReturnCargoFromForm() { Library.Cliente clienteTemp = new Library.Cliente(); //clienteTemp.Id = long.Parse(this.codigoTB.Text); clienteTemp.Bairro = this.bairroTB.Text; clienteTemp.Celular = this.celularTB.Text; clienteTemp.Cep = this.cepTB.Text; clienteTemp.Cidade = this.cidadeTB.Text; clienteTemp.Cnpj = this.cnpjTB.Text; clienteTemp.Email = this.emailTB.Text; clienteTemp.Endereco = this.enderecoTB.Text; clienteTemp.Estado = this.estadoCB.Text; clienteTemp.Fax = this.faxTB.Text; clienteTemp.InscricaoEstadual = this.inscricaoEstadualTB.Text; clienteTemp.Nome = this.nomeTB.Text; clienteTemp.NomeContato = this.nomeContatoTB.Text; clienteTemp.NomeFantasia = this.nomeFantasiaTB.Text; clienteTemp.Observacoes = this.observacoesTB.Text; clienteTemp.Site = this.siteTB.Text; clienteTemp.Telefone = this.telefoneTB.Text; clienteTemp.DataCadastro = DateTime.Now; clienteTemp.Cpf = null; clienteTemp.Rg = null; clienteTemp.ReferenciaComercial = null; clienteTemp.Nascimento = null; clienteTemp.Pessoa = "Juridica"; clienteTemp.EnderecoNumero = this.textBoxNumero.Text; return(clienteTemp); }
//atualizar objeto cliente com valores do formulario private Library.Cliente UpdateCargoFromForm() { Library.Cliente clienteTemp = this.cliente; clienteTemp.Id = long.Parse(this.codigoTB.Text); clienteTemp.Bairro = this.bairroTB.Text; clienteTemp.Celular = this.celularTB.Text; clienteTemp.Cep = this.cepTB.Text; clienteTemp.Cidade = this.cidadeTB.Text; clienteTemp.Cnpj = this.cnpjTB.Text; clienteTemp.Email = this.emailTB.Text; clienteTemp.Endereco = this.enderecoTB.Text; clienteTemp.Estado = this.estadoCB.Text; clienteTemp.Fax = this.faxTB.Text; clienteTemp.InscricaoEstadual = this.inscricaoEstadualTB.Text; clienteTemp.Nome = this.nomeTB.Text; clienteTemp.NomeContato = this.nomeContatoTB.Text; clienteTemp.NomeFantasia = this.nomeFantasiaTB.Text; clienteTemp.Observacoes = this.observacoesTB.Text; clienteTemp.Site = this.siteTB.Text; clienteTemp.Telefone = this.telefoneTB.Text; clienteTemp.EnderecoNumero = this.textBoxNumero.Text; //clienteTemp.DataCadastro = DateTime.Now; return(clienteTemp); }
static public bool Delete(Library.Cliente cliente) { SqlConnection conexao = null; try { conexao = new SqlConnection(global::Connection.Connection.String()); SqlCommand comando = conexao.CreateCommand(); comando.CommandText = "DELETE FROM Cliente WHERE id='" + cliente.Id + "'"; conexao.Open(); int teste = comando.ExecuteNonQuery(); return(true); } catch (Exception ex) { Library.Diagnostics.Logger.Error(ex); return(false); } finally { conexao.Close(); } }
private void idClienteTB_KeyUp(object sender, KeyEventArgs e) { this.Cursor = Cursors.WaitCursor; long tmpIdCliente = 0; long.TryParse(this.idClienteTB.Text, out tmpIdCliente); Library.Cliente cliente = Library.ClienteBD.FindById(tmpIdCliente); if (cliente != null) { int i = 0; foreach (Library.Cliente c in this.idClienteCB.Items) { if (c.Id == cliente.Id) { this.idClienteCB.SelectedIndex = i; break; } i++; } } else { this.idClienteCB.SelectedIndex = -1; } this.Cursor = Cursors.Default; }
private void dataGridViewResultado_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { this.Cursor = Cursors.WaitCursor; try { if (e.RowIndex != -1) { Library.Cliente cliente = Library.ClienteBD.FindById((long)dataGridViewResultado["ColumnId", e.RowIndex].Value); this.dataGridViewResultado.BeginInvoke(new InvokeDelegate(OpenTermos), new object[] { e.RowIndex }); /* * if (cliente.Notificacao < 3) * this.dataGridViewResultado.BeginInvoke(new InvokeDelegate(OpenNotificacao), new object[] { e.RowIndex }); * else * this.dataGridViewResultado.BeginInvoke(new InvokeDelegate(OpenTermoCompromisso), new object[] { e.RowIndex }); */ } } catch (Exception ex) { Library.Classes.Logger.Error(ex); } this.Cursor = Cursors.Default; }
private void buttonImprimir_Click(object sender, EventArgs e) { Library.Cliente cliente = (Library.Cliente)comboBoxCliente.SelectedItem; Reports.TermoCompromissoR termoCompromisso = new Reports.TermoCompromissoR(); termoCompromisso.cliente = cliente; //notificacao.notificacao = 2; termoCompromisso.ShowDialog(this); }
static public void Save(Library.Cliente cliente) { NpgsqlConnection conexao = null; try { long id = GetNextId(); conexao = new NpgsqlConnection(global::Connection.Connection.StringPostgree()); using (NpgsqlCommand comando = conexao.CreateCommand()) { comando.CommandText = "INSERT INTO \"Cliente\" ( bairro, celular, cep, cpf, cnpj, cidade, email, endereco, enderecoNumero, estado, fax, inscricaoEstadual, nascimento, nome, nomeContato, nomeFantasia, observacoes, pessoa, rg, referenciaComercial, site, telefone, dataCadastro) VALUES (@bairro, @celular, @cep, @cpf, @cnpj, @cidade, @email, @endereco, @enderecoNumero, @estado, @fax, @inscricaoEstadual, @nascimento, @nome, @nomeContato, @nomeFantasia, @observacoes, @pessoa, @rg, @referenciaComercial, @site, @telefone, @dataCadastro)"; comando.Parameters.AddWithValue("@bairro", cliente.Bairro); comando.Parameters.AddWithValue("@celular", cliente.Celular); comando.Parameters.AddWithValue("@cep", cliente.Cep); comando.Parameters.AddWithValue("@cpf", cliente.Cpf); comando.Parameters.AddWithValue("@cnpj", cliente.Cnpj); comando.Parameters.AddWithValue("@cidade", cliente.Cidade); comando.Parameters.AddWithValue("@email", cliente.Email); comando.Parameters.AddWithValue("@endereco", cliente.Endereco); comando.Parameters.AddWithValue("@enderecoNumero", cliente.EnderecoNumero); comando.Parameters.AddWithValue("@estado", cliente.Estado); comando.Parameters.AddWithValue("@fax", cliente.Fax); comando.Parameters.AddWithValue("@inscricaoEstadual", cliente.InscricaoEstadual); comando.Parameters.AddWithValue("@nascimento", cliente.Nascimento); comando.Parameters.AddWithValue("@nome", cliente.Nome); comando.Parameters.AddWithValue("@nomeContato", cliente.NomeContato); comando.Parameters.AddWithValue("@nomeFantasia", cliente.NomeFantasia); comando.Parameters.AddWithValue("@observacoes", cliente.Observacoes); comando.Parameters.AddWithValue("@pessoa", cliente.Pessoa); comando.Parameters.AddWithValue("@rg", cliente.Rg); comando.Parameters.AddWithValue("@referenciaComercial", cliente.ReferenciaComercial); comando.Parameters.AddWithValue("@site", cliente.Site); comando.Parameters.AddWithValue("@telefone", cliente.Telefone); comando.Parameters.AddWithValue("@dataCadastro", cliente.DataCadastro); conexao.Open(); cliente.Id = id; comando.ExecuteNonQuery(); } } catch (Exception ex) { Library.Classes.Logger.Error(ex);; } finally { if (conexao != null) { conexao.Close(); } } }
static public void Update(Library.Cliente cliente) { NpgsqlConnection conexao = null; try { conexao = new NpgsqlConnection(global::Connection.Connection.StringPostgree()); using (NpgsqlCommand comando = conexao.CreateCommand()) { comando.CommandText = "UPDATE \"Cliente\" SET bairro = @bairro, celular = @celular, cep = @cep, cpf = @cpf, cnpj = @cnpj, cidade = @cidade, email = @email, endereco = @endereco, enderecoNumero = @enderecoNumero, estado = @estado, fax = @fax, inscricaoEstadual = @inscricaoEstadual, nascimento = @nascimento, nome = @nome, nomeContato = @nomeContato, nomeFantasia = @nomeFantasia, observacoes = @observacoes, pessoa = @pessoa, rg = @rg, referenciaComercial = @referenciaComercial, site = @site, telefone = @telefone, dataCadastro = @dataCadastro WHERE (id= " + cliente.Id + ")"; comando.Parameters.AddWithValue("@bairro", cliente.Bairro); comando.Parameters.AddWithValue("@celular", cliente.Celular); comando.Parameters.AddWithValue("@cep", cliente.Cep); comando.Parameters.AddWithValue("@cpf", cliente.Cpf); comando.Parameters.AddWithValue("@cnpj", cliente.Cnpj); comando.Parameters.AddWithValue("@cidade", cliente.Cidade); comando.Parameters.AddWithValue("@email", cliente.Email); comando.Parameters.AddWithValue("@endereco", cliente.Endereco); comando.Parameters.AddWithValue("@enderecoNumero", cliente.EnderecoNumero); comando.Parameters.AddWithValue("@estado", cliente.Estado); comando.Parameters.AddWithValue("@fax", cliente.Fax); comando.Parameters.AddWithValue("@inscricaoEstadual", cliente.InscricaoEstadual); comando.Parameters.AddWithValue("@nascimento", cliente.Nascimento); comando.Parameters.AddWithValue("@nome", cliente.Nome); comando.Parameters.AddWithValue("@nomeContato", cliente.NomeContato); comando.Parameters.AddWithValue("@nomeFantasia", cliente.NomeFantasia); comando.Parameters.AddWithValue("@observacoes", cliente.Observacoes); comando.Parameters.AddWithValue("@pessoa", cliente.Pessoa); comando.Parameters.AddWithValue("@rg", cliente.Rg); comando.Parameters.AddWithValue("@referenciaComercial", cliente.ReferenciaComercial); comando.Parameters.AddWithValue("@site", cliente.Site); comando.Parameters.AddWithValue("@telefone", cliente.Telefone); comando.Parameters.AddWithValue("@dataCadastro", cliente.DataCadastro); conexao.Open(); comando.ExecuteNonQuery(); } } catch (Exception ex) { Library.Classes.Logger.Error(ex);; } finally { if (conexao != null) { conexao.Close(); } } }
static public string GeneratorRodape(Library.Cliente cliente) { Library.Classes.StringFunctions sf = new Library.Classes.StringFunctions(); StringBuilder sb = new StringBuilder(); sb.Append("\n"); sb.Append("\n"); sb.Append(sf.MS("", 50, "direita", '-') + "\n"); sb.Append(sf.MS(cliente.Nome, 50, "m", ' ') + "\n"); return(sb.ToString()); }
private void salvarButton_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; /************BEGIN************/ if (ValidateForm()) { this.MenuDisabler(true, false, false, false, false); this.InputDisabler(false); if (this.modo == "Cadastrar") { //criando um cliente com valores do formulário this.cliente = this.ReturnCargoFromForm(); //salvando cliente Library.ClienteBD.Save(this.cliente); this.dataGridView1.Rows.Add(this.cliente.Id, this.cliente.Nome, this.cliente.DataCadastro); } else { this.cliente = this.UpdateCargoFromForm(); //atualizando cliente Library.ClienteBD.Update(this.cliente); foreach (DataGridViewRow d in dataGridView1.Rows) { if ((long)d.Cells[0].Value == this.cliente.Id) { d.Cells[0].Value = this.cliente.Id; d.Cells[1].Value = this.cliente.Nome; d.Cells[2].Value = this.cliente.DataCadastro; } } } //atualizando formulário //RefreshForm(); RefreshChilds(); this.Modo = "Salvar"; } else { //mensagem de erro } /*************END*************/ this.Cursor = Cursors.Default; }
private void dataGridViewResultado_CellClick(object sender, DataGridViewCellEventArgs e) { Library.Cliente cliente = Library.ClienteBD.FindById((long)dataGridViewResultado.SelectedRows[0].Cells["ColumnId"].Value); /* * if (cliente.Notificacao < 3) * { * buttonNotificacao.Enabled = true; * } * else * { * buttonNotificacao.Enabled = false; * }*/ }
private void idClienteTB_Leave(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; long tmpIdCliente = 0; long.TryParse(this.idClienteTB.Text, out tmpIdCliente); Library.Cliente cliente = Library.ClienteBD.FindById(tmpIdCliente); if (cliente == null) { this.idClienteTB.Text = ""; this.idClienteCB.SelectedIndex = -1; } this.Cursor = Cursors.Default; }
public void Pesquisar() { if ((comboBoxEmpresa.SelectedIndex != -1) & (comboBoxCliente.SelectedIndex != -1)) { Library.Empresa empresa = (Library.Empresa)comboBoxEmpresa.SelectedItem; Library.Cliente cliente = (Library.Cliente)comboBoxCliente.SelectedItem; QItem queryData1 = new QItem(null, null); QItem queryData2 = new QItem(null, null); //dataEntrega if (empresa != null) { queryData1 = new QItem("e.id", empresa.Id); } else { queryData1 = new QItem(null, null); } if (cliente != null) { queryData2 = new QItem("c.id", cliente.Id); } else { queryData2 = new QItem(null, null); } List <Library.TermoCompromisso> termos = Library.TermoCompromissoBD.FindAdvanced(queryData1, queryData2); if (termos != null) { this.dataGridViewTermos.Rows.Clear(); this.dataGridViewParcelas.Rows.Clear(); foreach (Library.TermoCompromisso tc in termos) { this.dataGridViewTermos.Rows.Add(tc.Id, tc.Cliente.Nome, tc.Empresa.Nome, tc.Data); } } } }
static public void PrintCliente(Library.Cliente cliente, Library.Configuracoes config) { MatrixReporter.EpsonCodes _EpsonCodes = new MatrixReporter.EpsonCodes(); MatrixReporter.Reporter _Reporter = new MatrixReporter.Reporter(); _Reporter.Output = config.ImpressoraPorta; _Reporter.StartJob(); _Reporter.PrintText(01, 01, ""); int i = 2; _Reporter.PrintText(i, 02, _Reporter.CleanText(cliente.Nome)); i++; if (cliente.Cpf != "") { _Reporter.PrintText(i, 02, "CPF: " + _Reporter.CleanText(cliente.Cpf)); i++; } if (cliente.Endereco != "") { _Reporter.PrintText(i, 02, _Reporter.CleanText(cliente.Endereco)); i++; } if (cliente.Cidade != "") { _Reporter.PrintText(i, 02, _Reporter.CleanText(cliente.Cidade)); _Reporter.PrintText(i, cliente.Cidade.Length, _Reporter.CleanText("-" + cliente.Estado)); i++; } _Reporter.PrintText(i, 01, ""); i++; _Reporter.PrintText(i, 01, ""); i++; _Reporter.PrintText(i, 01, "-----------------------------------------------"); i++; _Reporter.PrintText(i, 19, "ASSINATURA"); i++; _Reporter.PrintText(i, 01, ""); _Reporter.EndJob(); _Reporter.PrintJob(); }
//mostrar valores no formulario private void ShowValues(Library.Cliente cliente) { try { this.codigoTB.Text = string.Format("{0}", cliente.Id); this.bairroTB.Text = cliente.Bairro; this.celularTB.Text = cliente.Celular; this.cepTB.Text = cliente.Cep; this.cidadeTB.Text = cliente.Cidade; this.cpfTB.Text = cliente.Cpf; this.emailTB.Text = cliente.Email; this.enderecoTB.Text = cliente.Endereco; this.estadoCB.Text = cliente.Estado; if (cliente.Nascimento <= DateTime.MinValue) { this.nascimentoDTP.Text = ""; } else { this.nascimentoDTP.Value = (DateTime)cliente.Nascimento; } this.nomeTB.Text = cliente.Nome; this.observacoesTB.Text = cliente.Observacoes; this.referenciaComercialTB.Text = cliente.ReferenciaComercial; this.rgTB.Text = cliente.Rg; this.siteTB.Text = cliente.Site; this.telefoneTB.Text = cliente.Telefone; this.numericUpDownVencimentoVendaAPrazo.Value = cliente.VencimentoVendaAPrazo; this.textBoxLimiteVendaAPrazo.Text = cliente.LimiteVendaAPrazo.ConvertToMoneyString(); if (cliente.AptoVendaAPrazo == 0) { this.checkBoxAptoVendaAPrazo.Checked = false; } else { this.checkBoxAptoVendaAPrazo.Checked = true; } this.textBoxFiliacao.Text = cliente.Filiacao; } catch (Exception ex) { Library.Diagnostics.Logger.Error(ex); } }
static public List <Library.Cliente> FindClientesDistinct() { NpgsqlDataReader rdr = null; NpgsqlConnection conexao = null; try { conexao = new NpgsqlConnection(global::Connection.Connection.StringPostgree()); using (NpgsqlCommand comando = new NpgsqlCommand()) { string query = "SELECT DISTINCT(idCliente) FROM \"TermoCompromisso\""; comando.CommandText = query; comando.Connection = conexao; conexao.Open(); rdr = comando.ExecuteReader(); } List <Library.Cliente> clientes = new List <Library.Cliente>(); while (rdr.Read()) { Library.Cliente cliente = Library.ClienteBD.FindById((long)rdr["idCliente"]); clientes.Add(cliente); } return(clientes); } catch (Exception ex) { Library.Classes.Logger.Error(ex);; } finally { if (conexao != null) { conexao.Close(); } } return(null); }
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e) { this.Cursor = Cursors.WaitCursor; this.MenuDisabler(true, true, false, false, true); this.InputDisabler(false); this.Modo = "Selecionar"; /************BEGIN************/ if (dataGridView1.SelectedRows.Count == 1) { //achando idCargo selecionado na grid long idCliente = (long)this.dataGridView1.SelectedRows[0].Cells["idDGVTBC"].Value; //mostrando cargo selecionado no formulario this.cliente = Library.ClienteBD.FindById(idCliente); this.ShowValues(cliente); } /*************END*************/ this.Cursor = Cursors.Default; }
//retornar objeto cliente com valores do formulario private Library.Cliente ReturnCargoFromForm() { Library.Cliente clienteTemp = new Library.Cliente(); //clienteTemp.Id = long.Parse(this.codigoTB.Text); clienteTemp.Bairro = this.bairroTB.Text; clienteTemp.Celular = this.celularTB.Text; clienteTemp.Cep = this.cepTB.Text; clienteTemp.Cidade = this.cidadeTB.Text; clienteTemp.Cnpj = this.cnpjTB.Text; clienteTemp.Email = this.emailTB.Text; clienteTemp.Endereco = this.enderecoTB.Text; clienteTemp.Estado = this.estadoCB.Text; clienteTemp.Fax = this.faxTB.Text; clienteTemp.InscricaoEstadual = this.inscricaoEstadualTB.Text; clienteTemp.Nome = this.nomeTB.Text; clienteTemp.NomeContato = this.nomeContatoTB.Text; clienteTemp.NomeFantasia = this.nomeFantasiaTB.Text; clienteTemp.Observacoes = this.observacoesTB.Text; clienteTemp.Site = this.siteTB.Text; clienteTemp.Telefone = this.telefoneTB.Text; clienteTemp.DataCadastro = DateTime.Now; clienteTemp.Cpf = null; clienteTemp.Rg = null; clienteTemp.ReferenciaComercial = null; clienteTemp.Nascimento = null; clienteTemp.LimiteVendaAPrazo = this.textBoxLimiteVendaAPrazo.Text.ConvertToDecimal(); if (checkBoxAptoVendaAPrazo.Checked) { clienteTemp.AptoVendaAPrazo = 1; } else { clienteTemp.AptoVendaAPrazo = 0; } clienteTemp.VencimentoVendaAPrazo = (int)this.numericUpDownVencimentoVendaAPrazo.Value; clienteTemp.Pessoa = "Juridica"; return(clienteTemp); }
private void editarButton_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; this.MenuDisabler(true, false, true, true, false); this.InputDisabler(true); /************BEGIN************/ //achando idCliente selecionado na grid long idCliente = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; i++) { idCliente = (long)this.dataGridView1.SelectedRows[i].Cells["idDGVTBC"].Value; } //mostrando cliente selecionado no formulario this.cliente = Library.ClienteBD.FindById(idCliente); this.ShowValues(this.cliente); /*************END*************/ this.Modo = "Editar"; this.Cursor = Cursors.Default; }
private void idClienteCB_SelectedIndexChanged(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; if (this.idClienteCB.SelectedIndex != -1) { Library.Cliente cliente = (Library.Cliente) this.idClienteCB.SelectedItem; if (cliente != null) { this.idClienteTB.Text = string.Format("{0}", cliente.Id); } else { this.idClienteTB.Text = ""; } } this.Cursor = Cursors.Default; }
//retornar objeto cliente com valores do formulario private Library.Cliente ReturnClienteFromForm() { Library.Cliente clienteTemp = new Library.Cliente(); //clienteTemp.Id = long.Parse(this.codigoTB.Text); clienteTemp.Bairro = this.bairroTB.Text; clienteTemp.Celular = this.celularTB.Text; clienteTemp.Cep = this.cepTB.Text; clienteTemp.Cidade = this.cidadeTB.Text; clienteTemp.Cpf = this.cpfTB.Text; clienteTemp.Email = this.emailTB.Text; clienteTemp.Endereco = this.enderecoTB.Text; clienteTemp.Estado = this.estadoCB.Text; DateTime nascimento; if (DateTime.TryParse(this.nascimentoDTP.Text, out nascimento)) { clienteTemp.Nascimento = nascimento; } else { clienteTemp.Nascimento = null; } clienteTemp.Nome = this.nomeTB.Text; clienteTemp.Observacoes = this.observacoesTB.Text; clienteTemp.ReferenciaComercial = this.referenciaComercialTB.Text; clienteTemp.Rg = this.rgTB.Text; clienteTemp.Site = this.siteTB.Text; clienteTemp.Telefone = this.telefoneTB.Text; clienteTemp.DataCadastro = DateTime.Now; clienteTemp.Cnpj = null; clienteTemp.Fax = null; clienteTemp.InscricaoEstadual = null; clienteTemp.NomeContato = null; clienteTemp.NomeFantasia = null; clienteTemp.Pessoa = "Fisica"; clienteTemp.EnderecoNumero = this.textBoxNumero.Text; return(clienteTemp); }
static public string GerarNotificacao(Library.Cliente cliente) { DateTime hoje = DateTime.Now; CultureInfo culture = new CultureInfo("pt-BR"); StringBuilder sb = new StringBuilder(); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("NOTIFICAÇÃO EXTRAJUDICIAL"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(cliente.Nome + ", localizado na " + cliente.Endereco + ", Bairro " + cliente.Bairro + ", na cidade de " + cliente.Cidade + " - " + cliente.Estado + ", vem por meio desta, solicitar o comparecimento de Vossa Senhoria, com intuito de obter uma solução amigável para o problema"); sb.AppendLine(""); sb.AppendLine("Certos de que seremos prontamente atendidos, desde já agradecemos"); sb.AppendLine(""); sb.AppendLine("Sem mais para o momento,"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("Miracema, " + hoje.Day + ", de " + hoje.ToString("MMMM", culture) + " de " + hoje.Year + " - " + hoje.ToString("dddd", culture)); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("OBS: Favor entrar em contato, sob pena da adoção das medidas judiciais cabíveis."); sb.AppendLine(""); sb.AppendLine(""); return(sb.ToString()); }
private Library.Venda ReturnVendaFromForm() { this.venda = new Library.Venda(); this.venda.Id = long.Parse(this.codigoTB.Text); Library.Cliente clientetmp = (Library.Cliente) this.idClienteCB.SelectedItem; if (clientetmp.Id == long.Parse(this.idClienteTB.Text)) { this.venda.Cliente = clientetmp; } else { this.venda.Cliente = null; } this.venda.Funcionario = (Library.Funcionario) this.funcionarioCB.SelectedItem; this.venda.Data = DateTime.Parse(this.dataTB.Text); this.venda.Valor = this.valorTotalTextBox.Text.ConvertToDecimal(); return(venda); }