public ExchangeRate GetLatest(DevExpress.Xpo.Session session, Guid currencyId) { ExchangeRate ret = null; try { //Get currency NAS.DAL.Accounting.Currency.Currency currency = session.GetObjectByKey <NAS.DAL.Accounting.Currency.Currency>(currencyId); var activeExchangeRates = currency.exchangeRates.Where(r => r.Status == Utility.Constant.STATUS_EXCHANGE_RATE_ACTIVE); if (activeExchangeRates == null || activeExchangeRates.Count() == 0) { return(null); } DateTime latestDate = activeExchangeRates.Max(r => r.AffectedDate); ret = activeExchangeRates.FirstOrDefault(r => r.AffectedDate.Equals(latestDate)); return(ret); } catch (Exception) { throw; } }
public void SetSelectedCurrencyByKey(Guid currencyId) { NAS.DAL.Accounting.Currency.Currency currency = session.GetObjectByKey <NAS.DAL.Accounting.Currency.Currency>(currencyId); if (currency != null) { gridlookupCurrency.Text = currency.Code; } else { gridlookupCurrency.GridView.Selection.UnselectAll(); } }
public void ResetToDefault() { CurrencyBO currencyBO = new CurrencyBO(); NAS.DAL.Accounting.Currency.Currency currency = currencyBO.GetDefaultCurrency(session); if (currency != null) { gridlookupCurrency.Text = currency.Code; } else { gridlookupCurrency.GridView.Selection.UnselectAll(); } }
protected void cboBalanceInitCurrency_ItemRequestedByValue(object source, DevExpress.Web.ASPxEditors.ListEditItemRequestedByValueEventArgs e) { ASPxComboBox comboBox = (ASPxComboBox)source; try { NAS.DAL.Accounting.Currency.Currency obj = session.GetObjectByKey <NAS.DAL.Accounting.Currency.Currency>(Guid.Parse(e.Value.ToString())); if (obj != null) { comboBox.DataSource = new NAS.DAL.Accounting.Currency.Currency[] { obj }; comboBox.DataBindItems(); } } catch { } }