示例#1
0
        public string GetOriginatorReceipt(Contract contract, LineItemGroup encumbrance)
        {
            string body            = "<p>You have submitted the following encumbrance request for Finance Review in the Encumbrance Processing System application.</p><br\\>";
            string contractInfo    = "";
            string encumbranceInfo = "";
            string linesInfo       = "";
            string url             = _serverpath + "/LineItemGroups/Manage/" + encumbrance.GroupID;

            if (this.IsShallowContract(contract))
            {
                contract = _context.GetDeepContract(contract.ContractID);
            }
            if (encumbrance == null)
            {
                return(null);
            }
            else
            {
                if (this.IsShallowEncumbrance(encumbrance))
                {
                    encumbrance = _context.GetDeepEncumbrance(encumbrance.GroupID);
                }
                decimal encumbranceTotal = GetEncumbranceTotal(encumbrance);
                encumbranceInfo = GetEncumbranceInfo(encumbrance, encumbranceTotal);
                if (contract == null)
                {
                    contract = _context.GetDeepContract(encumbrance.ContractID);
                }

                // if encumbrance is populated, start with a row for contract, one row for encumbrance and include all associated Line Items
                if (encumbrance.LineItemType.Equals(ConstantStrings.NewContract) ||
                    encumbrance.LineItemType.Equals(ConstantStrings.Advertisement) ||
                    encumbrance.LineItemType.Equals(ConstantStrings.Award))
                {
                    contractInfo = GetContractInfo(contract);
                }
                else
                {
                    contractInfo += "<strong>Contract: </strong>" + contract.ContractNumber + "<br/>";
                    contractInfo += "<strong>Contract Initial Amount:</strong> " + Utils.FormatCurrency(contract.ContractTotal) + "<br/>";
                    //TODO: What other contract information should be included in the email receipt?
                }
                List <LineItem> lineItems = _context.GetDeepLineItems(encumbrance.GroupID);
                if (lineItems == null || lineItems.Count == 0)
                {
                    linesInfo += "There are no line items associated with this encumbrance.";
                }
                else
                {
                    linesInfo += GetLineItemsInfo(lineItems);
                }
            }
            if (encumbrance.FileAttachments != null && encumbrance.FileAttachments.Count > 0)
            {
                body += "File Attachments:<br/><ul>";
                foreach (FileAttachment fileAtt in encumbrance.FileAttachments)
                {
                    var fileUrl = _serverpath + "\\" + FileAttachment.UserFilesPath + "\\" + fileAtt.FileName;
                    body += "<li><a href='" + fileUrl + "'>" + fileAtt.DisplayName + "</a></li>";
                }
                body += "</ul>";
            }
            body += contractInfo + "<br/>" + encumbranceInfo + "<br/>" + linesInfo + "<br/><br/>";
            body += "You can review your encumbrance request at <a href='" + url + "'> Encumbrance " + encumbrance.GroupID + "</a>";
            return(body);
        }