private void btnSave_Click(object sender, EventArgs e) { RegistrationServiceClient registrationService = new RegistrationServiceClient(); LogServiceClient logService = new LogServiceClient(); if (ExistingSchedRemove.Count > 0) { if (registrationService.DeleteLoadedSubjects(controlStudentId, SY, ExistingSchedRemove.ToArray())) { foreach (StudentSubject ss in ExistingSchedRemove) { string json = JsonConvert.SerializeObject(ss); Log log = new Log { CLUD = "D", LogDate = DateTime.Now, TableName = "StudentSubject", UserId = GlobalClass.user.UserId, UserName = GlobalClass.user.UserName, PassedData = json }; logService.AddLogs(log); } MessageBox.Show(this, "Adding Student Subjects Successful ."); Close(); } else { MessageBox.Show(this, "Student Subjects Adding Failed."); Close(); } } if (subjects.Count > 0) { if (registrationService.ControlSubjects(controlStudentId, SY, subjects.ToArray())) { foreach (StudentSubject ss in subjects) { string json = JsonConvert.SerializeObject(ss); Log log = new Log { CLUD = "C", LogDate = DateTime.Now, TableName = "StudentSubject", UserId = GlobalClass.user.UserId, UserName = GlobalClass.user.UserName, PassedData = json }; logService.AddLogs(log); } MessageBox.Show(this, "Adding Student Subjects Successful ."); Close(); } else { MessageBox.Show(this, "Student Subjects Adding Failed."); Close(); } } }