private void EditRates() { DataAccess da = new DataAccess(); List<currency_rate> rates = new List<currency_rate>(); // USD currency c1 = da.GetCurrency("USD"); currency_rate r1 = new currency_rate(); r1.currency = c1; r1.rate = decimal.Parse(edtUSD.Text); r1.rate_date = edtDate.SelectedDate.Value; // EURO currency c2 = da.GetCurrency("EUR"); currency_rate r2 = new currency_rate(); r2.currency = c2; r2.rate = decimal.Parse(edtEURO.Text); r2.rate_date = edtDate.SelectedDate.Value; // RUR currency c3 = da.GetCurrency("RUR"); currency_rate r3 = new currency_rate(); r3.currency = c3; r3.rate = decimal.Parse(edtRUR.Text)/100; r3.rate_date = edtDate.SelectedDate.Value; rates.Add(r1); rates.Add(r2); rates.Add(r3); da.CurrencyRatesEdit(rates); }
private void AddRates() { DataAccess da = new DataAccess(); List<currency_rate> rates = new List<currency_rate>(); // USD currency c1 = da.GetCurrency("USD"); currency_rate r1 = new currency_rate(); r1.currency = c1; r1.rate = decimal.Parse(edtUSD.Text); r1.rate_date = DateTime.Now; // EURO currency c2 = da.GetCurrency("EUR"); currency_rate r2 = new currency_rate(); r2.currency = c2; r2.rate = decimal.Parse(edtEURO.Text); r2.rate_date = DateTime.Now; // RUR currency c3 = da.GetCurrency("RUR"); currency_rate r3 = new currency_rate(); r3.currency = c3; r3.rate = decimal.Parse(edtRUR.Text)/100; r3.rate_date = DateTime.Now; rates.Add(r1); rates.Add(r2); rates.Add(r3); da.CurrencyRatesCreate(rates); }
/// <summary> /// Deprecated Method for adding a new object to the currency_rate EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocurrency_rate(currency_rate currency_rate) { base.AddObject("currency_rate", currency_rate); }
/// <summary> /// Create a new currency_rate object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="rate_date">Initial value of the rate_date property.</param> /// <param name="rate">Initial value of the rate property.</param> public static currency_rate Createcurrency_rate(global::System.Int32 id, global::System.DateTime rate_date, global::System.Decimal rate) { currency_rate currency_rate = new currency_rate(); currency_rate.id = id; currency_rate.rate_date = rate_date; currency_rate.rate = rate; return currency_rate; }
public void CurrencyRateEdit(currency_rate item) { currency_rate original = objDataContext.currency_rate.FirstOrDefault(b => b.id == item.id); if (original != null) { original.rate_date = item.rate_date; original.rate = item.rate; objDataContext.SaveChanges(); } }
public void CurrencyRateCreate(currency_rate _obj) { objDataContext.AddTocurrency_rate(_obj); objDataContext.SaveChanges(); }