Fire up your applications with Jetfire
processing
// Watch My Weight Workflow
//===================================================================================
// WatchMyWeight.txt
//===================================================================================
// Copyright (C) 2009 TrackerRealm Corporation
// This file is part of Jetfire.
// 
// Jetfire is open software: you can redistribute it and/or modify it under the terms
 of the GNU Affero General Public License (AGPL) as published by the Free Software Fo
undation, version 3 of the License.
// 
// Jetfire is distributed in the hope that it will be useful, but WITHOUT ANY WARRANT
Y; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR P
URPOSE.  See the GNU Affero General Public License (AGPL) for more details.
// 
// You should have received a copy of the GNU Affero General Public License (AGPL) al
ong with Jetfire.  If not, see http://www.gnu.org/licenses.
// REMOVAL OF THIS NOTICE IS VIOLATION OF THE COPYRIGHT.
//===================================================================================
namespace JetfireSports
{
   public workflow WatchMyWeight
   {
      // C O N S T R U C T O R - Instantiate the WatchMyWeight
      // Person: person using the program
      // Subject: Name of the person
      // Description: add a description 
      // Start Date of the program
      // End Date of the program
      // Starting Goal (Weight) of the program
      // Target Goal (Weight) of the program
      public WatchMyWeight()
      {
         this.Subject = "Watch My Weight: " + Date.Today.ToString();
      }
      // P R O P E R T I E S
      string person;
      // Track food eaten
      List healthyDays;
      // Track your weight
      List weighIns;
      List favoriteFoods;
      bool selectFromFavFoods = false;
      Date startDate;
      Date endDate;
      decimal startingWeight;
      decimal targetWeight; 
      
      public string Dieter
      {
         get { return person;      }
         set { person = value;      }
      }
      public List HealthyDays
      {
         get { return healthyDays;   }
      }
      public List WeighIns
      {
         get { return weighIns;      }
      }
      // List of my favorite Food Items
      public List FavoriteFoods
      {
         get { return favoriteFoods;   }
      }
      public bool SelectFromFavFoods
      {
         get { return selectFromFavFoods;   }
         set { selectFromFavFoods = value;   }
      }
      public Date StartDate
      {
         get { return startDate;      }
         set { startDate = value;   }
      }
      public Date EndDate
      {
         get { return endDate;      }
         set { endDate = value;      }
      }
      public decimal StartingWeight
      {
         get { return startingWeight;   }
         set { startingWeight = value;   }
      }
      public decimal TargetWeight
      {
         get { return targetWeight;   }
         set { targetWeight = value;   }
      }
      
      // C O M M A N D S
      public void AddHealthyDay()
      {
         HealthyDay item = new HealthyDay() at root;
         this.healthyDays.Add(item);
      }
      public void AddHealthyDay(HealthyDay item)
      {
         this.healthyDays.Add(item);
      }
      public void RemoveHealthyDay(HealthyDay item)
      {
         this.healthyDays.Remove(item);
      }
      public void AddWeighIn()
      {
         WeighIn wi = new WeighIn() at root;
         this.weighIns.Add(wi);
      }
      public void AddWeighIn(WeighIn wi)
      {
         this.weighIns.Add(wi);
      }
      public void RemoveWeighIn(WeighIn wi)
      {
         this.weighIns.Remove(wi);
      }
      public void AddFoodItem(FoodItem wi)
      {
         this.favoriteFoods.Add(wi);
      }
      public void RemoveFoodItem(FoodItem wi)
      {
         this.favoriteFoods.Remove(wi);
      }
   }
   public workflow WeighIn
   {
      public WeighIn()
      {
         this.Subject = "Weigh-in: " + Date.Today.ToString();
      }

      // Properties
      Date date = Date.Today;
      decimal weight = 0;

      public decimal Weight
      {
         get { return weight;      }
         set { weight = value;      }
      }
   }
   // HealthyDay is a day that the dieter eats healthy
   public workflow HealthyDay
   {
      public HealthyDay()
      {
         this.Date = Date.Today;
         StartPoints = 23;
         OutstandingPoints = 0;
         ActivityPointsEarned = 0;
         NumFruitsNVegetables = 0;
         NumMilk = 0;
         NumOil = 0;
         NumLiquids = 0;
         NumLeanProtein = 0;
         NumMultiVitamins = 0;
         WholeGrain = false;
         this.Subject = "Healthy Day: " + Date.Today.ToString();
      }
      
      // Properties
      List foodItems;
      
      public Date Date
      {
         get;
         set;
      }
      public List FoodItems
      {
         get;
         private set;
      }
      public int StartPoints
      {
         get;
         set;
      }
      public int OutstandingPoints
      {
         get;
         set;
      }
      public int ActivityPointsEarned
      {
         get;
         set;
      }
      public int NumFruitsNVegetables
      {
         get;
         set;
      }
      public int NumMilk
      {
         get;
         set;
      }
      public int NumOil
      {
         get;
         set;
      }
      public int NumLiquids
      {
         get;
         set;
      }
      public int NumLeanProtein
      {
         get;
         set;
      }
      public int NumMultiVitamins
      {
         get;
         set;
      }
      public bool WholeGrains
      {
         get;
         set;
      }
      
      // C O M M A N D S
      public void EatFood(FoodItem fi)
      {
         this.foodItems.Add(fi);
         if (outstandingPoints == 0)
            outstandingPoints = startPoints;
         outstandingPoints = outstandingPoints - fi.Points;
      }
   }
   // Subject = Name of the Food
   // Description = description for the food
   public workflow FoodItem
   {
      public FoodItem()
      {
         Points = 0;
         Setpoints = 0;
         IsFillingFood = false;
      }
      
      
      public int Points
      {
         get;
         set;
      }
      public int SetPoints
      {
         get;
         set;
      }
      public bool IsFillingFood
      {
         get;
         set;
      }
   }
}