예제 #1
0
        public BudgetItem(int id, Budget b, Tag t, string name, double amount, TimePeriod p, 
						  int timePeriodCount, DateTime scheduledDate, bool recur, int dayCount)
        {
            ID = id;
            Budget = b;
            Tag = t;
            Name = name;
            Amount = amount;
            TimePeriod = p;
            TimePeriodCount = timePeriodCount;
            ScheduledDate = scheduledDate;
            Recur = recur;
            DayCount = dayCount;
        }
예제 #2
0
파일: Budget.cs 프로젝트: medleykupps/Code
        public static bool Delete(Budget b)
        {
            if (b.ID < 0)
                return false;

            return SiteProvider.Accounts.DeleteBudget(b.ID);
        }
예제 #3
0
파일: Budget.cs 프로젝트: medleykupps/Code
        public Budget Copy()
        {
            Budget b = new Budget();
            b.ID = ID;
            b.Name = Name;
            b.StartDate = StartDate;
            b.StartAmount = StartAmount;

            if (BudgetItems != null)
            {
                b.BudgetItems = BudgetItems.Copy();
            }

            return b;
        }
예제 #4
0
파일: Budget.cs 프로젝트: medleykupps/Code
 public static bool Update(Budget b)
 {
     BudgetDetails bd = new BudgetDetails(b);
     return SiteProvider.Accounts.UpdateBudget(bd);
 }
예제 #5
0
파일: Budget.cs 프로젝트: medleykupps/Code
 public static bool Insert(Budget b)
 {
     BudgetDetails bd = new BudgetDetails(b);
     int id = SiteProvider.Accounts.InsertBudget(bd);
     if (id < 0)
         return false;
     b.ID = id;
     return true;
 }
예제 #6
0
파일: Budget.cs 프로젝트: medleykupps/Code
        public static BudgetList GetBudgets()
        {
            // Retrieve the Budget records from the data store
            List<BudgetDetails> details = SiteProvider.Accounts.GetBudgets();
            BudgetList list = new BudgetList();

            // Copy from the Budget records to the Budget objects
            foreach (BudgetDetails bd in details)
            {
                if (bd != null)
                {
                    // Create the new Budget object from the Budget Details retrieved
                    // from the database.
                    Budget b = new Budget(bd);

                    // Retrieve the list of Budget Items for the specified Budget.
                    List<BudgetItemDetails> itemDetails = SiteProvider.Accounts.GetBudgetItems(bd.ID);
                    BudgetItemList items = new BudgetItemList();
                    foreach (BudgetItemDetails bid in itemDetails)
                    {
                        if (bid != null)
                        {
                            BudgetItem bi = new BudgetItem(bid);
                            bi.Budget = b;
                            if (bid.TagID != -1)
                                bi.Tag = KapitalManager.Instance.Tags.FindByID(bid.TagID);

                            // Add the Budget Item to the list of BudgetItems.
                            items.Add(bi);
                        }
                    }

                    // Attach the list of items to the current Budget
                    b.BudgetItems = items;
                    list.Add(b);
                }
            }

            return list;
        }
예제 #7
0
파일: Budget.cs 프로젝트: medleykupps/Code
        public static Budget GetBudgetByID(int id)
        {
            BudgetDetails bd = SiteProvider.Accounts.GetBudgetByID(id);
            if (bd == null)
                return null;

            Budget b = new Budget(bd);

            // Retrieve each Budget Item for this Budget
            List<BudgetItemDetails> details = SiteProvider.Accounts.GetBudgetItems(b.ID);
            b.BudgetItems = new BudgetItemList();
            foreach (BudgetItemDetails bid in details)
            {
                BudgetItem bi = new BudgetItem(bid);
                bi.Budget = b;
                if (bid.TagID > 0)
                    bi.Tag = KapitalManager.Instance.Tags.FindByID(bid.TagID);
                b.BudgetItems.Add(bi);
            }

            return b;
        }
예제 #8
0
        public BudgetItem(Budget b, Tag t, string name, double amount, TimePeriod p, int timePeriodCount,
						  DateTime scheduledDate, bool recur, int dayCount)
            : this(-1, b, t, name, amount, p, timePeriodCount, scheduledDate, recur, dayCount)
        {
        }
예제 #9
0
 /// <summary>
 /// Constructor specifing a sceduled date and a recurring period from that date.
 /// </summary>
 /// <param name="b"></param>
 /// <param name="t"></param>
 /// <param name="name"></param>
 /// <param name="amount"></param>
 /// <param name="scheduledDate"></param>
 /// <param name="p"></param>
 /// <param name="timePeriodCount"></param>
 public BudgetItem(Budget b, Tag t, string name, double amount, DateTime scheduledDate, TimePeriod p, int timePeriodCount)
     : this(-1, b, t, name, amount, p, timePeriodCount, scheduledDate, true, 0)
 {
 }
예제 #10
0
 /// <summary>
 /// Constructor specifing a non-recurring scheduled date.
 /// </summary>
 /// <param name="b"></param>
 /// <param name="t"></param>
 /// <param name="name"></param>
 /// <param name="amount"></param>
 /// <param name="scheduledDate"></param>
 public BudgetItem(Budget b, Tag t, string name, double amount, DateTime scheduledDate)
     : this(-1, b, t, name, amount, TimePeriod.Day, 0, scheduledDate, false, 0)
 {
 }
예제 #11
0
 public static BudgetItemList GetBudgetItems(Budget b)
 {
     Trace.Assert(b != null);
     BudgetItemList biList = GetBudgetItems(b.ID);
     foreach (BudgetItem bi in biList)
     {
         if (bi.Budget == null)
             bi.Budget = b;
     }
     return biList;
 }
예제 #12
0
 public BudgetItem(Budget b, Tag t, string name, double amount, TimePeriod p, int timePeriodCount)
     : this(-1, b, t, name, amount, p, timePeriodCount, new DateTime(0), true, 0)
 {
 }