Beispiel #1
0
        public static Money GetTotalAwardAmount(this Grant grant)
        {
            Money total = 0;

            foreach (var grantMod in grant.GrantModifications)
            {
                total += grantMod.GrantModificationAmount;
            }

            return(total);
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public GrantNoteInternal(Grant grant, Person createdByPerson, DateTime createdDate) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.GrantNoteInternalID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.GrantID             = grant.GrantID;
     this.Grant = grant;
     grant.GrantNoteInternals.Add(this);
     this.CreatedByPersonID = createdByPerson.PersonID;
     this.CreatedByPerson   = createdByPerson;
     createdByPerson.GrantNoteInternalsWhereYouAreTheCreatedByPerson.Add(this);
     this.CreatedDate = createdDate;
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public GrantFileResource(Grant grant, FileResource fileResource, string displayName) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.GrantFileResourceID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.GrantID             = grant.GrantID;
     this.Grant = grant;
     grant.GrantFileResources.Add(this);
     this.FileResourceID = fileResource.FileResourceID;
     this.FileResource   = fileResource;
     fileResource.GrantFileResources.Add(this);
     this.DisplayName = displayName;
 }
Beispiel #4
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public GrantModification(string grantModificationName, Grant grant, DateTime grantModificationStartDate, DateTime grantModificationEndDate, GrantModificationStatus grantModificationStatus, decimal grantModificationAmount) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.GrantModificationID   = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.GrantModificationName = grantModificationName;
     this.GrantID = grant.GrantID;
     this.Grant   = grant;
     grant.GrantModifications.Add(this);
     this.GrantModificationStartDate = grantModificationStartDate;
     this.GrantModificationEndDate   = grantModificationEndDate;
     this.GrantModificationStatusID  = grantModificationStatus.GrantModificationStatusID;
     this.GrantModificationStatus    = grantModificationStatus;
     grantModificationStatus.GrantModifications.Add(this);
     this.GrantModificationAmount = grantModificationAmount;
 }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static GrantNoteInternal CreateNewBlank(Grant grant, Person createdByPerson)
 {
     return(new GrantNoteInternal(grant, createdByPerson, default(DateTime)));
 }
Beispiel #6
0
        public static Money GetCurrentBalanceOfGrantBasedOnAllGrantAllocationExpenditures(this Grant grant)
        {
            var   grantAllocations = grant.GrantModifications.SelectMany(x => x.GrantAllocations).ToList();
            var   allBudgetLineItemVsActualItems      = grantAllocations.Select(ga => ga.GetTotalBudgetVsActualLineItem());
            var   currentBalanceOfAllGrantAllocations = allBudgetLineItemVsActualItems.Select(blai => blai.BudgetMinusExpendituresFromDatamart).ToList();
            Money total = 0;

            foreach (var grantAllocationTotal in currentBalanceOfAllGrantAllocations)
            {
                total += grantAllocationTotal;
            }

            return(total);
        }
Beispiel #7
0
 public static HtmlString GetGrantNumberAsUrl(this Grant grant)
 {
     return(grant != null?UrlTemplate.MakeHrefString(grant.GetDetailUrl(), grant.GrantNumber) : new HtmlString(null));
 }
Beispiel #8
0
 public static string GetNewNoteUrl(this Grant grant)
 {
     return(NewNoteUrlTemplate.ParameterReplace(grant.GrantID));
 }
Beispiel #9
0
 public static string GetDetailUrl(this Grant grant)
 {
     return(DetailUrlTemplate.ParameterReplace(grant.GrantID));
 }
Beispiel #10
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static GrantModification CreateNewBlank(Grant grant, GrantModificationStatus grantModificationStatus)
 {
     return(new GrantModification(default(string), grant, default(DateTime), default(DateTime), grantModificationStatus, default(decimal)));
 }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static GrantFileResource CreateNewBlank(Grant grant, FileResource fileResource)
 {
     return(new GrantFileResource(grant, fileResource, default(string)));
 }
 public static void DeleteGrant(this IQueryable <Grant> grants, Grant grantToDelete)
 {
     DeleteGrant(grants, new List <Grant> {
         grantToDelete
     });
 }