/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public GrantAllocationAwardTravelLineItem(GrantAllocationAward grantAllocationAward, string grantAllocationAwardTravelLineItemTarOrMonth, DateTime grantAllocationAwardTravelLineItemDate, GrantAllocationAwardTravelLineItemType grantAllocationAwardTravelLineItemType) : this() { // Mark this as a new object by setting primary key with special value this.GrantAllocationAwardTravelLineItemID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID; this.GrantAllocationAward = grantAllocationAward; grantAllocationAward.GrantAllocationAwardTravelLineItems.Add(this); this.GrantAllocationAwardTravelLineItemTarOrMonth = grantAllocationAwardTravelLineItemTarOrMonth; this.GrantAllocationAwardTravelLineItemDate = grantAllocationAwardTravelLineItemDate; this.GrantAllocationAwardTravelLineItemTypeID = grantAllocationAwardTravelLineItemType.GrantAllocationAwardTravelLineItemTypeID; }
public static decimal GetTotalInvoicedToDate(this GrantAllocationAward grantAllocationAward) { decimal totalInvoicedToDate = 0; foreach (var costType in CostType.GetLineItemCostTypes()) { totalInvoicedToDate += grantAllocationAward.GetInvoicedToDateByCostType(costType); } return(totalInvoicedToDate); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public GrantAllocationAwardContractorInvoice(GrantAllocationAward grantAllocationAward, string grantAllocationAwardContractorInvoiceDescription, string grantAllocationAwardContractorInvoiceNumber, DateTime grantAllocationAwardContractorInvoiceDate, GrantAllocationAwardContractorInvoiceType grantAllocationAwardContractorInvoiceType) : this() { // Mark this as a new object by setting primary key with special value this.GrantAllocationAwardContractorInvoiceID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID; this.GrantAllocationAward = grantAllocationAward; grantAllocationAward.GrantAllocationAwardContractorInvoices.Add(this); this.GrantAllocationAwardContractorInvoiceDescription = grantAllocationAwardContractorInvoiceDescription; this.GrantAllocationAwardContractorInvoiceNumber = grantAllocationAwardContractorInvoiceNumber; this.GrantAllocationAwardContractorInvoiceDate = grantAllocationAwardContractorInvoiceDate; this.GrantAllocationAwardContractorInvoiceTypeID = grantAllocationAwardContractorInvoiceType.GrantAllocationAwardContractorInvoiceTypeID; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public GrantAllocationAwardSuppliesLineItem(GrantAllocationAward grantAllocationAward, string grantAllocationAwardSuppliesLineItemDescription, string grantAllocationAwardSuppliesLineItemTarOrMonth, DateTime grantAllocationAwardSuppliesLineItemDate, decimal grantAllocationAwardSuppliesLineItemAmount) : this() { // Mark this as a new object by setting primary key with special value this.GrantAllocationAwardSuppliesLineItemID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID; this.GrantAllocationAward = grantAllocationAward; grantAllocationAward.GrantAllocationAwardSuppliesLineItems.Add(this); this.GrantAllocationAwardSuppliesLineItemDescription = grantAllocationAwardSuppliesLineItemDescription; this.GrantAllocationAwardSuppliesLineItemTarOrMonth = grantAllocationAwardSuppliesLineItemTarOrMonth; this.GrantAllocationAwardSuppliesLineItemDate = grantAllocationAwardSuppliesLineItemDate; this.GrantAllocationAwardSuppliesLineItemAmount = grantAllocationAwardSuppliesLineItemAmount; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public GrantAllocationAwardPersonnelAndBenefitsLineItem(GrantAllocationAward grantAllocationAward, string grantAllocationAwardPersonnelAndBenefitsLineItemTarOrMonth, DateTime grantAllocationAwardPersonnelAndBenefitsLineItemDate, int grantAllocationAwardPersonnelAndBenefitsLineItemTarHours, decimal grantAllocationAwardPersonnelAndBenefitsLineItemHourlyRate, decimal grantAllocationAwardPersonnelAndBenefitsLineItemFringeRate) : this() { // Mark this as a new object by setting primary key with special value this.GrantAllocationAwardPersonnelAndBenefitsLineItemID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID; this.GrantAllocationAward = grantAllocationAward; grantAllocationAward.GrantAllocationAwardPersonnelAndBenefitsLineItems.Add(this); this.GrantAllocationAwardPersonnelAndBenefitsLineItemTarOrMonth = grantAllocationAwardPersonnelAndBenefitsLineItemTarOrMonth; this.GrantAllocationAwardPersonnelAndBenefitsLineItemDate = grantAllocationAwardPersonnelAndBenefitsLineItemDate; this.GrantAllocationAwardPersonnelAndBenefitsLineItemTarHours = grantAllocationAwardPersonnelAndBenefitsLineItemTarHours; this.GrantAllocationAwardPersonnelAndBenefitsLineItemHourlyRate = grantAllocationAwardPersonnelAndBenefitsLineItemHourlyRate; this.GrantAllocationAwardPersonnelAndBenefitsLineItemFringeRate = grantAllocationAwardPersonnelAndBenefitsLineItemFringeRate; }
public static decimal GetInvoicedToDateByCostType(this GrantAllocationAward grantAllocationAward, CostType costType) { decimal invoicedToDate = 0; switch (costType.CostTypeID) { case (int)CostTypeEnum.Contractual: invoicedToDate = grantAllocationAward.ContractualLineItemSum; break; case (int)CostTypeEnum.IndirectCosts: invoicedToDate = grantAllocationAward.IndirectCostTotal; break; case (int)CostTypeEnum.Supplies: invoicedToDate = grantAllocationAward.SuppliesLineItemAmountSum; break; case (int)CostTypeEnum.Travel: invoicedToDate = grantAllocationAward.TravelLineItemSum; break; case (int)CostTypeEnum.Personnel: invoicedToDate = grantAllocationAward.GrantAllocationAwardPersonnelAndBenefitsLineItems.Sum(pb => pb.GrantAllocationAwardPersonnelAndBenefitsLineItemHourlyTotal); break; case (int)CostTypeEnum.Benefits: invoicedToDate = grantAllocationAward.GrantAllocationAwardPersonnelAndBenefitsLineItems.Sum(pb => pb.GrantAllocationAwardPersonnelAndBenefitsLineItemFringeTotal); break; case (int)CostTypeEnum.Equipment: case (int)CostTypeEnum.Other: break; default: throw new Exception($"Unhandled CostTypeID {costType.CostTypeID} when trying to get the invoiced to date dollar amount for said cost type."); } return(invoicedToDate); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static GrantAllocationAwardTravelLineItem CreateNewBlank(GrantAllocationAward grantAllocationAward, GrantAllocationAwardTravelLineItemType grantAllocationAwardTravelLineItemType) { return(new GrantAllocationAwardTravelLineItem(grantAllocationAward, default(string), default(DateTime), grantAllocationAwardTravelLineItemType)); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static GrantAllocationAwardPersonnelAndBenefitsLineItem CreateNewBlank(GrantAllocationAward grantAllocationAward) { return(new GrantAllocationAwardPersonnelAndBenefitsLineItem(grantAllocationAward, default(string), default(DateTime), default(int), default(decimal), default(decimal))); }
public static void DeleteGrantAllocationAward(this IQueryable <GrantAllocationAward> grantAllocationAwards, GrantAllocationAward grantAllocationAwardToDelete) { DeleteGrantAllocationAward(grantAllocationAwards, new List <GrantAllocationAward> { grantAllocationAwardToDelete }); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static GrantAllocationAwardContractorInvoice CreateNewBlank(GrantAllocationAward grantAllocationAward, GrantAllocationAwardContractorInvoiceType grantAllocationAwardContractorInvoiceType) { return(new GrantAllocationAwardContractorInvoice(grantAllocationAward, default(string), default(string), default(DateTime), grantAllocationAwardContractorInvoiceType)); }
public static bool CanGrantAllocationAwardBeDeleted(this GrantAllocationAward grantAllocationAward) { return(!grantAllocationAward.HasDependentObjects()); }
public static string GetDeleteUrl(this GrantAllocationAward grantAllocationAward) { return(DeleteUrlTemplate.ParameterReplace(grantAllocationAward.GrantAllocationAwardID)); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static GrantAllocationAwardSuppliesLineItem CreateNewBlank(GrantAllocationAward grantAllocationAward) { return(new GrantAllocationAwardSuppliesLineItem(grantAllocationAward, default(string), default(string), default(DateTime), default(decimal))); }