initial commit
This commit is contained in:
88
stuff/Cliente/ConsultaCliente.cs
Normal file
88
stuff/Cliente/ConsultaCliente.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Windows.Forms;
|
||||
using CSharpLibrary.SqlTypes;
|
||||
using CSharpLibrary.stuff;
|
||||
|
||||
namespace TelasProjeto
|
||||
{
|
||||
public partial class formConsultarCliente : Form
|
||||
{
|
||||
public Cliente c1;
|
||||
int id;
|
||||
public formConsultarCliente()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnConsultarCliente_Click(object sender, EventArgs e)
|
||||
{
|
||||
search srch = new search(this, 7);
|
||||
srch.Show();
|
||||
}
|
||||
public void UpdateTxt()
|
||||
{
|
||||
id = (int)c1.id;
|
||||
txtNomeCliente.Text = c1.nome;
|
||||
txtNumero.Text = c1.num;
|
||||
txtCelular.Text = c1.cel;
|
||||
txtCidade.Text = c1.cidade;
|
||||
txtCPF.Text = c1.cpf;
|
||||
txtRG.Text = c1.rg;
|
||||
txtRua.Text = c1.rua;
|
||||
txtTel.Text = c1.tel;
|
||||
statusCliente.Text = c1.STATUS_PESSOA;
|
||||
|
||||
}
|
||||
private void btnAlterarCliente_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (c1 != null)
|
||||
{
|
||||
txtNomeCliente.Enabled =
|
||||
txtNumero.Enabled =
|
||||
txtCelular.Enabled =
|
||||
txtCidade.Enabled =
|
||||
txtCPF.Enabled =
|
||||
txtRG.Enabled =
|
||||
txtRua.Enabled =
|
||||
txtTel.Enabled =
|
||||
statusCliente.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSalvarCliente_Click(object sender, EventArgs e)
|
||||
{
|
||||
SqlException sql = null;
|
||||
try
|
||||
{
|
||||
if (c1 != null)
|
||||
{
|
||||
c1.Edit(
|
||||
id, new List<string>
|
||||
{
|
||||
txtNomeCliente.Text,
|
||||
txtNumero.Text,
|
||||
txtCelular.Text,
|
||||
txtCidade.Text,
|
||||
txtCPF.Text,
|
||||
txtRG.Text ,
|
||||
txtRua.Text,
|
||||
txtTel.Text,
|
||||
statusCliente.SelectedItem.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (SqlException g)
|
||||
{
|
||||
sql = g;
|
||||
MessageBox.Show("Falha na alteração de dados!");
|
||||
}
|
||||
if (sql == null)
|
||||
{
|
||||
MessageBox.Show("Dados atualizados!");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user