Exemplo n.º 1
0
        // Remove a to-do task item from the database and collections.
        public void DeleteCondItem(CondItem CondForDelete)
        {
            // Remove the to-do item from the "all" observable collection.
            AllCondItems.Remove(CondForDelete);

            // Remove the to-do item from the data context.
            CondDB.Items.DeleteOnSubmit(CondForDelete);

            // Remove the to-do item from the appropriate category.
            switch (CondForDelete.Category.Name)
            {
                case "Infectious":
                    InfectiousCondItems.Remove(CondForDelete);
                    break;
                case "Cancer":
                    CancerCondItems.Remove(CondForDelete);
                    break;
                case "Seasonal":
                    SeasonalCondItems.Remove(CondForDelete);
                    break;
                default:
                    break;
            }

            // Save changes to the database.
            CondDB.SubmitChanges();
        }
Exemplo n.º 2
0
 // Called during a remove operation
 private void detach_Cond(CondItem Cond)
 {
     NotifyPropertyChanging("CondItem");
     Cond.Category = null;
 }
Exemplo n.º 3
0
        // Add a to-do item to the database and collections.
        public void AddCondItem(CondItem newCondItem)
        {
            // Add a to-do item to the data context.
            CondDB.Items.InsertOnSubmit(newCondItem);

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

            // Add a to-do item to the "all" observable collection.
            AllCondItems.Add(newCondItem);

            // Add a to-do item to the appropriate filtered collection.
            switch (newCondItem.Category.Name)
            {
                case "Infectious":
                    InfectiousCondItems.Add(newCondItem);
                    break;
                case "Cancer":
                    CancerCondItems.Add(newCondItem);
                    break;
                case "Seasonal":
                    SeasonalCondItems.Add(newCondItem);
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 4
0
 // Called during an add operation
 private void attach_Cond(CondItem Cond)
 {
     NotifyPropertyChanging("CondItem");
     Cond.Category = this;
 }