public void UpdateApproved(Expense expense)
        {
            var context = new ExpenseDataContext(this.account);

            IExpenseEntity expenseRow = GetExpenseRowById(context, expense.UserName, expense.Id);

            expenseRow.Approved = expense.Approved;

            var queue = new AzureQueue <ApprovedExpenseMessage>(this.account, AzureStorageNames.ApprovedExpenseMessage);

            queue.AddMessage(new ApprovedExpenseMessage {
                ExpenseId = expense.Id, ApproveDate = DateTime.UtcNow, Username = expense.UserName
            });

            context.UpdateObject(expenseRow);
            context.SaveChanges();
        }
        public void UpdateExpenseItemImages(string username, string expenseId, string expenseItemId, string imageUri, string thumbnailUri)
        {
            var context = new ExpenseDataContext(this.account);

            // this query would work faster if we specify PartitionKey and RowKey
            // For simplicity we'll just do a table scan by expense item id
            var query = (from expenseItemRow in context.ExpenseExpenseItem
                         where expenseItemRow.PartitionKey == username.EncodePartitionAndRowKey() &&
                         expenseItemRow.RowKey == KeyGenerator.ExpenseItemEntityRowKey(expenseId, expenseItemId)
                         select expenseItemRow).AsTableServiceQuery();

            var item = query.Execute().SingleOrDefault();

            item.ReceiptUrl          = imageUri;
            item.ReceiptThumbnailUrl = thumbnailUri;

            context.UpdateObject(item);
            context.SaveChanges();
        }
        public void UpdateExpenseItemImages(string username, string expenseId, string expenseItemId, string imageUri, string thumbnailUri)
        {
            var context = new ExpenseDataContext(this.account);

            // this query would work faster if we specify PartitionKey and RowKey
            // For simplicity we'll just do a table scan by expense item id
            var query = (from expenseItemRow in context.ExpenseExpenseItem
                         where expenseItemRow.PartitionKey == username.EncodePartitionAndRowKey()
                               && expenseItemRow.RowKey == KeyGenerator.ExpenseItemEntityRowKey(expenseId, expenseItemId)
                         select expenseItemRow).AsTableServiceQuery();

            var item = query.Execute().SingleOrDefault();

            item.ReceiptUrl = imageUri;
            item.ReceiptThumbnailUrl = thumbnailUri;

            context.UpdateObject(item);
            context.SaveChanges();
        }
        public void UpdateApproved(Expense expense)
        {
            var context = new ExpenseDataContext(this.account);

            IExpenseEntity expenseRow = GetExpenseRowById(context, expense.UserName, expense.Id);
            expenseRow.Approved = expense.Approved;

            var queue = new AzureQueue<ApprovedExpenseMessage>(this.account, AzureStorageNames.ApprovedExpenseMessage);
            queue.AddMessage(new ApprovedExpenseMessage { ExpenseId = expense.Id, ApproveDate = DateTime.UtcNow, Username = expense.UserName });

            context.UpdateObject(expenseRow);
            context.SaveChanges();
        }