private void deleteStudent(int rowIndex) { StuList stuList = null; Student stu = null; string studentId = getRowValue(rowIndex, mainGridCellIndex.id); Model.Course course = courseRef; string stuListId = SelectedStuListUUID; stuList = course.getStuList(stuListId); stu = stuList[studentId]; stuList.removeStudent(studentId); GlobalStation.shareInstance.librarySave(delegate() { mainGrid.Rows.Remove(mainGrid.Rows[rowIndex]); }, delegate() { stuList.addStudent(stu); }); }
private void DIY() { string newStuIdString; string major, grade, _class; Model.Course course = courseRef; string selectedStuListId = SelectedStuListUUID; StuList stuList = course.getStuList(selectedStuListId); newStuIdString = DIY_calTheMaxStudentId(stuList); DIY_getMajorInfoOfLastStudent(stuList, out major, out grade, out _class); Student stu = DIY_createNewStudent(newStuIdString, major, grade, _class); stuList.addStudent(stu); GlobalStation.shareInstance.librarySave(null, delegate() { stuList.removeStudent(stu.id); }); maingrid_addRow(stu); }