Exemplo n.º 1
0
        public void UpdateModel(Models.GrantAllocationAwardTravelLineItem grantAllocationAwardTravelLineItem)
        {
            grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemID = GrantAllocationAwardTravelLineItemID;
            grantAllocationAwardTravelLineItem.GrantAllocationAwardID = GrantAllocationAwardID;
            grantAllocationAwardTravelLineItem.PersonID = PersonID;
            grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemTarOrMonth = TarOrMonth;
            grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemDate       = Date;
            grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemTypeID     = TypeID;
            switch (TypeID)
            {
            case (int)GrantAllocationAwardTravelLineItemTypeEnum.Transportation:
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMiles       = Miles;
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMileageRate = MileageRate;
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemAmount      = null;
                break;

            case (int)GrantAllocationAwardTravelLineItemTypeEnum.Other:
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMiles       = null;
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMileageRate = null;
                grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemAmount      = Amount;
                break;

            default:
                throw new Exception($"Unhandled TypeID {TypeID} for GrantAllocationAwardTravelLineItemTypeEnum in EditGrantAllocationAwardTravelLineItemViewModel");
            }


            grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemNotes = Notes;
        }
Exemplo n.º 2
0
        public EditGrantAllocationAwardTravelLineItemViewModel(Models.GrantAllocationAwardTravelLineItem grantAllocationAwardTravelLineItem)
        {
            GrantAllocationAwardTravelLineItemID = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemID;
            GrantAllocationAwardID = grantAllocationAwardTravelLineItem.GrantAllocationAwardID;

            PersonID   = grantAllocationAwardTravelLineItem.PersonID;
            TarOrMonth = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemTarOrMonth;
            if (grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemDate == DateTime.MinValue)
            {
                Date = DateTime.Today;
            }
            else
            {
                Date = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemDate;
            }

            TypeID = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemTypeID;
            switch (TypeID)
            {
            case (int)GrantAllocationAwardTravelLineItemTypeEnum.Transportation:
                Miles       = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMiles ?? 0;
                MileageRate = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemMileageRate ?? 0m;
                Amount      = 0m;
                break;

            case (int)GrantAllocationAwardTravelLineItemTypeEnum.Other:
                Miles       = 0;
                MileageRate = 0m;
                Amount      = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemAmount ?? 0m;
                break;

            default:
                throw new Exception($"Unhandled TypeID {TypeID} for GrantAllocationAwardTravelLineItemTypeEnum in EditGrantAllocationAwardTravelLineItemViewModel");
            }

            Notes = grantAllocationAwardTravelLineItem.GrantAllocationAwardTravelLineItemNotes;
        }