partial void DeleteCurrencyRate(CurrencyRate instance);
 partial void UpdateCurrencyRate(CurrencyRate instance);
 partial void InsertCurrencyRate(CurrencyRate instance);
		private void detach_CurrencyRates(CurrencyRate entity)
		{
			this.SendPropertyChanging();
			entity.Currency = null;
		}
		private void attach_CurrencyRates(CurrencyRate entity)
		{
			this.SendPropertyChanging();
			entity.Currency = this;
		}
        private static void CreateNewCurrencyRate(Budget2DataContext context, API.Interface.DataContracts.CurrencyRate currencyRate, Currency currency)
        {
            var newCurrRate = new CurrencyRate
                                           {
                                               CurrencyId = currency.Id,
                                               RateDate = currencyRate.RevaluationDate
                                           };

            newCurrRate.Rate = currencyRate.Measure == 0 ? (decimal)0 : currencyRate.Rate / currencyRate.Measure;
            newCurrRate.RevRate = newCurrRate.Rate == 0 ? 0 : 1/newCurrRate.Rate;
            
            context.CurrencyRates.InsertOnSubmit(newCurrRate);
        }