Пример #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (ControlErrores())
            {
                if (_Estado == Negocios.FuncionesGlobales.Globales.Modo.Agregar)
                {
                    _Cuenta = new CuentaN(
                        txtNombre.Text,
                        txtNombreFantasia.Text == "" ? null : txtNombreFantasia.Text,
                        Globales.ConvertInt(cmbCategoriaAFIP.SelectedValue.ToString()),
                        Globales.ConvertInt(cmbTipoDoc.SelectedValue.ToString()),
                        txtNumeroDoc.Text == "" ? null : txtNumeroDoc.Text,
                        txtIngBrutos.Text == "" ? null : txtIngBrutos.Text,
                        Globales.ConvertInt(txtCodigoLocalidad.Text),
                        txtDomicilio.Text == "" ? null : txtDomicilio.Text,
                        Globales.ConvertInt(txtNumeroDomicilio.Text),
                        Globales.ConvertInt(txtPiso.Text),
                        txtDepartamento.Text == "" ? null : txtDepartamento.Text,
                        chkProveedor.Checked,
                        txtMail.Text == "" ? null : txtMail.Text,
                        txtTelefono.Text == "" ? null : txtTelefono.Text);


                    if (_Cuenta.Guardar())
                    {
                        dgvclipro.Rows.Add();
                        dgvclipro.Rows[dgvclipro.Rows.Count - 1].Cells["ID"].Value       = _Cuenta.Id;
                        dgvclipro.Rows[dgvclipro.Rows.Count - 1].Cells["Nombre"].Value   = _Cuenta.Nombre;
                        dgvclipro.Rows[dgvclipro.Rows.Count - 1].Cells["mail"].Value     = _Cuenta.Mail;
                        dgvclipro.Rows[dgvclipro.Rows.Count - 1].Cells["Telefono"].Value = _Cuenta.Telefono;
                    }
                    else
                    {
                        MessageBox.Show("La cuenta no a sido guardada, Intente nuevamente.\nDe lo contrario contacte a sus programadores.");
                    }
                }
                if (_Estado == Negocios.FuncionesGlobales.Globales.Modo.Modificar)
                {
                    _Cuenta.Departamento      = txtDepartamento.Text;
                    _Cuenta.Domicilio         = txtDomicilio.Text;
                    _Cuenta.NroIngresosBrutos = txtIngBrutos.Text;
                    _Cuenta.IdLocalidad       = int.Parse(txtCodigoLocalidad.Text);
                    _Cuenta.Mail            = txtMail.Text;
                    _Cuenta.Nombre          = txtNombre.Text;
                    _Cuenta.NombreFantasia  = txtNombreFantasia.Text;
                    _Cuenta.NroDocumento    = txtNumeroDoc.Text;
                    _Cuenta.NroDomicilio    = int.Parse(txtNumeroDomicilio.Text);
                    _Cuenta.Piso            = int.Parse(txtPiso.Text);
                    _Cuenta.Telefono        = txtTelefono.Text;
                    _Cuenta.IdCategoriaAfip = int.Parse(cmbCategoriaAFIP.SelectedValue.ToString());
                    _Cuenta.IdTipoDocumento = int.Parse(cmbTipoDoc.SelectedValue.ToString());
                    if (_Cuenta.Actualizar())
                    {
                        MessageBox.Show("El Registro se modifico correctamente");
                    }
                    else
                    {
                        MessageBox.Show("El registro no se ha modificado");
                    }
                }
                Limpiarpantalla();
                btnGuardar.Enabled   = false;
                btnCancelar.Enabled  = false;
                btnModificar.Enabled = false;
                btnEliminar.Enabled  = false;
                Bloqueartxt();
            }
            else
            {
                MessageBox.Show("Revise los campos campos obligatorios");
            }
        }
Пример #2
0
        public void txtCuenta_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && txtCuenta.Text != "")
            {
                _Cuenta = new CuentaN(int.Parse(txtCuenta.Text));

                if (_Cuenta.Succed)
                {
                    txtNombreCuenta.Text = _Cuenta.Nombre;
                }
                else
                {
                    txtCuenta.Text = "";
                    MessageBox.Show("La Cuenta ingresada no existe");
                }

                /* if (txtIdTipoMov.Text != "" && txtPuntoVenta.Text != "" && txtCuenta.Text != "" && ((txtNroComprobante.Text != "" && _TipoMovimiento.Numeracion == "M") || (txtNroComprobante.Text == "" && _TipoMovimiento.Numeracion == "A")))
                 * {*/

                if (txtIdTipoMov.Text != "")
                {
                    _Movimiento = new MovimientoN(int.Parse(txtIdTipoMov.Text), int.Parse(txtPuntoVenta.Text), int.Parse(txtNroComprobante.Text == "" ? "0" : txtNroComprobante.Text), int.Parse(txtCuenta.Text));
                    if (_Movimiento.Id != 0)
                    {
                        ClaveMov = _Movimiento.Id;
                        txtFechaComprobante.Text       = _Movimiento.Fecha.ToShortDateString();
                        cmbCondicionPago.SelectedValue = _Movimiento.CondicionDePago;
                        txtFechaContabilizacion.Text   = _Movimiento.FechaContabilizacion.ToShortDateString();
                        txtObservaciones.Text          = _Movimiento.Observacion;
                        CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Consultar);
                        if (_Movimiento.ListarDetalles().Count > 0)
                        {
                            LlenarDTGV(_Movimiento.ListarDetalles());
                        }
                        _MovimientoActual    = _Movimiento;
                        btnModificar.Enabled = false;
                        btnGrabar.Enabled    = false;
                        btnAnular.Enabled    = true;
                    }
                    else
                    {
                        btnAnular.Enabled = false;
                        CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Agregar);
                        if (_TipoMovimiento.Numeracion == "A")
                        {
                            txtNroComprobante.Text = "";
                        }
                    }
                }
                //}
            }
            else if (e.KeyCode == Keys.F3)
            {
                try
                {
                    List <CuentaN> Cuentas = Negocios.FuncionesGlobales.CuentaS.ListadoCuentas();
                    string[]       cool    = { "Id", "Nombre" };
                    txtCuenta.Parametros <CuentaN>(Keys.F3, cool, "Id", Cuentas, "Nombre");
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.StackTrace);
                    throw;
                }
            }
        }