コード例 #1
0
        // Add a new entry to the database and collections.
        public void AddEntry(ReceiptEntry newEntry)
        {
            // Add a new entry to the data context.
            receiptDatabase.entries.InsertOnSubmit(newEntry);

            // Save changes to the database.
            receiptDatabase.SubmitChanges();

            // Add a new entry to the "all" observable collection.
            AllReceiptEntries.Add(newEntry);

            if (newEntry.EntryDate.Month == DateTime.Today.Month)
            {
                ThisMonthEntries.Add(newEntry);
            }

            if (Helper.IsThisWeek(newEntry.EntryDate))
            {
                ThisWeekEntries.Add(newEntry);
            }

            if (DateTime.Compare(newEntry.EntryDate, DateTime.Today) == 0)
            {
                TodayEntries.Add(newEntry);
            }
        }
コード例 #2
0
 // Called during a remove operation
 private void detach_Entry(ReceiptEntry entry)
 {
     NotifyPropertyChanging("ReceiptEntry");
     entry.EntryCategory = null;
 }
コード例 #3
0
 // Called during an add operation
 private void attach_Entry(ReceiptEntry entry)
 {
     NotifyPropertyChanging("ReceiptEntry");
     entry.EntryCategory = this;
 }
コード例 #4
0
 // Called during an add operation
 private void attach_Entry(ReceiptEntry entry)
 {
     NotifyPropertyChanging("ReceiptEntry");
     entry.EntryCategory = this;
 }
コード例 #5
0
 // Called during a remove operation
 private void detach_Entry(ReceiptEntry entry)
 {
     NotifyPropertyChanging("ReceiptEntry");
     entry.EntryCategory = null;
 }
コード例 #6
0
        // Add a new entry to the database and collections.
        public void AddEntry(ReceiptEntry newEntry)
        {
            // Add a new entry to the data context.
            receiptDatabase.entries.InsertOnSubmit(newEntry);

            // Save changes to the database.
            receiptDatabase.SubmitChanges();

            // Add a new entry to the "all" observable collection.
            AllReceiptEntries.Add(newEntry);

            if (newEntry.EntryDate.Month == DateTime.Today.Month)
                ThisMonthEntries.Add(newEntry);

            if (Helper.IsThisWeek(newEntry.EntryDate))
                ThisWeekEntries.Add(newEntry);

            if (DateTime.Compare(newEntry.EntryDate, DateTime.Today) == 0)
                TodayEntries.Add(newEntry);
        }