コード例 #1
0
ファイル: ClientesNuevoWFcs.cs プロジェクト: leoimoli/SicoNew
        private void BuscarEmpresaPorCuit()
        {
            List <Cliente> _cliente = new List <Cliente>();
            var            cuit     = txtCuitBuscar.Text;

            _cliente = ClienteNeg.BuscarClientePorCuit(cuit);
            if (_cliente.Count > 0)
            {
                dgvTodosLosClientes.Rows.Clear();
                DiseñoGrilla();
                dgvTodosLosClientes.Visible = true;
                foreach (var item in _cliente)
                {
                    dgvTodosLosClientes.Rows.Add(item.IdCliente, item.NombreRazonSocial, item.Cuit, item.Actividad, item.CondicionAntiAfip);
                }
                dgvTodosLosClientes.AllowUserToAddRows = false;
            }
            else
            {
                txtBuscarRazonSocial.Focus();
                const string message = "No existe ningun cliente con el cuit ingresado.";
                const string caption = "Atención";
                var          result  = MessageBox.Show(message, caption,
                                                       MessageBoxButtons.OK,
                                                       MessageBoxIcon.Exclamation);
                throw new Exception();
            }
        }
コード例 #2
0
ファイル: ClientesNuevoWFcs.cs プロジェクト: leoimoli/SicoNew
 private void dgvTodosLosClientes_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvTodosLosClientes.CurrentCell.ColumnIndex == 5)
     {
         int    idEmpresa   = Convert.ToInt32(this.dgvTodosLosClientes.CurrentRow.Cells[0].Value.ToString());
         string RazonSocial = this.dgvTodosLosClientes.CurrentRow.Cells[1].Value.ToString();
         Sesion.UsuarioLogueado.idEmpresaSeleccionado = idEmpresa;
         Sesion.UsuarioLogueado.EmpresaSeleccionada   = RazonSocial;
         MasterNuevaWF frm2 = Application.OpenForms.OfType <MasterNuevaWF>().SingleOrDefault();
         if (frm2 != null)
         {
             frm2.lblidEmpresa.Text = Convert.ToString(idEmpresa);
             frm2.lblEmpresa.Text   = RazonSocial;
             frm2.grbEmpresaSeleccionada.Visible = true;
             Hide();
         }
     }
     if (dgvTodosLosClientes.CurrentCell.ColumnIndex == 6)
     {
         Funcion = 2;
         PanelRegistroPlan.Enabled = true;
         List <Cliente> _cliente = new List <Cliente>();
         var            cuit     = dgvTodosLosClientes.CurrentRow.Cells[2].Value.ToString();
         _cliente = ClienteNeg.BuscarClientePorCuit(cuit);
         if (_cliente.Count > 0)
         {
             var cliente = _cliente.First();
             txtNombreRazonSocial.Text = cliente.NombreRazonSocial;
             txtCuit.Text      = cliente.Cuit;
             txtActividad.Text = cliente.Actividad;
             var    tel    = cliente.Telefono;
             string varTel = tel;
             if (varTel != "")
             {
                 var split1 = varTel.Split('-')[0];
                 var split2 = varTel.Split('-')[1];
                 split1           = split1.Trim();
                 split2           = split2.Trim();
                 txtCodArea.Text  = split1;
                 txtTelefono.Text = split2;
             }
             txtEmail.Text             = cliente.Email;
             txtCalle.Text             = cliente.Calle;
             txtAltura.Text            = cliente.Altura;
             txtCodigoPostal.Text      = cliente.CodigoPostal;
             cmbCondicionAntiAfip.Text = cliente.CondicionAntiAfip;
             cmbProvincia.Text         = cliente.Provincia;
             cmbLocalidad.Text         = cliente.Localidad;
             txtCuit.Enabled           = false;
         }
     }
 }
コード例 #3
0
 private void dgvTodosLosClientes_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvTodosLosClientes.CurrentCell.ColumnIndex == 14)
     {
         //var idsubCliente = Convert.ToString(this.dgvTodosLosClientes.CurrentRow.Cells[0].Value);
         string        RazonSocial = this.dgvTodosLosClientes.CurrentRow.Cells[1].Value.ToString();
         string        Cuit        = this.dgvTodosLosClientes.CurrentRow.Cells[2].Value.ToString();
         MenuClienteWF _tarea      = new MenuClienteWF(RazonSocial, Cuit);
         _tarea.Show();
         Hide();
     }
     if (dgvTodosLosClientes.CurrentCell.ColumnIndex == 15)
     {
         List <Cliente> _cliente = new List <Cliente>();
         var            cuit     = dgvTodosLosClientes.CurrentRow.Cells[2].Value.ToString();
         _cliente = ClienteNeg.BuscarClientePorCuit(cuit);
         if (_cliente.Count > 0)
         {
             dgvTodosLosClientes.Visible = false;
             var cliente = _cliente.First();
             RazonSocial = cliente.NombreRazonSocial;
             Cuit        = cliente.Cuit;
             txtNombreRazonSocial.Text = cliente.NombreRazonSocial;
             txtCuit.Text      = cliente.Cuit;
             txtActividad.Text = cliente.Actividad;
             var    tel    = cliente.Telefono;
             string varTel = tel;
             if (varTel != "")
             {
                 var split1 = varTel.Split('-')[0];
                 var split2 = varTel.Split('-')[1];
                 split1           = split1.Trim();
                 split2           = split2.Trim();
                 txtCodArea.Text  = split1;
                 txtTelefono.Text = split2;
             }
             txtEmail.Text             = cliente.Email;
             txtCalle.Text             = cliente.Calle;
             txtAltura.Text            = cliente.Altura;
             txtCodigoPostal.Text      = cliente.CodigoPostal;
             cmbCondicionAntiAfip.Text = cliente.CondicionAntiAfip;
             cmbProvincia.Text         = cliente.Provincia;
             cmbLocalidad.Text         = cliente.Localidad;
             txtCuit.Enabled           = false;
             btnEditar.Visible         = true;
             btnEliminar.Visible       = true;
             btnHistorial.Visible      = true;
         }
     }
 }
