private static Row AddCostTableRow( ref Table costTable, DocumentInfo documentInfo, RegionInfo regionInfo, CostEstimationDetail costEstimationDetail) { // TODO: extract to extension method // TODO: refine cost table columns var allupTableCostItem = costTable.AddRow(); documentInfo.AddParagraphWordWrap(allupTableCostItem.Cells[0], costEstimationDetail.ResourceName); var catergoryName = costEstimationDetail.MeterCategory; if (!string.IsNullOrEmpty(costEstimationDetail.MeterSubCategory)) { catergoryName += " - " + costEstimationDetail.MeterSubCategory; } allupTableCostItem.Cells[1].AddParagraph(catergoryName ?? "N/A"); allupTableCostItem.Cells[2].AddParagraph(costEstimationDetail?.MeterName ?? "N/A"); var quantity = costEstimationDetail.UsagesQuantity?.ToString("0.####", CultureInfo.InvariantCulture); allupTableCostItem.Cells[3].AddParagraph(quantity ?? "N/A"); allupTableCostItem.Cells[4].AddParagraph( ToCurrencyString(costEstimationDetail.EstimatedCost, regionInfo.CurrencySymbol)); return(allupTableCostItem); }
private static void MakeCostEstimationResouceGroupTableRow(HtmlTextWriter w, CostEstimationDetail detail, RegionInfo regionInfo, bool isError = false) { #region ResourceName if (isError) { w.AddStyleAttribute("color", "#C2403D"); } w.RenderBeginTag(HtmlTextWriterTag.Td); w.Write(detail.ResourceName); w.RenderEndTag(); #endregion ResourceName #region CategoryName var categoryName = detail.MeterCategory; if (!string.IsNullOrEmpty(detail.MeterSubCategory)) { categoryName += " - " + detail.MeterSubCategory; } w.RenderBeginTag(HtmlTextWriterTag.Td); w.Write(categoryName ?? "N/A"); w.RenderEndTag(); #endregion CategoryName #region MeterName w.RenderBeginTag(HtmlTextWriterTag.Td); w.Write(detail?.MeterName ?? "N/A"); w.RenderEndTag(); #endregion MeterName #region Quantity var quantity = detail.UsagesQuantity?.ToString("0.####", CultureInfo.InvariantCulture); w.RenderBeginTag(HtmlTextWriterTag.Td); w.Write(quantity ?? "N/A"); w.RenderEndTag(); #endregion Quantity #region EstimatedCost w.RenderBeginTag(HtmlTextWriterTag.Td); var c = ToCurrencyString(detail.EstimatedCost, regionInfo.CurrencySymbol); w.Write(ToCurrencyString(detail.EstimatedCost, regionInfo.CurrencySymbol)); w.RenderEndTag(); #endregion EstimatedCost }