Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 private void ReloadList()
 {
     DataAccess da = new DataAccess();
     this.DataContext = da.GetCurrency();
 }
 // CUSTOM FUNCTIONS
 private void LoadComboboxCurrencies()
 {
     DataAccess da = new DataAccess();
     List<currency> x = da.GetCurrency();
     edtCurrency.Items.Clear();
     foreach (currency c in x)
         edtCurrency.Items.Add(c.code);
     edtCurrency.SelectedItem = da.getBasicCurrencyCode();
 }
Esempio n. 5
0
 private void LoadCurrencies()
 {
     DataAccess da = new DataAccess();
     List<currency> lst = da.GetCurrency();
     edtCurrentCurrency.Items.Clear();
     foreach (currency i in lst)
     {
         edtCurrentCurrency.Items.Add(i.code);
         if (i.is_basic == 1)
             edtCurrentCurrency.SelectedValue = i.code;
     }
 }