コード例 #4
0
        private void BuscarRazonSocial()
        {
            try
            {
                if (chcPorCuit.Checked == true)
                {
                    dgvTodosLosClientes.Columns.Clear();
                    dgvTodosLosClientes.Visible = false;
                    lblCantidad.Visible         = false;
                    lblCantidadEdit.Visible     = false;
                    List <Cliente> _cliente = new List <Cliente>();
                    var            cuit     = txtCuitBuscar.Text;
                    _cliente = ClienteNeg.BuscarClientePorCuit(cuit);

                    if (_cliente.Count > 0)
                    {
                        var cliente = _cliente.First();
                        RazonSocial = cliente.NombreRazonSocial;
                        Cuit        = cliente.Cuit;
                        txtNombreRazonSocial.Text = cliente.NombreRazonSocial;
                        txtCuit.Text      = cliente.Cuit;
                        txtActividad.Text = cliente.Actividad;
                        var    tel    = cliente.Telefono;
                        string var    = tel;
                        var    split1 = var.Split('-')[0];
                        var    split2 = var.Split('-')[1];
                        split1                    = split1.Trim();
                        split2                    = split2.Trim();
                        txtCodArea.Text           = split1;
                        txtTelefono.Text          = split2;
                        txtEmail.Text             = cliente.Email;
                        txtCalle.Text             = cliente.Calle;
                        txtAltura.Text            = cliente.Altura;
                        txtCodigoPostal.Text      = cliente.CodigoPostal;
                        cmbCondicionAntiAfip.Text = cliente.CondicionAntiAfip;
                        cmbProvincia.Text         = cliente.Provincia;
                        cmbLocalidad.Text         = cliente.Localidad;
                        txtCuit.Enabled           = false;
                        btnEditar.Visible         = true;
                        btnEliminar.Visible       = true;
                        btnHistorial.Visible      = true;
                    }
                    else
                    {
                        txtBuscar.Focus();
                        const string message = "No existe ningun cliente con el cuit ingresado.";
                        const string caption = "Atención";
                        var          result  = MessageBox.Show(message, caption,
                                                               MessageBoxButtons.OK,
                                                               MessageBoxIcon.Exclamation);
                        throw new Exception();
                    }
                }
                if (chcPorNombreRazonSocial.Checked == true)
                {
                    dgvTodosLosClientes.Columns.Clear();
                    dgvTodosLosClientes.DataSource = null;
                    dgvTodosLosClientes.Visible    = false;
                    lblCantidad.Visible            = false;
                    lblCantidadEdit.Visible        = false;
                    List <Cliente> _cliente          = new List <Cliente>();
                    var            nombreRazonSocial = txtBuscar.Text;
                    _cliente = ClienteNeg.BuscarClientePorNombreRazonSocial(nombreRazonSocial);
                    if (_cliente.Count > 0)
                    {
                        var cliente = _cliente.First();
                        RazonSocial = cliente.NombreRazonSocial;
                        Cuit        = cliente.Cuit;
                        txtNombreRazonSocial.Text = cliente.NombreRazonSocial;
                        txtCuit.Text      = cliente.Cuit;
                        txtActividad.Text = cliente.Actividad;
                        var    tel    = cliente.Telefono;
                        string var    = tel;
                        var    split1 = var.Split('-')[0];
                        var    split2 = var.Split('-')[1];
                        split1                    = split1.Trim();
                        split2                    = split2.Trim();
                        txtCodArea.Text           = split1;
                        txtTelefono.Text          = split2;
                        txtEmail.Text             = cliente.Email;
                        txtCalle.Text             = cliente.Calle;
                        txtAltura.Text            = cliente.Altura;
                        txtCodigoPostal.Text      = cliente.CodigoPostal;
                        cmbCondicionAntiAfip.Text = cliente.CondicionAntiAfip;
                        cmbProvincia.Text         = cliente.Provincia;
                        cmbLocalidad.Text         = cliente.Localidad;
                        txtCuit.Enabled           = false;
                        btnEditar.Visible         = true;
                        btnEliminar.Visible       = true;
                        btnHistorial.Visible      = true;
                    }
                    else
                    {
                        txtBuscar.Focus();
                        const string message = "No existe ningun cliente con el nombre o razón social ingresado.";
                        const string caption = "Atención";
                        var          result  = MessageBox.Show(message, caption,
                                                               MessageBoxButtons.OK,
                                                               MessageBoxIcon.Exclamation);
                        throw new Exception();
                    }
                }

                if (chcTodosLosClientes.Checked == true)
                {
                    List <Entidades.Cliente> ListarClientes = ClienteNeg.ListarTodosLosClientes();
                    // ListarClientes = ClienteNeg.ListarTodosLosClientes();
                    if (ListarClientes.Count > 0)
                    {
                        foreach (var item in ListarClientes)
                        {
                            dgvTodosLosClientes.Rows.Add(item.IdCliente, item.NombreRazonSocial, item.Cuit, item.Actividad, item.CondicionAntiAfip);
                        }
                    }
                    dgvTodosLosClientes.ReadOnly = true;
                }
            }
            catch (Exception ex)
            {
            }
        }