Exemplo n.º 1
0
        public void create(string CurrencyName, int currencyTypeID)
        {
            using (var ctx = new AccContexts())
                {
                    var newCur = new AccountingLib.Models.currency
                    {
                        currencyTypeID = currencyTypeID,
                        name = CurrencyName
                    };
                    var result = ctx.currency.FirstOrDefault(x => x.name == CurrencyName && x.currencyType.ID == currencyTypeID);
                    if (result != null)
                        throw new Exception("Currency Duplicated");
                    else
                    {
                        ctx.currency.AddObject(newCur);
                        ctx.SaveChanges();

                        this.currencyID = newCur.ID;
                    }
                }
        }
Exemplo n.º 2
0
        public void create(string CurrencyName, int currencyTypeID)
        {
            using (var ctx = new AccContexts())
            {
                var newCur = new AccountingLib.Models.currency
                {
                    currencyTypeID = currencyTypeID,
                    name           = CurrencyName
                };
                var result = ctx.currency.FirstOrDefault(x => x.name == CurrencyName && x.currencyType.ID == currencyTypeID);
                if (result != null)
                {
                    throw new Exception("Currency Duplicated");
                }
                else
                {
                    ctx.currency.AddObject(newCur);
                    ctx.SaveChanges();

                    this.currencyID = newCur.ID;
                }
            }
        }
 /// <summary>
 /// Create a new currency object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static currency Createcurrency(global::System.Int32 id)
 {
     currency currency = new currency();
     currency.ID = id;
     return currency;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the currency EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocurrency(currency currency)
 {
     base.AddObject("currency", currency);
 }