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);
        }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the currency_rate EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocurrency_rate(currency_rate currency_rate)
 {
     base.AddObject("currency_rate", currency_rate);
 }
示例#4
0
 /// <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;
 }
示例#5
0
 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();
     }
 }
示例#6
0
 public void CurrencyRateCreate(currency_rate _obj)
 {
     objDataContext.AddTocurrency_rate(_obj);
     objDataContext.SaveChanges();
 }