コード例 #1
0
ファイル: cambiar_estado.cs プロジェクト: Ernesteins/sercor
        private void btnAceptar_Click_1(object sender, EventArgs e)
        {
            if (chklEstado.SelectedIndex == -1)
            {
                MessageBox.Show("Un estado debe ser seleccionado");
            }
            else
            {
                try
                {
                    Trabajo tTrabajo = new Trabajo();

                    tTrabajo.ID     = Convert.ToInt32(txtCodigo.Text.Trim());
                    tTrabajo.ESTADO = chklEstado.SelectedIndex + 1;


                    int resultado = TrabajoDBM.Modificar(tTrabajo, codigo);
                    if (resultado > 0)
                    {
                        mensaje = "Producto modificado con exito";
                        this.Close();
                    }
                    else
                    {
                        mensaje = "No es posible modificar el estado del Trabajo";
                        this.Close();
                    }
                }
                catch (System.FormatException)
                {
                    MessageBox.Show("Valores incorrectos");
                }
                catch (MySql.Data.MySqlClient.MySqlException)
                {
                    MessageBox.Show("Error en la base de datos, contacte con el administrador");
                }
            }
        }
コード例 #2
0
        public detalleForm(Factura _factura, bool admin)
        {
            InitializeComponent();

            if (admin == false)
            {
                btnAnular.Enabled = false;
            }

            _cliente = ClienteDBM.ObtenerCliente(_factura.ID_CLIENTE, null);
            _pago    = PagoDBM.ConsultarUnicoPago(_factura.ID_CUENTA);
            _cuenta  = CuentaDBM.ObtenerCuentaporID_cuenta(_factura.ID_CUENTA);
            _detalle = DetalleDBM.ObtenerDetalle(_factura.ID_DETALLE);
            _trabajo = TrabajoDBM.TrabajoFecha(_factura.ID_FACTURA);
            _usuario = UsuarioDBM.ObtenerUsuario(_factura.ID_USUARIO);

            vistaFactura.DataSource = ProductoVendidoDBM.ObtenerProductosDetalle(_factura.ID_DETALLE);

            txtId.Text              = _factura.ID_CLIENTE;
            txtName.Text            = _cliente.NOMBRE;
            txtTelefono.Text        = _cliente.TELEFONO;
            txtDireccion.Text       = _cliente.DIRECCION;
            txtDescuento.Text       = _factura.FACTOR_DESCUENTO.ToString();
            txtDate.Text            = _factura.FECHA;
            ordenTipo.SelectedIndex = _factura.TIPO;
            lblNumeroFactura.Text   = _factura.INDICE.ToString();

            metodoPago.SelectedIndex = _pago.TIPO_PAGO;

            txtTarjeta.Text = _pago.TARJETA;
            txtTipo.Text    = _pago.TIPO;
            txtREF.Text     = _pago.REF;
            txtBanco.Text   = _pago.BANCO;
            txtChque.Text   = _pago.CHEQUE;

            decimal a = _detalle.SUBTOTAL * 0.12m;

            txtIva.Text = a.ToString();

            txtTotal.Text    = _cuenta.TOTAL.ToString();
            txtSaldo.Text    = _cuenta.SALDO.ToString();
            txtSubtotal.Text = _detalle.SUBTOTAL.ToString();

            txtFechaEntrega.Text = _trabajo.FECHA_ENTREGA;
            txtResponsable.Text  = _usuario.NOMBRE + " " + _usuario.APELLIDO;

            if (_cuenta.TOTAL == 0)
            {
                txtId.ForeColor        = System.Drawing.Color.Red;
                txtName.ForeColor      = System.Drawing.Color.Red;
                txtTelefono.ForeColor  = System.Drawing.Color.Red;
                txtDireccion.ForeColor = System.Drawing.Color.Red;
                txtDate.ForeColor      = System.Drawing.Color.Red;
                txtTotal.ForeColor     = System.Drawing.Color.Red;

                txtId.Text        = "ANULADO";
                txtName.Text      = "ANULADO";
                txtTelefono.Text  = "ANULADO";
                txtDireccion.Text = "ANULADO";
                txtDate.Text      = "ANULADO";

                btnAnular.Enabled = false;
            }
        }