public ClienteEntity BuscarPorRut(string rut) { ClienteEntity cliente = null; ClienteTableAdapter adapter = new ClienteTableAdapter(); ClienteRow fila = adapter.BuscarPorRut(rut).FirstOrDefault(); if (fila != null) { cliente = new ClienteEntity(); cliente.Rut = fila.RutCliente; cliente.RazonSocial = fila.RazonSocial; cliente.Direccion = fila.Direccion; cliente.MailContacto = fila.MailContacto; cliente.NombreContacto = fila.NombreContacto; cliente.Telefono = fila.Telefono; //Llamando a dao actividad para buscar objeto cliente.Actividad = daoA.BuscarPorId(fila.IdActividadEmpresa); //Llamando a dao tipo para buscar objeto cliente.Tipo = daoT.BuscarPorId(fila.IdTipoEmpresa); } return(cliente); }
public void CrearDataSetCompleto() { dsAlmacen = new DsAlmacen(); daCliente = new DsAlmacenTableAdapters.ClienteTableAdapter(); daCliente.Fill(dsAlmacen.Cliente); daPedido = new DsAlmacenTableAdapters.PedidoTableAdapter(); daPedido.Fill(dsAlmacen.Pedido); daEmpleado = new DsAlmacenTableAdapters.EmpleadoTableAdapter(); daEmpleado.Fill(dsAlmacen.Empleado); daProducto = new DsAlmacenTableAdapters.ProductoTableAdapter(); daProducto.Fill(dsAlmacen.Producto); daDetalles = new DsAlmacenTableAdapters.DetallesPedidoTableAdapter(); daDetalles.Fill(dsAlmacen.DetallesPedido); daCategoria = new DsAlmacenTableAdapters.CategoriaTableAdapter(); daCategoria.Fill(dsAlmacen.Categoria); daProveedor = new DsAlmacenTableAdapters.ProveedorTableAdapter(); daProveedor.Fill(dsAlmacen.Proveedor); }
public List <ClienteEntity> BuscarCoincidenciasRut(string rut) { List <ClienteEntity> clientes = new List <ClienteEntity>(); ClienteTableAdapter adapter = new ClienteTableAdapter(); //Recorrer tabla por fila y crear objeto //con la información de la fila foreach (ClienteRow fila in adapter.BuscarPorRut(rut)) { ClienteEntity cliente = new ClienteEntity(); cliente.Rut = fila.RutCliente; cliente.RazonSocial = fila.RazonSocial; cliente.Direccion = fila.Direccion; cliente.MailContacto = fila.MailContacto; cliente.NombreContacto = fila.NombreContacto; cliente.Telefono = fila.Telefono; //Llamando a dao actividad para buscar objeto cliente.Actividad = daoA.BuscarPorId(fila.IdActividadEmpresa); //Llamando a dao tipo para buscar objeto cliente.Tipo = daoT.BuscarPorId(fila.IdTipoEmpresa); clientes.Add(cliente); } return(clientes); }
private void frmClienteCadast_Load(object sender, EventArgs e) { ClienteTableAdapter taCliente = new ClienteTableAdapter(); string ultimopedido = taCliente.UltimoCod1().ToString(); txtCod.Text = ultimopedido; }
public void LlenarCliente(ComboBox CbCliente) { ClienteTableAdapter adapter = new ClienteTableAdapter(); CbCliente.DataSource = adapter.GetDataByCb(); CbCliente.DisplayMember = "Nombre"; CbCliente.ValueMember = "IdCliente"; CbCliente.SelectedIndex = 0; }
public void Modificar(ClienteEntity cliente) { ClienteTableAdapter adapter = new ClienteTableAdapter(); adapter.Modificar( cliente.RazonSocial, cliente.NombreContacto, cliente.MailContacto, cliente.Direccion, cliente.Telefono, cliente.Actividad.Id, cliente.Tipo.Id, cliente.Rut); }
private void frmClienteConsulta_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed. //this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido); // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed. //this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido); txtCod.Enabled = false; frmCliente usu = new frmCliente(); if (!this.Propriedades.Equals("")) { txtCod.Text = this.Propriedades; } ClienteTableAdapter taPessoa = new ClienteTableAdapter(); DataTable dtPessoa; dtPessoa = taPessoa.Pesquisa_Cliente(int.Parse(txtCod.Text)); if (dtPessoa.Rows.Count == 0) { MessageBox.Show("Pessosa Não Cadastrada"); this.Close(); } else { txtNome.Text = dtPessoa.Rows[0]["Nome_Cliente"].ToString(); txtSobrenome.Text = dtPessoa.Rows[0]["Sobrenome_Cliente"].ToString(); dtpDataNasc.Value = DateTime.Parse(dtPessoa.Rows[0]["DataNascimento_Cliente"].ToString()); cbxSex.Text = dtPessoa.Rows[0]["Sexo_Cliente"].ToString(); txtEnd.Text = dtPessoa.Rows[0]["Endereco_Cliente"].ToString(); txtNum.Text = dtPessoa.Rows[0]["NumeroCasa_Cliente"].ToString(); txtBairro.Text = dtPessoa.Rows[0]["Bairro_Cliente"].ToString(); txtCidade.Text = dtPessoa.Rows[0]["Cidade_Cliente"].ToString(); cbxUF.Text = dtPessoa.Rows[0]["Estado_Cliente"].ToString(); txtTel.Text = dtPessoa.Rows[0]["Telefone_Cliente"].ToString(); txtCel.Text = dtPessoa.Rows[0]["Celular_Cliente"].ToString(); txtFoto.Text = dtPessoa.Rows[0]["Foto_Cliente"].ToString(); if (txtFoto.Text == "") { } else { pictureBox1.ImageLocation = txtFoto.Text; pictureBox1.Load(); } this.pedidoTableAdapter.FillBy2(this.lealDataSet.Pedido, Convert.ToInt32(txtCod.Text)); //PedidoTableAdapter taPedido = new PedidoTableAdapter(); //DataTable dt; //dt = taPedido.SelectCliente(Convert.ToInt32(txtCod.Text)); //pedidoDataGridView.DataSource = dt; } }
private void btnAtualizaCadast_Click(object sender, EventArgs e) { ClienteTableAdapter taPessoa = new ClienteTableAdapter(); taPessoa.UpdateQuery1(txtNome.Text, txtSobrenome.Text, dtpDataNasc.Text, cbxSex.Text, txtEnd.Text, int.Parse(txtNum.Text), txtBairro.Text, txtCidade.Text, cbxUF.Text, txtTel.Text, txtCel.Text, txtFoto.Text, int.Parse(txtCod.Text), int.Parse(txtCod.Text)); MessageBox.Show("Pessoa Atualizada com sucesso!"); frmCliente att = new frmCliente(); att.Show(); this.Close(); }
public override bool Excluir() { bool bExcluir = false; if (nCodGenerico == 1) { MessageBox.Show("Não é possível excluir cadastros do sistema.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); return(bExcluir); } ClienteTableAdapter ta = new ClienteTableAdapter(); bExcluir = (ta.Delete(nCodGenerico) > 0); return(bExcluir); }
public void Crear(ClienteEntity cliente) { //Creacion de objeto Adaptador de la tabla Cliente que //posee el CRUD ClienteTableAdapter adapter = new ClienteTableAdapter(); //Llamamos al método insertar del adaptador adapter.Insert(cliente.Rut, cliente.RazonSocial, cliente.NombreContacto, cliente.MailContacto, cliente.Direccion, cliente.Telefono, int.Parse(cliente.Actividad.Id.ToString()), int.Parse(cliente.Tipo.Id.ToString())); }
private void btnCadastrar_Click(object sender, EventArgs e) { //try // { ClienteTableAdapter taPessoa = new ClienteTableAdapter(); taPessoa.Insert(txtNome.Text, txtSobrenome.Text, dtpDataNasc.Value, cbxSex.Text, txtEnd.Text, int.Parse(txtNumer.Text), txtBairro.Text, txtCidade.Text, cbxUF.Text, txtTel.Text, txtCel.Text, txtFoto.Text); MessageBox.Show("Cliente Cadastrada com sucesso!"); Limpar_Caixa(); txtCod.Text = taPessoa.UltimoCOD().ToString(); this.Close(); //} //catch(Exception ex) //{ // MessageBox.Show(ex.Message); //} }
public void TraerClientes(DataGridView DgvMostrar) { DgvMostrar.Rows.Clear(); ClienteTableAdapter adapter = new ClienteTableAdapter(); ClienteDataTable mitabla = adapter.GetData(); for (int i = 0; i < mitabla.Count; i++) { ClienteRow misRegistro = (ClienteRow)mitabla.Rows[i]; DgvMostrar.Rows.Add( null, misRegistro.IdCliente, misRegistro.Nombre, misRegistro.Ci, misRegistro.Telefono, misRegistro.FechaNacimiento); } }
private void frmCaixa_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lealDataSet.Cliente' table. You can move, or remove it, as needed. this.clienteTableAdapter.Fill(this.lealDataSet.Cliente); // TODO: This line of code loads data into the 'lealDataSet.Pedido' table. You can move, or remove it, as needed. this.pedidoTableAdapter.Fill(this.lealDataSet.Pedido); try { txtPag.Text = "Cancelado"; dateTimePicker1.Text = DateTime.Now.ToString(); PedidoTableAdapter taPedido = new PedidoTableAdapter(); string ultimopedido = taPedido.UltimoCOD().ToString(); txtNumPedido.Text = ultimopedido; if (!this.codcli.Equals("")) { txtCodCli.Text = this.codcli; } ClienteTableAdapter taCliente = new ClienteTableAdapter(); DataTable dtCliente; dtCliente = taCliente.Pesquisa_Cliente(int.Parse(txtCodCli.Text)); if (dtCliente.Rows.Count == 0) { MessageBox.Show("Pessosa Não Cadastrada"); this.Close(); } else { txtNome.Text = dtCliente.Rows[0]["Nome_Cliente"].ToString(); txtSobrenome.Text = dtCliente.Rows[0]["Sobrenome_Cliente"].ToString(); txtNomeCli.Text = txtNome.Text + " " + txtSobrenome.Text; } //ClienteTableAdapter taCliente = new ClienteTableAdapter(); //DataTable dtCliente; //dtCliente = taCliente.QueyBox2(); //cbxClientes.Text = dtCliente.Rows[1]["NomeComp"].ToString(); ; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override bool Salvar() { bool bSalvar = false; try { if (CaixasOK() == false) { return(false); } string sexo; if (cmbSexo.Text == "Feminino") { sexo = "f"; } else { sexo = "m"; } ClienteTableAdapter ta = new ClienteTableAdapter(); if (sStatus == StatusCadastro.scIncluindo) { bSalvar = (ta.Insert(txtNome.Text, txtEnd.Text, int.Parse(txtNum.Text), txtBairro.Text, mskCEP.Text, txtComp.Text, txtCidade.Text, txtUF.Text, mskTel.Text, mskCel.Text, txtEmail.Text, txtRG.Text, mskCPF.Text, DateTime.Parse(mskDataNasc.Text), sexo, txtObs.Text) > 0); } else if (sStatus == StatusCadastro.scAlterando) { if (nCodGenerico == 1) { MessageBox.Show("Não é possível alterar cadastros do sistema.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); return(bSalvar); } bSalvar = (ta.Update(txtNome.Text, txtEnd.Text, int.Parse(txtNum.Text), txtBairro.Text, mskCEP.Text, txtComp.Text, txtCidade.Text, txtUF.Text, mskTel.Text, mskCel.Text, txtEmail.Text, txtRG.Text, mskCPF.Text, DateTime.Parse(mskDataNasc.Text), sexo, txtObs.Text, nCodGenerico) > 0); } } catch (Exception e) { MessageBox.Show("Algum campo foi inserido incorretamente.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(bSalvar); }
private void dgvPesquisa_SelectionChanged(object sender, EventArgs e) { if (dgvPesquisa.Rows.Count == 0) { lblInfo.Text = "Não foi encontrado registros!"; lblInfo.ForeColor = Color.Red; ErroPesquisa(); lblTel.Visible = false; lblCel.Visible = false; return; } if (lblNomeTab.Text == "Débitos") { ClienteTableAdapter taCli = new ClienteTableAdapter(); DB_ConceptDataSet.ClienteDataTable dtCli = new DB_ConceptDataSet.ClienteDataTable(); dtCli = taCli.PegaTel(dgvPesquisa.CurrentRow.Cells["Nome_Cli"].Value.ToString()); string vTel = dtCli.Rows[0]["Tel_Cli"].ToString(); string vCel = dtCli.Rows[0]["Cel_Cli"].ToString(); if (dgvPesquisa.CurrentRow.Cells["Possui_Debito"].Value.ToString() == "sim") { lblTel.Visible = true; lblTel.Text = "Tel: " + vTel; if (vCel != null && vCel != "( ) - ") { lblCel.Visible = true; lblCel.Text = "Cel: " + vCel; } else{ lblCel.Visible = false; } } else { lblTel.Visible = false; lblCel.Visible = false; } } }
private void btnExcluir_Click(object sender, EventArgs e) { ClienteTableAdapter tapessoa = new ClienteTableAdapter(); DataTable dtPessoa; dtPessoa = tapessoa.Pesquisa_Cliente(int.Parse(txtCod.Text)); if (dtPessoa.Rows.Count == 0) { MessageBox.Show("Pessosa Não Cadastrada"); } else { txtNome.Text = dtPessoa.Rows[0]["Nome_Cliente"].ToString(); txtSobrenome.Text = dtPessoa.Rows[0]["Sobrenome_Cliente"].ToString(); dtpDataNasc.Value = DateTime.Parse(dtPessoa.Rows[0]["DataNascimento_Cliente"].ToString()); cbxSex.Text = dtPessoa.Rows[0]["Sexo_Cliente"].ToString(); txtEnd.Text = dtPessoa.Rows[0]["Endereco_Cliente"].ToString(); txtNum.Text = dtPessoa.Rows[0]["NumeroCasa_Cliente"].ToString(); txtBairro.Text = dtPessoa.Rows[0]["Bairro_Cliente"].ToString(); txtCidade.Text = dtPessoa.Rows[0]["Cidade_Cliente"].ToString(); cbxUF.Text = dtPessoa.Rows[0]["Estado_Cliente"].ToString(); txtTel.Text = dtPessoa.Rows[0]["Telefone_Cliente"].ToString(); txtCel.Text = dtPessoa.Rows[0]["Celular_Cliente"].ToString(); txtFoto.Text = dtPessoa.Rows[0]["Foto_Cliente"].ToString(); if (MessageBox.Show("Deseja Excluir?", "Confirma", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { tapessoa.Delete2(int.Parse(txtCod.Text)); } txtCod.Focus(); if (DialogResult == DialogResult.Yes) { MessageBox.Show("Pessoa Excluida"); } frmCliente att = new frmCliente(); att.Show(); this.Close(); } }
internal List<Cliente> cercaClientiPerMailAuguri() { var clta = new ClienteTableAdapter(); List<Cliente> clist = new List<Cliente>(); var cldt = clta.GetDataForMailAuguri(); foreach (var cldr in cldt) { clist.Add(new Cliente { Nome = cldr.IsNomeNull() ? "" : cldr.Nome, Cognome = cldr.IsCognomeNull() ? "" : cldr.Cognome, DataNascita = cldr.IsDataNascitaNull() ? DateTime.MinValue : cldr.DataNascita, Email = cldr.IsEmailNull() ? "" : cldr.Email }); } return clist; }
private void lanza_impresion_electronicos() { BD basedatos = new BD(); string strPagos = "Select Prestamo,Avaluo,Boleta_Fecha from Boleta_encabezado Where Boleta_id=" + boleta_id + ""; SqlDataAdapter da = new SqlDataAdapter(strPagos, basedatos.conexionsql()); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { MessageBox.Show(ex.Message); } //PRESTODataSet.PagosDataTable dt = new PRESTODataSet.PagosDataTable(); DataTable dt = new DataTable("Pagos"); dt.Columns.Add("IdBoleta", typeof(int)); dt.Columns.Add("Importe", typeof(double)); dt.Columns.Add("Interes", typeof(double)); dt.Columns.Add("Almacenaje", typeof(double)); dt.Columns.Add("IVA", typeof(double)); dt.Columns.Add("PorRefrendo", typeof(double)); dt.Columns.Add("PorDesempenio", typeof(double)); dt.Columns.Add("FechaPago", typeof(string)); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { switch (ds.Tables[0].Rows[0][0].ToString()) { case "1": default: double Prestamo = Convert.ToDouble(ds.Tables[0].Rows[0][0]); DateTime fecha = Convert.ToDateTime(ds.Tables[0].Rows[0][2]); for (int i = 1; i < 5; i++) { DataRow dr = dt.NewRow(); dr[0] = boleta_id; dr[1] = Prestamo; //double Interes = (Prestamo * .00486) * (i * 7); double Interes = (Prestamo * .00454) * (i * 7); dr[2] = Math.Round(Interes, 2); double Almacenaje = Prestamo * 0.006 * i; dr[3] = Math.Round(Almacenaje, 2); double IVA = (Interes + Almacenaje) * 0.16; dr[4] = Math.Round(IVA, 2); double Refrendo = (Interes + Almacenaje + IVA); dr[5] = Math.Round(Refrendo, 2); dr[6] = Prestamo + Refrendo; dr[7] = "S " + i.ToString() + "-hasta el->" + fecha.AddDays(i * 7).ToString("dd/MM/yyyy"); dt.Rows.Add(dr); } break; } } } } reportViewer1.LocalReport.DataSources.Clear(); Boleta_EncabezadoTableAdapter.Fill(PRESTODataSet.Boleta_Encabezado, boleta_id); Boleta_DetalleTableAdapter.Fill(PRESTODataSet.Boleta_Detalle, boleta_id); InteresesTableAdapter.Fill(PRESTODataSet.Intereses); ClienteTableAdapter.Fill(PRESTODataSet.Cliente, cliente_id); SucursalTableAdapter.Fill(PRESTODataSet.Sucursal, 1); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsReimprime", dt)); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsBoleta_Encabezado", PRESTODataSet.Tables["Boleta_Encabezado"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsBoletaDetalle", PRESTODataSet.Tables["Boleta_Detalle"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsIntereses", PRESTODataSet.Tables["Intereses"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsCliente", PRESTODataSet.Tables["Cliente"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsSucursal", PRESTODataSet.Tables["Sucursal"])); this.reportViewer1.RefreshReport(); }
public void Eliminar(string rut) { ClienteTableAdapter adapter = new ClienteTableAdapter(); adapter.EliminarPorRut(rut); }
public ClienteDAOImpl() { adapter = new ClienteTableAdapter(); }
public override void Atualiza_Grid() { try { this.Text = lblNomeTab.Text = "Clientes"; DB_ConceptDataSet.ClienteDataTable dt = new DB_ConceptDataSet.ClienteDataTable(); ClienteTableAdapter ta = new ClienteTableAdapter(); // dt=ta.GetData DB_ConceptDataSet ds = new DB_ConceptDataSet(); ta.Fill(ds.Cliente); dB_ConceptBindingSource2.DataSource = ds.Cliente; dgvPesquisa.DataSource = dB_ConceptBindingSource2; //Config Das Colunas do DGV dgvPesquisa.Columns[0].HeaderText = "Cod."; dgvPesquisa.Columns[0].Width = 55; dgvPesquisa.Columns[1].HeaderText = "Nome"; dgvPesquisa.Columns[1].Width = 290; dgvPesquisa.Columns[2].HeaderText = "Endereço"; dgvPesquisa.Columns[2].Width = 170; dgvPesquisa.Columns[3].HeaderText = "N°"; dgvPesquisa.Columns[3].Width = 50; dgvPesquisa.Columns[4].HeaderText = "Bairro"; dgvPesquisa.Columns[4].Width = 150; dgvPesquisa.Columns[5].HeaderText = "CEP"; dgvPesquisa.Columns[5].Width = 90; dgvPesquisa.Columns[6].HeaderText = "Complemento"; dgvPesquisa.Columns[6].Width = 150; dgvPesquisa.Columns[7].HeaderText = "Cidade"; dgvPesquisa.Columns[7].Width = 100; dgvPesquisa.Columns[8].HeaderText = "UF"; dgvPesquisa.Columns[8].Width = 45; dgvPesquisa.Columns[9].HeaderText = "Tel"; dgvPesquisa.Columns[9].Width = 140; dgvPesquisa.Columns[10].HeaderText = "Cel"; dgvPesquisa.Columns[10].Width = 140; dgvPesquisa.Columns[11].HeaderText = "E-mail"; dgvPesquisa.Columns[11].Width = 150; dgvPesquisa.Columns[12].HeaderText = "RG"; dgvPesquisa.Columns[12].Width = 110; dgvPesquisa.Columns[13].HeaderText = "CPF"; dgvPesquisa.Columns[13].Width = 130; dgvPesquisa.Columns[14].HeaderText = "Data Nasc."; dgvPesquisa.Columns[14].Width = 100; dgvPesquisa.Columns[15].HeaderText = "Sexo"; dgvPesquisa.Columns[15].Width = 60; dgvPesquisa.Columns[16].HeaderText = "Obs"; dgvPesquisa.Columns[16].Width = 200; //Carrega as combos com as colunas if (cmbColuna.Items.Count == 0) { foreach (DataColumn coluna in ds.Cliente.Columns) { cmbColuna.Items.Add(coluna.ColumnName); } } /*if (cmbColuna.Items.Count == 0) * { * for (int i = 0; i < 17; i++) * { * cmbColuna.Items.Add(dgvConsulta.Columns[i].HeaderText); * * } * }*/ dtGenerico = ds.Cliente; cmbColuna.Text = "Nome_Cli"; cmbBuscar.SelectedItem = "Que começa com"; txtParam1.Visible = true; } catch (Exception) { } }
private bool CaixasOK() { if (txtNome.Text == "") { errErro.SetError(txtNome, "Insira o nome do cliente"); return(false); } else { errErro.SetError(txtNome, ""); } if (txtEnd.Text == "") { errErro.SetError(txtEnd, "Insira o endereço"); return(false); } else { errErro.SetError(txtEnd, ""); } if (txtNum.Text == "") { errErro.SetError(txtNum, "Insira o número da residência"); return(false); } else { errErro.SetError(txtNum, ""); } if (txtBairro.Text == "") { errErro.SetError(txtBairro, "Insira o nome do bairro"); return(false); } else { errErro.SetError(txtBairro, ""); } if (mskCEP.MaskCompleted == false) { errErro.SetError(mskCEP, "Insira o CEP"); return(false); } else { errErro.SetError(mskCEP, ""); } if (txtCidade.Text == "") { errErro.SetError(txtCidade, "Insira a cidade"); return(false); } else { errErro.SetError(txtCidade, ""); } if (txtUF.Text == "") { errErro.SetError(txtUF, "Insira o estado"); return(false); } else { errErro.SetError(txtUF, ""); } if (mskTel.MaskCompleted == false) { errErro.SetError(mskTel, "Insira um número de telefone"); return(false); } else { errErro.SetError(mskTel, ""); } if (mskCel.MaskCompleted == false) { errErro.SetError(mskCel, "Insira um número de telefone"); return(false); } else { errErro.SetError(mskCel, ""); } if (txtRG.Text == "") { errErro.SetError(txtRG, "Insira o RG"); return(false); } else { errErro.SetError(txtRG, ""); } if (mskCPF.MaskCompleted == false) { errErro.SetError(mskCPF, "Insira o CPF"); return(false); } else { errErro.SetError(mskCPF, ""); } ClienteTableAdapter taCli = new ClienteTableAdapter(); DB_ConceptDataSet.ClienteDataTable dtCli = new DB_ConceptDataSet.ClienteDataTable(); dtCli = taCli.VerificaCPF(mskCPF.Text); if (dtCli.Rows.Count > 0 && btnIncluir.Text == "Incluindo") { errErro.SetError(mskCPF, "Este cliente já está cadastrado!"); return(false); } else { errErro.SetError(mskCPF, ""); } if (mskDataNasc.MaskCompleted == false) { errErro.SetError(mskDataNasc, "Insira a data de nascimento"); return(false); } else { errErro.SetError(mskDataNasc, ""); } if (cmbSexo.Text == "") { errErro.SetError(cmbSexo, "Insira o sexo"); return(false); } else { errErro.SetError(cmbSexo, ""); } return(true); }
public override void Atualiza_Grid() { try { this.Text = lblNomeTab.Text = "Clientes"; DB_ConceptDataSet.ClienteDataTable dt = new DB_ConceptDataSet.ClienteDataTable(); ClienteTableAdapter ta = new ClienteTableAdapter(); // dt=ta.GetData DB_ConceptDataSet ds = new DB_ConceptDataSet(); ta.Fill(ds.Cliente); dB_ConceptDataSetbindingSource.DataSource = ds.Cliente; dgvConsulta.DataSource = dB_ConceptDataSetbindingSource; //Config Das Colunas do DGV dgvConsulta.Columns[0].HeaderText = "Cod."; dgvConsulta.Columns[0].Width = 45; dgvConsulta.Columns[1].HeaderText = "Nome"; dgvConsulta.Columns[1].Width = 200; dgvConsulta.Columns[2].HeaderText = "Endereço"; dgvConsulta.Columns[2].Width = 150; dgvConsulta.Columns[3].HeaderText = "N°"; dgvConsulta.Columns[3].Width = 50; dgvConsulta.Columns[4].HeaderText = "Bairro"; dgvConsulta.Columns[4].Width = 150; dgvConsulta.Columns[5].HeaderText = "CEP"; dgvConsulta.Columns[5].Width = 85; dgvConsulta.Columns[6].HeaderText = "Complemento"; dgvConsulta.Columns[6].Width = 150; dgvConsulta.Columns[7].HeaderText = "Cidade"; dgvConsulta.Columns[7].Width = 100; dgvConsulta.Columns[8].HeaderText = "UF"; dgvConsulta.Columns[8].Width = 35; dgvConsulta.Columns[9].HeaderText = "Tel"; dgvConsulta.Columns[9].Width = 125; dgvConsulta.Columns[10].HeaderText = "Cel"; dgvConsulta.Columns[10].Width = 125; dgvConsulta.Columns[11].HeaderText = "E-mail"; dgvConsulta.Columns[11].Width = 150; dgvConsulta.Columns[12].HeaderText = "RG"; dgvConsulta.Columns[12].Width = 100; dgvConsulta.Columns[13].HeaderText = "CPF"; dgvConsulta.Columns[13].Width = 110; dgvConsulta.Columns[14].HeaderText = "Data Nasc."; dgvConsulta.Columns[14].Width = 105; dgvConsulta.Columns[15].HeaderText = "Sexo"; dgvConsulta.Columns[15].Width = 50; dgvConsulta.Columns[16].HeaderText = "Obs"; dgvConsulta.Columns[16].Width = 200; //Carrega as combos com as colunas if (cmbColuna.Items.Count == 0) { foreach (DataColumn coluna in ds.Cliente.Columns) { cmbColuna.Items.Add(coluna.ColumnName); } } cmbColuna.SelectedIndex = 1; dtGenerico = ds.Cliente; } catch (Exception) { } }
internal void inserisciCliente(Cliente c) { var cta = new ClienteTableAdapter(); cta.Insert(c.Nome, c.Cognome, c.IsFemmina, c.Indirizzo, c.ComuneResidenza == null ? null : (int?)c.ComuneResidenza.Id, c.StatoResidenza == null ? null : (int?)c.StatoResidenza.Id, c.Telefoni, c.Descr, c.Email, c.DataNascita == DateTime.MinValue ? null : (DateTime?)c.DataNascita, c.ComuneNascita == null ? null : (int?)c.ComuneNascita.Id, c.StatoNascita == null ? null : (int?)c.StatoNascita.Id, c.StatoCittadinanza == null ? null : (int?)c.StatoCittadinanza.Id, c.TipoDoc == null ? null : (int?)c.TipoDoc.Id, c.NumDoc, c.DataRilascioDoc == DateTime.MinValue ? null : (DateTime?)c.DataRilascioDoc, c.ComuneRilascioDoc == null ? null : (int?)c.ComuneRilascioDoc.Id, c.StatoRilascioDoc == null ? null : (int?)c.StatoRilascioDoc.Id, c.ProvenIstat == null ? null : (int?)c.ProvenIstat.Id); }
private void lanza_impresion_electronicos() { BD basedatos = new BD(); string strPagos = "select Plazo, SUM(Prestamo) Prestamo, SUM(Avaluo) Avaluo from PRESTO.dbo.Boleta_Detalle where Boleta_Id=" + boleta_id + " group by Plazo"; SqlDataAdapter da = new SqlDataAdapter(strPagos, basedatos.conexionsql()); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { MessageBox.Show(ex.Message); } //PRESTODataSet.PagosDataTable dt = new PRESTODataSet.PagosDataTable(); DataTable dt = new DataTable("Pagos"); dt.Columns.Add("IdBoleta", typeof(int)); dt.Columns.Add("Importe", typeof(double)); dt.Columns.Add("Interes", typeof(double)); dt.Columns.Add("Almacenaje", typeof(double)); dt.Columns.Add("IVA", typeof(double)); dt.Columns.Add("PorRefrendo", typeof(double)); dt.Columns.Add("PorDesempenio", typeof(double)); dt.Columns.Add("FechaPago", typeof(string)); dt.Columns.Add("Fecha_Semana", typeof(string)); dt.Columns.Add("Linea", typeof(string)); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { switch (ds.Tables[0].Rows[0][0].ToString()) { case "1": default: double Prestamo = Convert.ToDouble(ds.Tables[0].Rows[0][1]); for (int i = 1; i < 5; i++) { DataRow dr = dt.NewRow(); dr[0] = boleta_id; dr[1] = Prestamo; //double Interes = (Prestamo * .00486) * (i * 7); //0.00397 //4069 double Interes = (Prestamo * 0.004069) * (i * 7); dr[2] = Math.Round(Interes, 2); double Almacenaje = Prestamo * 0.006 * i; dr[3] = Math.Round(Almacenaje, 2); double IVA = (Interes + Almacenaje) * 0.16; dr[4] = Math.Round(IVA, 2); double Refrendo = (Interes + Almacenaje + IVA); dr[5] = Math.Round(Refrendo, 2); dr[6] = Prestamo + Refrendo; dr[7] = "S " + i.ToString() + "-hasta el->" + DateTime.Now.AddDays(i * 7).ToString("dd/MM/yyyy"); dr[8] = DateTime.Now.AddDays(i * 7).ToString("dd/MM/yyyy"); dr[9] = i * 1; dt.Rows.Add(dr); } break; } } } } foreach (DataRow dr in dt.Rows) { try { SqlCommand cmd = new SqlCommand("Insert Into Pagos Values(" + dr[0] + "," + dr[1] + "," + dr[2] + "," + dr[3] + "," + dr[4] + "," + dr[5] + "," + dr[6] + ",'" + dr[7] + "','" + dr[8] + "','" + dr[9] + "')", basedatos.conexionsql()); cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } reportViewer1.LocalReport.DataSources.Clear(); Boleta_EncabezadoTableAdapter.Fill(PRESTODataSet.Boleta_Encabezado, boleta_id); Boleta_DetalleTableAdapter.Fill(PRESTODataSet.Boleta_Detalle, boleta_id); InteresesTableAdapter.Fill(PRESTODataSet.Intereses); ClienteTableAdapter.Fill(PRESTODataSet.Cliente, cliente_id); SucursalTableAdapter.Fill(PRESTODataSet.Sucursal, 1); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsEmpenio", dt)); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsBoleta_Encabezado", PRESTODataSet.Tables["Boleta_Encabezado"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsBoletaDetalle", PRESTODataSet.Tables["Boleta_Detalle"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsIntereses", PRESTODataSet.Tables["Intereses"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsCliente", PRESTODataSet.Tables["Cliente"])); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsSucursal", PRESTODataSet.Tables["Sucursal"])); this.reportViewer1.RefreshReport(); }
internal Cliente cercaClienteNomeCognome(int idcliente) { var cta = new ClienteTableAdapter(); var cdt = cta.GetNomeCognomeById(idcliente); var c = new Cliente { Id = idcliente, Cognome = cdt[0].Cognome, Nome = cdt[0].Nome }; return c; }
internal void eliminaCliente(int idcliente) { var cta = new ClienteTableAdapter(); cta.DeleteById(idcliente); }
internal void aggiornaCliente(Cliente cl) { var cta = new ClienteTableAdapter(); cta.UpdateById( cl.Nome, cl.Cognome, cl.IsFemmina, cl.Indirizzo, cl.ComuneResidenza == null ? null : (int?)cl.ComuneResidenza.Id, cl.StatoResidenza == null ? null : (int?)cl.StatoResidenza.Id, cl.Telefoni, cl.Descr, cl.Email, cl.DataNascita == DateTime.MinValue ? null : (DateTime?)cl.DataNascita, cl.ComuneNascita== null ? null : (int?)cl.ComuneNascita.Id, cl.StatoNascita == null ? null : (int?)cl.StatoNascita.Id, cl.StatoCittadinanza == null ? null : (int?)cl.StatoCittadinanza.Id, cl.TipoDoc == null ? null : (int?)cl.TipoDoc.Id, cl.NumDoc, cl.DataRilascioDoc == DateTime.MinValue ? null : (DateTime?)cl.DataRilascioDoc, cl.ComuneRilascioDoc == null ? null : (int?)cl.ComuneRilascioDoc.Id, cl.StatoRilascioDoc == null ? null : (int?)cl.StatoRilascioDoc.Id, cl.ProvenIstat == null ? null : (int?)cl.ProvenIstat.Id, cl.Id ); }
internal void inserisciSoggiorno(Soggiorno sg, bool nuovoCliente) { OleDbConnection conn = new OleDbConnection(Properties.Settings.Default.SoggiorniDbConnectionString); OleDbCommand cmd; string queryString; if (nuovoCliente) { conn.Open(); queryString = "INSERT INTO Cliente (Nome, Cognome, Telefoni, Descrizione, Email) VALUES (?, ?, ?, ?, ?)"; cmd = new OleDbCommand(queryString, conn); cmd.Parameters.Add("Nome", OleDbType.Char, 255).Value = sg.Cliente.Nome; cmd.Parameters.Add("Cognome", OleDbType.Char, 255).Value = sg.Cliente.Cognome; cmd.Parameters.Add("Telefoni", OleDbType.Char, 255).Value = sg.Cliente.Telefoni; cmd.Parameters.Add("Descrizione", OleDbType.Char, 255).Value = sg.Cliente.Descr; cmd.Parameters.Add("Email", OleDbType.Char, 255).Value = sg.Cliente.Email; cmd.ExecuteNonQuery(); //eseguo la query per ottenere l'id appena inserito cmd = new OleDbCommand("SELECT @@IDENTITY", conn); sg.Cliente.Id = (int)cmd.ExecuteScalar(); } else {//aggiornamento dati (essenziali) cliente esistente var cta = new ClienteTableAdapter(); cta.UpdateEssentialById(sg.Cliente.Nome, sg.Cliente.Cognome, sg.Cliente.Telefoni, sg.Cliente.Descr, sg.Cliente.Email, sg.Cliente.Id); } //inserimento dati soggiorno if(conn.State != System.Data.ConnectionState.Open) conn.Open(); /* Arrivo, Partenza, Cliente.ID, Camera.ID, UsoCamera, Caparra, NoteCaparra, NoteDurataSoggiorno, * NomePrenotante, Confermato, NoteNumeroOspiti * */ queryString = "INSERT INTO Soggiorno (Arrivo, Partenza, ClienteId, CameraId, UsoCamera, Caparra, "+ "NoteCaparra, NoteDurataSoggiorno, NomePrenotante, Confermato, NoteNumeroOspiti) VALUES "+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; cmd = new OleDbCommand(queryString, conn); cmd.Parameters.Add("Arrivo", OleDbType.Date).Value = sg.Arrivo; cmd.Parameters.Add("Partenza", OleDbType.Date).Value = sg.Partenza; cmd.Parameters.Add("IdCliente", OleDbType.Integer).Value = sg.Cliente.Id; cmd.Parameters.Add("IdCamera", OleDbType.Integer).Value = sg.Camera.Id; cmd.Parameters.Add("UsoCamera", OleDbType.Char, 255).Value = sg.UsoCamera; cmd.Parameters.Add("Caparra", OleDbType.Single).Value = sg.Caparra; cmd.Parameters.Add("NoteCaparra", OleDbType.Char, 255).Value = sg.NoteCaparra; cmd.Parameters.Add("NoteSoggiorno", OleDbType.Char, 255).Value = sg.NoteDurata; cmd.Parameters.Add("Prenotante", OleDbType.Char, 255).Value = sg.Prenotante; cmd.Parameters.Add("Confermato", OleDbType.Boolean).Value = sg.Confermato; cmd.Parameters.Add("NoteCamera", OleDbType.Char, 255).Value = sg.NoteCamera; cmd.ExecuteNonQuery(); conn.Close(); }
internal List<Soggiorno> cercaSoggiorniByPagamento(int idpag) { var sogta = new SoggiornoTableAdapter(); var sogdt = sogta.GetDataByPagamento(idpag); var clita = new ClienteTableAdapter(); var camta = new CameraTableAdapter(); var slist = new List<Soggiorno>(); Soggiorno sog; foreach (var s in sogdt) { sog = new Soggiorno { Id = s.ID, Arrivo = s.Arrivo, Partenza = s.Partenza, TotaleSoggiorno = s.IsTotaleSoggiornoNull() ? 0 : s.TotaleSoggiorno, TotalePernotto = s.IsTotaleCameraNull() ? 0 : s.TotaleCamera }; var clidt = clita.GetDataById(s.ClienteId); sog.Cliente = new Cliente { Id = clidt[0].ID, Cognome = clidt[0].Cognome }; var camdt = camta.GetDataById(s.CameraId); sog.Camera = new Camera { Id = camdt[0].ID, Numero = camdt[0].Numero }; slist.Add(sog); } return slist; }
internal Cliente cercaCliente(int idcliente) { var cta = new ClienteTableAdapter(); var cdt = cta.GetDataById(idcliente); var cl = cdt[0]; var foundcliente = new Cliente { //ID, Nome, Cognome, IsFemmina, Indirizzo, ComuneResid, StatoResid, Telefoni, Descrizione, //Email, DataNascita, ComuneNascita, StatoNascita, StatoCittadinanza, TipoDocumento, NumDocumento, //DataRilascioDoc, ComuneRilascioDoc, StatoRilascioDoc, ProvenienzaIstat Id = cl.ID, Nome = cl.IsNomeNull() ? "" : cl.Nome, Cognome = cl.Cognome, IsFemmina = cl.IsFemmina, Indirizzo = cl.IsIndirizzoNull() ? "" : cl.Indirizzo, ComuneResidenza = cl.IsComuneResidNull() ? null : new Comune { Id = cl.ComuneResid }, StatoResidenza = cl.IsStatoResidNull() ? null : new Stato { Id = cl.StatoResid }, Telefoni = cl.IsTelefoniNull() ? "" : cl.Telefoni, Descr = cl.IsDescrizioneNull() ? "" : cl.Descrizione, Email = cl.IsEmailNull() ? "" : cl.Email, DataNascita = cl.IsDataNascitaNull() ? DateTime.MinValue : cl.DataNascita, ComuneNascita = cl.IsComuneNascitaNull() ? null : new Comune { Id = cl.ComuneNascita }, StatoNascita = cl.IsStatoNascitaNull() ? null : new Stato { Id = cl.StatoNascita }, StatoCittadinanza = cl.IsStatoCittadinanzaNull() ? null : new Stato { Id = cl.StatoCittadinanza }, TipoDoc = cl.IsTipoDocumentoNull() ? null : new TipoDocumento { Id = cl.TipoDocumento }, NumDoc = cl.IsNumDocumentoNull() ? "" : cl.NumDocumento, DataRilascioDoc = cl.IsDataRilascioDocNull() ? DateTime.MinValue : cl.DataRilascioDoc, ComuneRilascioDoc = cl.IsComuneRilascioDocNull() ? null : new Comune { Id = cl.ComuneRilascioDoc }, StatoRilascioDoc = cl.IsStatoRilascioDocNull() ? null : new Stato { Id = cl.StatoRilascioDoc }, ProvenIstat = cl.IsProvenienzaIstatNull() ? null : new ProvenienzaIstat { Id = cl.ProvenienzaIstat } }; //raccolgo dati comuni (se presenti) var comta = new ComuneTableAdapter(); SoggiorniDbDataSet.ComuneDataTable comdt; if (foundcliente.ComuneNascita != null) { comdt = comta.GetDataById(foundcliente.ComuneNascita.Id); foundcliente.ComuneNascita.Nome = comdt[0].Nome; foundcliente.ComuneNascita.Provincia = comdt[0].Provincia; } if (foundcliente.ComuneResidenza != null) { comdt = comta.GetDataById(foundcliente.ComuneResidenza.Id); foundcliente.ComuneResidenza.Nome = comdt[0].Nome; foundcliente.ComuneResidenza.Provincia = comdt[0].Provincia; } if (foundcliente.ComuneRilascioDoc != null) { comdt = comta.GetDataById(foundcliente.ComuneRilascioDoc.Id); foundcliente.ComuneRilascioDoc.Nome = comdt[0].Nome; foundcliente.ComuneRilascioDoc.Provincia = comdt[0].Provincia; } //raccolgo dati stati (se presenti) var stata = new StatoTableAdapter(); SoggiorniDbDataSet.StatoDataTable stadt; if (foundcliente.StatoNascita != null) { stadt = stata.GetDataById(foundcliente.StatoNascita.Id); foundcliente.StatoNascita.Nome = stadt[0].Nome; } if (foundcliente.StatoResidenza != null) { stadt = stata.GetDataById(foundcliente.StatoResidenza.Id); foundcliente.StatoResidenza.Nome = stadt[0].Nome; } if (foundcliente.StatoRilascioDoc != null) { stadt = stata.GetDataById(foundcliente.StatoRilascioDoc.Id); foundcliente.StatoRilascioDoc.Nome = stadt[0].Nome; } if (foundcliente.StatoCittadinanza != null) { stadt = stata.GetDataById(foundcliente.StatoCittadinanza.Id); foundcliente.StatoCittadinanza.Nome = stadt[0].Nome; } //raccolgo dati provenienza istat if (foundcliente.ProvenIstat != null) { var prota = new ProvenienzaIstatTableAdapter(); var prodt = prota.GetDataById(foundcliente.ProvenIstat.Id); foundcliente.ProvenIstat.Regione = prodt[0].Regione; foundcliente.ProvenIstat.Stato = prodt[0].Stato; } //raccolgo dati tipo documento if (foundcliente.TipoDoc != null) { var tdocta = new TipoDocumentoTableAdapter(); var tdocdt = tdocta.GetDataById(foundcliente.TipoDoc.Id); foundcliente.TipoDoc.Descrizione = tdocdt[0].Descrizione; } return foundcliente; }
private void frmCaixaCli_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'lealDataSet.ItemPedido' table. You can move, or remove it, as needed. this.itemPedidoTableAdapter.Fill(this.lealDataSet.ItemPedido); // TODO: This line of code loads data into the 'lealDataSet.ItemPedido' table. You can move, or remove it, as needed. this.itemPedidoTableAdapter.Fill(this.lealDataSet.ItemPedido); if (!this.Propriedade.Equals("")) { txtNumPedido.Text = this.Propriedade; } if (!this.codcli.Equals("")) { txtCodClie.Text = this.codcli; } try { ItemPedidoTableAdapter taItemPedido = new ItemPedidoTableAdapter(); DataTable dtlista; dtlista = taItemPedido.ConsultaPedido(Convert.ToInt32(txtNumPedido.Text)); dataGridView1.DataSource = dtlista; ClienteTableAdapter taCli = new ClienteTableAdapter(); dtlista = taCli.Pesquisa_Cliente(int.Parse(txtCodClie.Text)); if (dtlista.Rows.Count == 0) { MessageBox.Show("Pedido Não Encontrado!"); this.Close(); } else { txtNome.Text = dtlista.Rows[0]["Nome_Cliente"].ToString(); txtSobrenome.Text = dtlista.Rows[0]["Sobrenome_Cliente"].ToString(); txtNomeCli.Text = txtNome.Text + " " + txtSobrenome.Text; } PedidoTableAdapter taPedido = new PedidoTableAdapter(); dtlista = taPedido.Pesquisa_Pedido(int.Parse(txtNumPedido.Text)); if (dtlista.Rows.Count == 0) { MessageBox.Show("Pedido Não Encontrado"); this.Close(); } else { txtValorfin2.Text = dtlista.Rows[0]["SubTotal_Pedido"].ToString(); txtdebi.Text = dtlista.Rows[0]["Debito_Pedido"].ToString(); } if (txtdebi.Text == "0") { decimal valor = Convert.ToDecimal(txtValorfin2.Text); CultureInfo ci = new CultureInfo("pt-BR"); txtValorall.Text = valor.ToString("C2", ci); txtTotalFin.Text = valor.ToString("C2", ci); } else if (txtdebi.Text != "0") { decimal valor = Convert.ToDecimal(txtValorfin2.Text); decimal debi = Convert.ToDecimal(txtdebi.Text); CultureInfo ci = new CultureInfo("pt-BR"); txtValorall.Text = valor.ToString("C2", ci); txtTotalFin.Text = debi.ToString("C2", ci); } } catch { } }