示例#1
0
        protected override void OnChanged(string propertyName, object oldValue, object newValue)
        {
            base.OnChanged(propertyName, oldValue, newValue);
            if (propertyName == "Cliente")
            {
                Direccion = Cliente?.Direccion;
                if (TipoDeFactura == TipoFactura.Credito)
                {
                    Vence = Fecha.AddDays(Convert.ToDouble(Cliente?.DiasDeCredito));
                }
            }

            if (propertyName == "Moneda")
            {
                if (moneda.Local == false)
                {
                    try
                    {
                        Tasas TasaDelDia = Session.FindObject <Tasas>(CriteriaOperator.Parse("Moneda=" + Moneda.ToString() + " and Fecha=" + Fecha.ToString() + ""));
                        TasaCambiaria = Convert.ToDecimal(TasaDelDia?.Tasa);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            if (propertyName == "Total")
            {
                Conv convertir = new Conv();
                TotalEnLetras = convertir.enletras((Total * TasaCambiaria).ToString()) + " LEMPIRAS";
            }
        }
示例#2
0
        protected override void OnChanged(string propertyName, object oldValue, object newValue)
        {
            if (propertyName == "Moneda")
            {
                Tasas tasa = Session.FindObject <Tasas>(CriteriaOperator.Parse("Codigo='" + Moneda.Codigo + "' and GetDate(Fecha)='" + Fecha.ToString("yyyyMMdd") + "'"));
                if (tasa != null)
                {
                    _Factor = tasa.Tasa;
                }
            }
            if (Cliente != null)
            {
                if (propertyName == "Fecha")
                {
                    _Vence = Fecha.AddDays(_Cliente.DiasDeCredito);
                }
                _Registro  = Cliente.Registro;
                _Direccion = Cliente.Direccion;
            }

            base.OnChanged(propertyName, oldValue, newValue);
        }