public static void CreateNewFeeItem(DateTime monthAhead, Guid managementId) { var dc = new ManagementContext(); var mana = dc.FeeManagement.Where(x => x.FeeManagementId == managementId).FirstOrDefault(); FeeItem fItem = new FeeItem(); fItem.CostOfFee = mana.FeeCostDefault; fItem.FeeManagedBy = mana; fItem.PayBy = monthAhead; fItem.Notified = false; fItem.DaysBeforeDeadlineToNotify = mana.DaysBeforeDeadlineToNotifyDefault; mana.Fees.Add(fItem); dc.SaveChanges(); }
/// <summary> /// creates a brand new dues object for a league. /// </summary> /// <param name="ownerId"></param> /// <param name="ownerType"></param> public static void CreateDuesObject(Guid ownerId, DuesOwnerEntityEnum ownerType) { try { var dc = new ManagementContext(); FeeManagement fee = new FeeManagement(); fee.DayOfMonthToCollectDefault = 15; fee.DaysBeforeDeadlineToNotifyDefault = 10; fee.FeeCostDefault = 45.00; fee.LeagueOwner = dc.Leagues.Where(x => x.LeagueId == ownerId).FirstOrDefault(); fee.EmailResponse = String.Empty; fee.AcceptPaymentsOnline = false; fee.WhoPaysProcessorFeesEnum = Convert.ToInt32(WhoPaysProcessorFeesEnum.Sender); fee.FeeTypeEnum = Convert.ToInt32(Enums.FeesTypeEnum.DuesType); FeeItem item = new FeeItem(); item.CostOfFee = 45.00; item.DaysBeforeDeadlineToNotify = 10; item.FeeManagedBy = fee; item.Notified = false; item.PayBy = DateTime.UtcNow.AddDays(15); fee.Fees.Add(item); dc.FeeManagement.Add(fee); dc.SaveChanges(); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } }
/// <summary> /// sets the notified flag to true that members were notified of collection. /// </summary> /// <param name="due"></param> public static void NotifiedMembersOfDuesItem(FeeItem due) { var dc = new ManagementContext(); var dueUpdate = dc.FeeItem.Where(x => x.FeeCollectionId == due.FeeCollectionId).FirstOrDefault(); dueUpdate.Notified = true; dc.SaveChanges(); }