Exemple #1
0
        //Fin Cristian 0000146
        //Fin Cristian

        public void BuscarAhora()
        {
            if (ByFechas)
            {
                _fechaDesde = systemframework.Util.GetStartDay(_fechaDesde);
                _fechaHasta = systemframework.Util.GetEndDay(_fechaHasta);
            }
            else
            {
                _fechaDesde = DateTime.MinValue;
                _fechaHasta = DateTime.MinValue;
            }
            if (this._origen == "GENERAL")
            {
                if (ByCuenta)
                {
                    if (_tipo.Equals("CUENTA"))
                    {
                        if (_codigoCuenta != String.Empty)
                        {
                            businessrules.Cuenta cuenta = new mz.erp.businessrules.Cuenta();
                            cuenta.GetCuenta_CodigoCuenta(_codigoCuenta);
                            _idCuenta = cuenta.IdCuenta;
                        }
                    }
                    else
                    {
                        if (_codigoProveedor != String.Empty)
                        {
                            businessrules.Proveedor prov = new mz.erp.businessrules.Proveedor();
                            prov.GetCuenta_CodigoProveedor(_codigoProveedor);
                            _idProveedor = prov.IdProveedor;
                        }
                    }
                }
                else
                {
                    if (_tipo.Equals("CUENTA"))
                    {
                        _idCuenta = String.Empty;
                    }
                    else if (_tipo.Equals("PROVEEDOR"))
                    {
                        _idProveedor = String.Empty;
                    }
                }
            }
            else
            {
                //this._origen es "GENERAL". IdCuenta ya vino desde el constructor.
            }

            string IdResponsable = String.Empty;

            if (_idUsuario != String.Empty)
            {
                IdResponsable = sy_Usuarios.GetByPk(_idUsuario).IdPersona;
            }

            DataTable tabla = null;

            if (_tipo.Equals("CUENTA"))
            {
                tabla = mz.erp.businessrules.tsa_CuentasObservaciones.GetListEx(_idCuenta, _fechaDesde, _fechaHasta, _idTipo, _idSubTipo, _idEstado, IdResponsable);
            }
            else
            {
                tabla = mz.erp.businessrules.tpu_ProveedoresObservaciones.GetListEx(_idProveedor, _fechaDesde, _fechaHasta, _idTipo, _idSubTipo, _idEstado, IdResponsable);
            }
            string rowFilter;

            if (_verAvisosPendientes)
            {
                rowFilter = String.Format("FechaAviso <= '{0}' AND FechaVencimiento >= '{0}'", DateTime.Now);
            }
            else
            {
                rowFilter = "";
            }

            DataView view = new DataView(tabla, rowFilter, "", System.Data.DataViewRowState.OriginalRows);

            _dataSearch = view;

            if (DataSearchChanged != null)
            {
                DataSearchChanged(this, new System.EventArgs());
            }
        }