public bool AllowAutoDescription(whitmanenterprisedealershipinventory inventory, int dealerId) { using (var context = new whitmanenterprisewarehouseEntities()) { var setting = context.whitmanenterprisesettings.FirstOrDefault(i => i.DealershipId == dealerId); return(inventory != null && (inventory.EnableAutoDescription.GetValueOrDefault() || inventory.EnableAutoDescription == null) && setting != null && (setting.AutoDescription.GetValueOrDefault()) ? true : false); } }
public static int GetHealthLevel(whitmanenterprisedealershipinventory tmp) { int hasImage = String.IsNullOrEmpty(tmp.ThumbnailImageURL) ? 1 : 0; int hasDescription = String.IsNullOrEmpty(tmp.Descriptions) ? 1 : 0; int hasPrice = String.IsNullOrEmpty(tmp.SalePrice) ? 1 : 0; if (!String.IsNullOrEmpty(tmp.ThumbnailImageURL) && !String.IsNullOrEmpty(tmp.DefaultImageUrl)) { hasImage = tmp.ThumbnailImageURL.Equals(tmp.DefaultImageUrl) ? 1 : 0; } int valueReturn = hasImage + hasDescription + hasPrice; return(valueReturn); }
public CarInfoFormViewModel(whitmanenterprisedealershipinventory row, int dealershipId) { ListingId = row.ListingID; Vin = row.VINNumber ?? string.Empty; Make = row.Make ?? string.Empty; ModelYear = row.ModelYear.GetValueOrDefault(); Model = row.Model ?? string.Empty; Litters = row.Liters ?? string.Empty; MSRP = row.MSRP ?? string.Empty; Fuel = row.FuelType ?? string.Empty; WheelDrive = row.DriveTrain ?? string.Empty; Engine = row.EngineType ?? string.Empty; StockNumber = row.StockNumber ?? string.Empty; Trim = row.Trim ?? string.Empty; ChromeStyleId = row.ChromeStyleId; ChromeModelId = row.ChromeModelId; ExteriorColor = row.ExteriorColor ?? string.Empty; InteriorColor = row.InteriorColor ?? string.Empty; Cylinder = row.Cylinders ?? string.Empty; Mileage = row.Mileage ?? string.Empty; BodyType = row.BodyType ?? string.Empty; Tranmission = row.Tranmission ?? string.Empty; DealershipId = dealershipId; ExistPackages = new List <string>(); ExistOptions = new List <string>(); StandardPackages = new List <string>(); StandardOptions = new List <string>(); DefaultImageUrl = row.DefaultImageUrl; Description = row.Descriptions ?? string.Empty; BrandedTitle = row.BrandedTitle.GetValueOrDefault(); ACar = row.ACar.GetValueOrDefault(); if (String.IsNullOrEmpty(row.SalePrice)) { SalePrice = "NA"; } else { double priceFormat; bool flag = Double.TryParse(row.SalePrice, out priceFormat); if (flag) { SalePrice = priceFormat.ToString("#,##0"); } } if (String.IsNullOrEmpty(row.DealerCost)) { DealerCost = "NA"; } else { double priceFormat; bool flag = Double.TryParse(row.DealerCost, out priceFormat); if (flag) { DealerCost = priceFormat.ToString("#,##0"); } } if (String.IsNullOrEmpty(row.ACV)) { ACV = "NA"; } else { double priceFormat; bool flag = Double.TryParse(row.ACV, out priceFormat); if (flag) { ACV = priceFormat.ToString("#,##0"); } } if (String.IsNullOrEmpty(row.CarImageUrl)) { SinglePhoto = row.DefaultImageUrl; } else { string[] totalImages = CommonHelper.GetArrayFromString(row.CarImageUrl); SinglePhoto = totalImages[0]; } OrginalName = ModelYear + " " + Make + " " + Model; if (!String.IsNullOrEmpty(Trim) && !Trim.Equals("NA")) { OrginalName += " " + Trim; } if (String.IsNullOrEmpty(row.NewUsed)) { Condition = "Used"; } else { Condition = row.NewUsed.Trim().ToUpperInvariant().Equals("USED") ? "Used" : "New"; } ExistOptions = String.IsNullOrEmpty(row.CarsOptions) ? new List <string>() : (from data in CommonHelper.GetArrayFromString(row.CarsOptions) select data).ToList(); ExistPackages = String.IsNullOrEmpty(row.CarsPackages) ? new List <string>() : (from data in CommonHelper.GetArrayFromString(row.CarsPackages) select data).ToList(); UploadPhotosURL = String.IsNullOrEmpty(row.CarImageUrl) ? new List <string>() : (from data in CommonHelper.GetArrayFromString(row.CarImageUrl) select data).ToList(); CarImageUrl = row.CarImageUrl ?? string.Empty; if (!String.IsNullOrEmpty(row.StandardOptions)) { StandardOptions = CommonHelper.GetArrayFromString(row.StandardOptions).ToList(); } }
public string GenerateAutoDescription(whitmanenterprisedealershipinventory newInventory) { using (var context = new whitmanenterprisewarehouseEntities()) { if (newInventory != null) { var inventoryStatus = InventoryStatus.Used; Enum.TryParse(newInventory.NewUsed, out inventoryStatus); var randomizedTemplate = GetRandomizedTemplate(inventoryStatus); var dealerInfo = _context.whitmanenterprisedealerships.FirstOrDefault(i => i.idWhitmanenterpriseDealership == newInventory.DealershipId); var setting = context.whitmanenterprisesettings.FirstOrDefault(i => i.DealershipId == newInventory.DealershipId); var disclaimer = context.vincontrolrebates.Where( i => (i.DealerId == dealerInfo.idWhitmanenterpriseDealership) && (i.Year == newInventory.ModelYear) && (i.Make == newInventory.Make) && (i.Model == newInventory.Model) && (i.Trim == newInventory.Trim)).Select(j => j.Disclaimer).FirstOrDefault(); var autoDescriptionViewModel = new AutoDescriptionViewModel() { DealershipName = dealerInfo.DealershipName, Year = newInventory.ModelYear.GetValueOrDefault(), Make = newInventory.Make, Model = newInventory.Model, Trim = newInventory.Trim, CarfaxOwner = newInventory.CarFaxOwner.GetValueOrDefault(), Mileage = String.IsNullOrEmpty(newInventory.Mileage) ? 0 : Convert.ToInt32(CommonHelper.RemoveSpecialCharactersForPurePrice(newInventory.Mileage)), Color = String.IsNullOrEmpty(newInventory.ExteriorColor) ? string.Empty : newInventory.ExteriorColor, Packages = String.IsNullOrEmpty(newInventory.CarsPackages) ? string.Empty : newInventory.CarsPackages, PackagesList = String.IsNullOrEmpty(newInventory.CarsPackages) ? new string[] { } : newInventory.CarsPackages.Split(',').ToArray(), AdditionalOptions = String.IsNullOrEmpty(newInventory.CarsOptions) ? string.Empty : newInventory.CarsOptions, MarketRange = newInventory.MarketRange.GetValueOrDefault(), CarsOnMarket = newInventory.NumberOfCar.GetValueOrDefault(), FuelHighway = String.IsNullOrEmpty(newInventory.FuelEconomyHighWay) ? 0 : Convert.ToInt32(newInventory.FuelEconomyHighWay), EndingSentences = setting != null ? setting.EndDescriptionSentence : string.Empty, Address = dealerInfo.DealershipAddress, Phone = dealerInfo.Phone, Transmission = newInventory.Tranmission, DaysInInventory = DateTime.Now.Subtract(newInventory.DateInStock.GetValueOrDefault()).Days, Warranty = newInventory.WarrantyInfo.GetValueOrDefault(), Certified = newInventory.Certified.GetValueOrDefault(), PriorRental = newInventory.PriorRental.GetValueOrDefault(), Unwind = newInventory.Unwind.GetValueOrDefault(), DealerDemo = newInventory.DealerDemo.GetValueOrDefault(), BrandedTitle = newInventory.BrandedTitle.GetValueOrDefault(), BodyType = String.IsNullOrEmpty(newInventory.BodyType) ? "" : newInventory.BodyType, Disclaimer = disclaimer, MSRP = newInventory.MSRP, DealerId = dealerInfo.idWhitmanenterpriseDealership }; var serializer = new JavaScriptSerializer(); autoDescriptionViewModel.PackageOptionsList = !String.IsNullOrEmpty(newInventory.PackageDescriptions) ? serializer.Deserialize <string[]>(newInventory.PackageDescriptions) : null; newInventory.Template = randomizedTemplate.Id; if (inventoryStatus.Equals(InventoryStatus.New) && String.IsNullOrEmpty(autoDescriptionViewModel.MSRP) && !String.IsNullOrEmpty(newInventory.VINNumber)) { newInventory.MSRP = autoDescriptionViewModel.MSRP = GetMSRPFromChrome(newInventory.VINNumber); } newInventory.Descriptions = GenerateAutoDescription(randomizedTemplate.Content, autoDescriptionViewModel); newInventory.EnableAutoDescription = true; context.SaveChanges(); return(newInventory.Descriptions); } } return(string.Empty); }
public static void BuildWindowStickerBody(StringBuilder builder, whitmanenterprisedealershipinventory row, whitmanenterprisesetting settingRow) { if (!String.IsNullOrEmpty(row.StandardOptions)) { var standardOptionList = row.StandardOptions.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); int index = standardOptionList.Count() / 2; var optionFirstList = standardOptionList.GetRange(0, index); var optionSecondList = standardOptionList.GetRange(index, Math.Min(index, standardOptionList.Count() - index)); string barCode = "<img height=\"20\" width=\"180\" src=\"http://generator.onbarcode.com/linear.aspx?TYPE=4&DATA=" + row.VINNumber + "&UOM=0&X=0&Y=62&LEFT-MARGIN=0&RIGHT-MARGIN=0&TOP-MARGIN=0&BOTTOM-MARGIN=0&RESOLUTION=72&ROTATE=0&BARCODE-WIDTH=0&BARCODE-HEIGHT=0&SHOW-TEXT=true&TEXT-FONT=Arial%7c9%7cRegular&TextMargin=6&FORMAT=gif&ADD-CHECK-SUM=false&I=1.0&N=2.0&SHOW-START-STOP-IN-TEXT=true&PROCESS-TILDE=false\" />"; builder.AppendLine("<div id=\"bg\">"); builder.AppendLine("<table id=\"window-sticker\" width=\"320\">"); builder.AppendLine("<tr>"); builder.AppendLine("<td width=\"50\" rowspan=\"2\"></td>"); builder.AppendLine("<td width=\"50\" ></td>"); builder.AppendLine("<br />"); builder.AppendLine("<br />"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<td>"); builder.AppendLine("<table id=\"info-table\" width=\"400\">"); builder.AppendLine("<tr>"); builder.AppendLine("<td colspan=\"2\" align=\"center\">"); string title = row.ModelYear.GetValueOrDefault() + " " + row.Make + " " + row.Model + " " + row.Trim; if (title.Length < 32) { builder.AppendLine("<font size=\"5\">" + title + "</font><br />"); } else { builder.AppendLine("<font size=\"3\">" + title + "</font><br />"); } builder.AppendLine("<font size=\"4\">" + row.Cylinders + " Cylinders " + row.FuelType + "</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<td width=\"200\" valign=\"top\">"); builder.AppendLine("<font size=\"4\">"); int odometerNumber = 0; bool odometerFlag = Int32.TryParse(row.Mileage, out odometerNumber); if (odometerFlag) { builder.AppendLine("<em>Mileage:</em> <b>" + odometerNumber.ToString("#,##0") + "</b><br />"); } builder.AppendLine("<em>Stock Number:</em> <b>" + row.StockNumber + "</b><br />"); builder.AppendLine("<em>Color:</em> <b>" + CommonHelper.TrimString(row.ExteriorColor, 17) + "</b><br />"); builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("<td valign=\"top\">"); builder.AppendLine("<font size=\"4\">"); if (!String.IsNullOrEmpty(row.Tranmission)) { if (row.Tranmission.ToLower().Contains("auto")) { builder.AppendLine("<em>Transmission:</em> <b>Automatic</b><br />"); } else { builder.AppendLine("<em>Transmission:</em> <b>Manual</b><br />"); } } else { builder.AppendLine("<em>Transmission:</em> <b></b><br />"); } builder.AppendLine("<em>VIN:</em> <b>" + row.VINNumber + "</b><br />"); builder.AppendLine("<b>" + barCode + "</b><br />"); builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); //CAR OPTIONS if (!String.IsNullOrEmpty(row.CarsOptions) || !String.IsNullOrEmpty(row.CarsPackages)) { builder.AppendLine("<tr>"); builder.AppendLine("<td colspan=\"2\" align=\"center\">"); builder.AppendLine("<font size=\"4\"><u>" + "Additional Packages & Options" + "</u></font><br />"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<font size=\"2\">"); builder.AppendLine("<td height=\"150\" valign=\"top\">"); var finalPackageAndOptions = new List <string>(); if (!String.IsNullOrEmpty(row.CarsPackages)) { var addtionalPackagesList = row.CarsPackages.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); finalPackageAndOptions.AddRange(addtionalPackagesList.AsEnumerable()); } if (!String.IsNullOrEmpty(row.CarsOptions)) { var addtionalOptionList = row.CarsOptions.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); finalPackageAndOptions.AddRange(addtionalOptionList.AsEnumerable()); } int addtionalindex = (int)Math.Ceiling((double)finalPackageAndOptions.Count() / 2); if (finalPackageAndOptions.Count() == 1) { addtionalindex = 1; } var addtionaloptionFirstList = finalPackageAndOptions.GetRange(0, addtionalindex); var addtionaloptionSecondList = finalPackageAndOptions.GetRange(addtionalindex, finalPackageAndOptions.Count - addtionalindex); if (addtionaloptionFirstList.Count() > 10) { foreach (var tmp in addtionaloptionFirstList.Take(10)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in addtionaloptionFirstList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } builder.AppendLine("</td>"); builder.AppendLine("<td>"); if (addtionaloptionSecondList.Count() > 10) { foreach (var tmp in addtionaloptionSecondList.Take(10)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in addtionaloptionSecondList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } builder.AppendLine("</td>"); builder.AppendLine("</font>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<td colspan=\"2\" align=\"center\">"); builder.AppendLine("<font size=\"4\"><u>" + "Standard Options" + "</u></font><br />"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<font size=\"2\">"); builder.AppendLine("<td height=\"500\" valign=\"top\">"); if (optionFirstList.Count() > 20) { foreach (var tmp in optionFirstList.GetRange(0, 20)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in optionFirstList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } for (int i = 0; i < 20 - optionFirstList.Count() - addtionaloptionFirstList.Count(); i++) { builder.Append("<br />"); } } builder.AppendLine("</td>"); builder.AppendLine("<td>"); if (optionSecondList.Count() > 20) { foreach (var tmp in optionSecondList.GetRange(0, 20)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in optionSecondList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } for (int i = 0; i < 20 - optionSecondList.Count() - addtionaloptionSecondList.Count(); i++) { builder.Append("<br />"); } } if (settingRow.RetailPrice.GetValueOrDefault() == false && settingRow.DealerDiscount.GetValueOrDefault() == false) { builder.AppendLine("<br /><br /><br />"); } else if ((settingRow.RetailPrice.GetValueOrDefault() && settingRow.DealerDiscount.GetValueOrDefault()) == false) { builder.AppendLine("<br /><br />"); } builder.AppendLine("</td>"); builder.AppendLine("</font>"); builder.AppendLine("</tr>"); } else { //STANDARD OPTIONS builder.AppendLine("<tr>"); builder.AppendLine("<td colspan=\"2\" align=\"center\">"); builder.AppendLine("<font size=\"4\"><u>" + "Standard Options" + "</u></font><br />"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<font size=\"2\">"); builder.AppendLine("<td height=\"800\" valign=\"top\">"); if (optionFirstList.Count() > 28) { foreach (var tmp in optionFirstList.Take(28)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in optionFirstList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } for (int i = 0; i < 28 - optionFirstList.Count(); i++) { builder.Append("<br />"); } } builder.AppendLine("</td>"); builder.AppendLine("<td>"); if (optionSecondList.Count() > 28) { foreach (var tmp in optionSecondList.Take(28)) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } } else { foreach (var tmp in optionSecondList) { builder.AppendLine(CommonHelper.TrimString(tmp, 35)); builder.Append("<br />"); } for (int i = 0; i < 28 - optionSecondList.Count(); i++) { builder.Append("<br />"); } } if (settingRow.RetailPrice.GetValueOrDefault() && settingRow.DealerDiscount.GetValueOrDefault()) { builder.AppendLine("<br /><br />"); } else if (settingRow.RetailPrice.GetValueOrDefault() == false && settingRow.DealerDiscount.GetValueOrDefault() == false) { builder.AppendLine("<br /><br /><br /><br /><br /><br /><br />"); } else { builder.AppendLine("<br /><br /><br /><br /><br />"); } builder.AppendLine("</td>"); builder.AppendLine("</font>"); builder.AppendLine("</tr>"); } builder.AppendLine("<tr valign=\"bottom\">"); builder.AppendLine("<td align=\"right\" width=\"300\" colspan=\"3\">"); builder.AppendLine("<font size=\"5\">"); int salePriceNumber = 0; int retailPriceNumber = 0; int dealerDiscountNumber = 0; bool salePriceFlag = Int32.TryParse(row.RetailPrice, out retailPriceNumber); bool dealerdiscountFlag = Int32.TryParse(row.DealerDiscount, out dealerDiscountNumber); if (settingRow.RetailPrice.GetValueOrDefault()) { if (salePriceFlag) { builder.AppendLine(settingRow.RetailPriceText + ": " + retailPriceNumber.ToString("c0") + " " + "<br />"); } } if (settingRow.DealerDiscount.GetValueOrDefault()) { if (dealerdiscountFlag) { builder.AppendLine(settingRow.DealerDiscountText + ": " + dealerDiscountNumber.ToString("c0") + " " + "<br /><br />"); } } salePriceNumber = retailPriceNumber - dealerDiscountNumber; if (settingRow.SalePrice.GetValueOrDefault()) { builder.AppendLine(settingRow.SalePriceText + ": " + salePriceNumber.ToString("c0") + " "); } builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("</table>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("</table>"); builder.AppendLine("</div>"); } else { string barCode = "<img height=\"20\" width=\"180\" src=\"http://generator.onbarcode.com/linear.aspx?TYPE=4&DATA=" + row.VINNumber + "&UOM=0&X=0&Y=62&LEFT-MARGIN=0&RIGHT-MARGIN=0&TOP-MARGIN=0&BOTTOM-MARGIN=0&RESOLUTION=72&ROTATE=0&BARCODE-WIDTH=0&BARCODE-HEIGHT=0&SHOW-TEXT=true&TEXT-FONT=Arial%7c9%7cRegular&TextMargin=6&FORMAT=gif&ADD-CHECK-SUM=false&I=1.0&N=2.0&SHOW-START-STOP-IN-TEXT=true&PROCESS-TILDE=false\" />"; builder.AppendLine("<div id=\"bg\">"); builder.AppendLine("<table id=\"window-sticker\" width=\"320\">"); builder.AppendLine("<tr>"); builder.AppendLine("<td width=\"50\" rowspan=\"2\"></td>"); builder.AppendLine("<td width=\"50\" ></td>"); builder.AppendLine("<br />"); builder.AppendLine("<br />"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<td>"); builder.AppendLine("<table id=\"info-table\" width=\"400\">"); builder.AppendLine("<tr>"); builder.AppendLine("<td colspan=\"2\" align=\"center\">"); builder.AppendLine("<font size=\"5\">" + row.ModelYear.GetValueOrDefault() + " " + row.Make + " " + row.Model + " " + row.Trim + "</font><br />"); builder.AppendLine("<font size=\"4\">" + row.Cylinders + " Cylinders " + row.FuelType + "</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<td width=\"200\" valign=\"top\">"); builder.AppendLine("<font size=\"4\">"); int odometerNumber = 0; bool odometerFlag = Int32.TryParse(row.Mileage, out odometerNumber); if (odometerFlag) { builder.AppendLine("<em>Mileage:</em> <b>" + odometerNumber.ToString("#,##0") + "</b><br />"); } builder.AppendLine("<em>Stock Number:</em> <b>" + row.StockNumber + "</b><br />"); builder.AppendLine("<em>Color:</em> <b>" + CommonHelper.TrimString(row.ExteriorColor, 17) + "</b><br />"); builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("<td valign=\"top\">"); builder.AppendLine("<font size=\"4\">"); if (row.Tranmission != null) { builder.AppendLine(row.Tranmission.ToLower().Contains("auto") ? "<em>Transmission:</em> <b>Automatic</b><br />" : "<em>Transmission:</em> <b>Manual</b><br />"); } builder.AppendLine("<em>VIN:</em> <b>" + row.VINNumber + "</b><br />"); builder.AppendLine("<b>" + barCode + "</b><br />"); builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr>"); builder.AppendLine("<font size=\"2\">"); builder.AppendLine("<td height=\"800\" valign=\"top\">"); if (settingRow.RetailPrice.GetValueOrDefault() && settingRow.DealerDiscount.GetValueOrDefault()) { builder.AppendLine("<br /><br />"); } else if (settingRow.RetailPrice.GetValueOrDefault() == false && settingRow.DealerDiscount.GetValueOrDefault() == false) { builder.AppendLine("<br /><br /><br /><br /><br /><br /><br />"); } else { builder.AppendLine("<br /><br /><br /><br /><br />"); } builder.AppendLine( "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />"); builder.AppendLine("</td>"); builder.AppendLine("</font>"); builder.AppendLine("</tr>"); builder.AppendLine("<tr valign=\"bottom\">"); builder.AppendLine("<td align=\"right\" width=\"300\" colspan=\"3\">"); builder.AppendLine("<font size=\"5\">"); int salePriceNumber = 0; int retailPriceNumber = 0; int dealerDiscountNumber = 0; bool salePriceFlag = Int32.TryParse(row.RetailPrice, out retailPriceNumber); bool dealerdiscountFlag = Int32.TryParse(row.DealerDiscount, out dealerDiscountNumber); if (settingRow.RetailPrice.GetValueOrDefault()) { if (salePriceFlag) { builder.AppendLine(settingRow.RetailPriceText + ": " + retailPriceNumber.ToString("c0") + " " + "<br />"); } } if (settingRow.DealerDiscount.GetValueOrDefault()) { if (dealerdiscountFlag) { builder.AppendLine(settingRow.DealerDiscountText + ": " + dealerDiscountNumber.ToString("c0") + " " + "<br /><br />"); } } salePriceNumber = retailPriceNumber - dealerDiscountNumber; if (settingRow.SalePrice.GetValueOrDefault()) { builder.AppendLine(settingRow.SalePriceText + ": " + salePriceNumber.ToString("c0") + " "); } builder.AppendLine("</font>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("</table>"); builder.AppendLine("</td>"); builder.AppendLine("</tr>"); builder.AppendLine("</table>"); builder.AppendLine("</div>"); } }