public static string ChangeResultCode(string resultCode, ScreeningImpression screeningImpression) { StringBuilder result = new StringBuilder(resultCode); if (resultCode.Substring(0, 1) == "5") { if (resultCode.Length == 5) { string stringToReplace = resultCode.Substring(3, 2); result.Replace(stringToReplace, screeningImpression.ResultCode, 3, 2); } else { throw new Exception("Cytology Result Codes must be 5 characters long"); } } else { throw new Exception("This is not a Cytology Result Code."); } return result.ToString(); }
public static string ChangeResultCode(string resultCode, ScreeningImpression screeningImpression) { StringBuilder result = new StringBuilder(resultCode); if (resultCode.Substring(0, 1) == "5") { if (resultCode.Length == 5) { string stringToReplace = resultCode.Substring(3, 2); result.Replace(stringToReplace, screeningImpression.ResultCode, 3, 2); } else { throw new Exception("Cytology Result Codes must be 5 characters long"); } } else { throw new Exception("This is not a Cytology Result Code."); } return(result.ToString()); }