Пример #1
0
        public void createNew(int cardTypeID)
        {
            if (this.cardNumber == null)
            {
                throw new Exception("No Card Number Entered");
            }
            if (this.expiryDate == null)
            {
                throw new Exception("No Expiy Date Entered");
            }

            using (var ctx = new AccContexts())
                using (var ts = new TransactionScope())
                {
                    var newCard = new AccountingLib.Models.card()
                    {
                        cardTypeID = cardTypeID,
                        cardNumber = this.cardNumber,
                        expiryDate = this.expiryDate
                    };
                    ctx.card.AddObject(newCard);
                    ctx.SaveChanges();

                    /*Reload object Props*/
                    this.loadByCardID(newCard.ID);

                    ts.Complete();
                }
        }
Пример #2
0
        public void createNew(int cardTypeID)
        {
            if (this.cardNumber == null)
                throw new Exception("No Card Number Entered");
            if (this.expiryDate == null)
                throw new Exception("No Expiy Date Entered");

            using (var ctx = new AccContexts())
            using (var ts = new TransactionScope())
            {
                var newCard = new AccountingLib.Models.card()
                {
                    cardTypeID = cardTypeID,
                    cardNumber = this.cardNumber,
                    expiryDate = this.expiryDate
                };
                ctx.card.AddObject(newCard);
                ctx.SaveChanges();

                /*Reload object Props*/
                this.loadByCardID(newCard.ID);

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