public void ValidateForBdf() { // 72 bytes are available for: patientname patientcode birthdate patient_additional + 3 commas // 42 bytes are available for: admincode technician equipment recording_additional + 3 commas // Birthdate takes 10 bytes. // Recording additional is reserved 4 bytes if ((SubjectName.Length + SubjectCode.Length + SubjectAdditional.Length) > NumberSubjectCharsAvailable) { int count = NumberSubjectCharsAvailable; SubjectName = SubjectName.Substring(0, count); count -= SubjectName.Length; SubjectCode = SubjectCode.Substring(0, count); count -= SubjectCode.Length; SubjectAdditional = SubjectAdditional.Substring(0, count); } if (AdminCode.Length + Technician.Length + Device.Length > NumberTechnicianCharsAvailable) { int count = NumberTechnicianCharsAvailable; AdminCode = AdminCode.Substring(0, count); count -= AdminCode.Length; Technician = Technician.Substring(0, count); count -= Technician.Length; Device = Device.Substring(0, count); } }
public bool ValidateStrings() { if (SessionName.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' ')) && SubjectName.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' ')) && SubjectCode.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' ')) && SubjectAdditional.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' ')) && AdminCode.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' ')) && Technician.All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals(' '))) { return(true); } return(false); }