private void HandleInscription() { string data = Encoding.ASCII.GetString(Protocol.ReceiveData(ClientSocket)); var arrayData = data.Split('#'); int studentId = Int32.Parse(arrayData[0]); string courseName = arrayData[1]; try { courseLogic.AddStudent(studentId, courseName); Protocol.Send(ClientSocket, "RES", CommandUtils.SUCCESS_MESSAGE, Encoding.ASCII.GetBytes("Inscription created successfully.")); Logs.SendTimestamp("Inscription", studentId.ToString(), "Inscripction to course: " + courseName); } catch (StudentException e) { Protocol.Send(ClientSocket, "RES", CommandUtils.ERROR, Encoding.ASCII.GetBytes(e.Message)); } catch (CourseException e) { Protocol.Send(ClientSocket, "RES", CommandUtils.ERROR, Encoding.ASCII.GetBytes(e.Message)); } }