Пример #1
0
        public static int AddTransaction(int item_id, int member_id, decimal amount)
        {
            // Get associated Item for item_id and Member for member_id
            IList<Item> itemList = null;
            IList<Member> memberList = null;
            using (GroupDataContext context = new GroupDataContext(ConnectionString))
            {
                IQueryable<Item> query1 = from c in context.Items where c.ID == item_id select c;
                itemList = query1.ToList();
                IQueryable<Member> query2 = from c in context.Members where c.ID == member_id select c;
                memberList = query2.ToList();

                Transaction transaction = new Transaction();
                transaction.Amount = amount;
                transaction.Member = memberList.FirstOrDefault();
                transaction.Item = itemList.FirstOrDefault();

                context.Transactions.InsertOnSubmit(transaction);
                context.SubmitChanges();

                return transaction.ID;
            }
        }
Пример #2
0
 private void OnTransactionRemoved(Transaction transaction)
 {
     transaction.Member = null;
 }
Пример #3
0
 private void OnTransactionRemoved(Transaction transaction)
 {
     transaction.Item = null;
 }
Пример #4
0
 private void OnTransactionAdded(Transaction transaction)
 {
     transaction.Member = this;
 }
Пример #5
0
 private void OnTransactionAdded(Transaction transaction)
 {
     transaction.Item = this;
 }