/// <summary> /// The purpose of this method to get installer address for the passing installer id. /// </summary> /// <param name="InstallerId"></param> /// <returns></returns> public static string GetInstallerAddress(Guid InstallerId) { StringBuilder strAddress = new StringBuilder(); try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { USP_GetInstallerAddressByInstallerIdResult address = db.USP_GetInstallerAddressByInstallerId(InstallerId.ToString()).SingleOrDefault(); if (address == null) { return(" "); } strAddress.AppendLine(address.CompanyName); strAddress.Append(address.AddressOne + ", "); if (!string.IsNullOrEmpty(address.AddressTwo)) { strAddress.Append(address.AddressTwo + ", "); } if (!string.IsNullOrEmpty(address.Town)) { strAddress.Append(address.Town + ", "); } if (!string.IsNullOrEmpty(address.County)) { strAddress.Append(address.County); } else { strAddress.Append(" "); } if (!string.IsNullOrEmpty(address.PostCode)) { strAddress.Append(address.PostCode + " "); } if (!string.IsNullOrEmpty(address.Mobile)) { strAddress.Append(address.Mobile + ", "); } if (!string.IsNullOrEmpty(address.Telephone)) { strAddress.Append(address.Telephone + ", "); } if (!string.IsNullOrEmpty(address.Fax)) { strAddress.Append(address.Fax); } strAddress.Append(" "); } } catch (Exception ex) { throw ex; } return(strAddress.ToString()); }
/// <summary> /// The purpose of this method to get the installer adddress by installer id. /// </summary> /// <param name="InstallerId"></param> /// <returns></returns> public static string GetAddressHTML2Line(Guid InstallerId) { StringBuilder strAddress = new StringBuilder(); try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { /* This change is made to get the company name */ USP_GetInstallerAddressByInstallerIdResult address = db.USP_GetInstallerAddressByInstallerId(InstallerId.ToString()).SingleOrDefault(); if (address == null) { return(""); } strAddress.AppendLine("<p style='padding-left:15px;'><b>" + address.CompanyName + "</b><br/>"); strAddress.Append(address.AddressOne + ", "); if (!string.IsNullOrEmpty(address.AddressTwo)) { strAddress.Append(address.AddressTwo + ", "); } if (!string.IsNullOrEmpty(address.Town)) { strAddress.Append(address.Town + ", "); } if (!string.IsNullOrEmpty(address.County)) { strAddress.Append(address.County + "<br/>"); } else { strAddress.Append("<br/>"); } if (!string.IsNullOrEmpty(address.PostCode)) { strAddress.Append(address.PostCode + "<br/>"); } if (!string.IsNullOrEmpty(address.Mobile)) { strAddress.Append(address.Mobile + ", "); } if (!string.IsNullOrEmpty(address.Telephone)) { strAddress.Append(address.Telephone + ", "); } if (!string.IsNullOrEmpty(address.Fax)) { strAddress.Append(address.Fax); } strAddress.Append("<br/></p>"); } } catch (Exception ex) { throw ex; } return(strAddress.ToString()); }
/// <summary> /// The purpose of this method to get the installer adddress for email by installer id. /// </summary> /// <param name="InstallerId"></param> /// <returns></returns> public static string GetAddressHTML2LineForEmail(Guid InstallerId) { string strAddress = string.Empty; try { using (LinqToSqlDataContext db = new LinqToSqlDataContext()) { /* This change is made to get the company name */ USP_GetInstallerAddressByInstallerIdResult address = db.USP_GetInstallerAddressByInstallerId(InstallerId.ToString()).SingleOrDefault(); if (address == null) { return(" "); } string NOTSPECIFIED = " "; strAddress += string.IsNullOrEmpty(address.CompanyName) ? NOTSPECIFIED.Trim() : " " + address.CompanyName + ", " + " <br /> "; strAddress += " " + address.AddressOne + ", " + " <br /> "; strAddress += string.IsNullOrEmpty(address.AddressTwo) ? NOTSPECIFIED.Trim() : " " + address.AddressTwo + ", " + " <br /> "; strAddress += string.IsNullOrEmpty(address.Town) ? NOTSPECIFIED.Trim() : " " + address.Town + ", "; strAddress += string.IsNullOrEmpty(address.County) ? NOTSPECIFIED.Trim() : address.County + ", "; strAddress += string.IsNullOrEmpty(address.PostCode) ? NOTSPECIFIED.Trim() : "<br /> " + address.PostCode + ", <br /> "; strAddress += string.IsNullOrEmpty(address.Fax) ? NOTSPECIFIED.Trim() : " Fax: " + address.Fax; strAddress += string.IsNullOrEmpty(address.Mobile) ? NOTSPECIFIED.Trim() : ", Mob: " + address.Mobile; strAddress += string.IsNullOrEmpty(address.Telephone) ? NOTSPECIFIED.Trim() : " Tel: " + address.Telephone; if (strAddress.LastIndexOf(",") > 0) { strAddress = strAddress.Remove(strAddress.LastIndexOf(",")); } } } catch (Exception ex) { throw ex; } return(strAddress); }