public StuList appendStudentsToList(StuList stuList) { try { StuList exceptList = new StuList(); for (int i = 2; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); Student stu = studentFromRow(row); if (stu == null) { continue; } if (!stuList.containsStudent(stu)) { stuList.addStudent(stu); } else { exceptList.addStudent(stu); } } return(exceptList); } catch { throw new StudentParseException("名单解析失败"); } }
private void changeBaseAttribute(StuList stuList, mainGridCellIndex index, string value) { Student stu = stuList[editingStudentId]; switch (index) { case mainGridCellIndex.Name: stu.name = value; break; case mainGridCellIndex.id: setStuId(stuList, stu, value); break; case mainGridCellIndex.sex: stu.sex = Student.stringToSex(value); break; case mainGridCellIndex.major: stu.major.name = value; break; case mainGridCellIndex.grade: stu.major.grade = value; break; case mainGridCellIndex._class: stu.major._class = value; break; case mainGridCellIndex.courseAttribute: stu.courseAttribute = Student.stringToCourseAttribute(value); break; case mainGridCellIndex.examMethod: stu.examMethod = Student.stringToExamMethod(value); break; case mainGridCellIndex.examAttribute: stu.examAttribute = Student.stringToExamAttribute(value); break; case mainGridCellIndex.isExamDelay: stu.isExamDelay = Student.stringToIsExamDelay(value); break; case mainGridCellIndex.score: stu.score = value; break; case mainGridCellIndex.subAttStartIndex: break; default: break; } }
public List <StuList> stuListsClassifyByClass() { List <StuList> list = new List <StuList>(); StuList exceptList = new StuList(); exceptList.name = "未知班级"; for (int i = 2; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); Student stu = studentFromRow(row); if (stu == null) { continue; } if (stu.major._class.Equals("")) { exceptList.addStudent(stu); continue; } StuList stuList = getStuListFromCurrentList(ref list, stu.major._class); stuList.addStudent(stu); } if (exceptList.allStudents().Count != 0) { list.Add(exceptList); } return(list); }
private StuList createStuList(string title) { Model.Course course = courseRef; StuList stuList = new StuList(); stuList.name = title; return(stuList); }
public static void showCourseReport(string title, StuList stuList, Model.Course course) { CourseReport report = new CourseReport(); report.isSingleButtonMode = true; report.titleLabel.Text = title; report.stuList = stuList; report.course = course; report.ShowDialog(); }
private void tabs_addNewStuList(string title) { Model.Course course = courseRef; StuList stuList = createStuList(title); course.addStuList(stuList); GlobalStation.shareInstance.librarySave(null, delegate() { course.removeStuList(stuList.UUID); }); initTabsContent(); }
private void init_rows(Model.Course course, StuList stuList) { foreach (Student stu in stuList.allStudents()) { int newRowIndex = mainGrid.Rows.Add(); DataGridViewRow newRow = mainGrid.Rows[newRowIndex]; init_rows_baseAttributeInit(newRow, stu); init_rows_attandanceInit(newRow, course.allSubAttandances(), stu); init_rows_extrasInit(newRow, course.allExtras(), stu); } }
private void setStuId(StuList stuList, Student stu, string id) { if (stuList[id] == null) { stu.id = id; } else { HKConfirmForm.showConfirmForm("该学号已经存在!"); } }
private void tabBtnMenuMethod_ChangeName(string uuid, string name) { Model.Course course = courseRef; StuList stuList = course.getStuList(uuid); string originName = stuList.name; stuList.name = name; GlobalStation.shareInstance.librarySave(null, delegate() { stuList.name = originName; }); initTabsContent(); }
private void tabBtnMenuMethod_DeleteStuList(string stuListUUID) { Model.Course course = null; StuList stuList = null; course = courseRef; stuList = course.removeStuList(stuListUUID); GlobalStation.shareInstance.librarySave(null, delegate() { course.addStuList(stuList); }); initTabsContent(); initTableViewContent(); }
private void DIY_getMajorInfoOfLastStudent(StuList stuList, out string major, out string grade, out string _class) { try { ArrayList allStudents = stuList.allStudents(); Student lastStudent = (Student)(allStudents[allStudents.Count - 1]); major = lastStudent.major.name; grade = lastStudent.major.grade; _class = lastStudent.major._class; } catch (ArgumentOutOfRangeException e) { Console.WriteLine(e); major = "未命名"; grade = "未命名"; _class = "未命名"; } }
private string DIY_calTheMaxStudentId(StuList stuList) { long newStuId = 0; ArrayList allStudents = stuList.allStudents(); foreach (Student item in allStudents) { long itemId = long.Parse(item.id); if (itemId > newStuId) { newStuId = itemId; } } newStuId++; return("" + newStuId); }
private void MainGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { Model.Course course = courseRef; StuList stuList = course.getStuList(SelectedStuListUUID); if (e.ColumnIndex < (int)mainGridCellIndex.subAttStartIndex) { mainGridCellIndex index = (mainGridCellIndex)e.ColumnIndex; string value = getRowValue(e.RowIndex, index); changeBaseAttribute(stuList, index, value); } else { changeSpecalAttribute(course, stuList, e); } saveChange(); }
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 setAttandanceToTheStudent(Record.RType type) { Model.Course course = hall.courseRef; StuList stuList = course.getStuList(hall.SelectedStuListUUID); string stuId = hall.getRowValue(hall.mainGrid.CurrentRow.Index, mainGridCellIndex.id); Student stu = stuList[stuId]; StuAttandance stuAtt = stu.getAttandance(newSubAtt.UUID); if (stuAtt == null) { stuAtt = new StuAttandance(newSubAtt, course.getRecord(type)); stu.addAttandance(stuAtt); } else { stuAtt.record = course.getRecord(type); } }
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); }
private StuList getStuListFromCurrentList(ref List <StuList> list, string _class) { StuList stuList = null; foreach (StuList item in list) { if (item.name.Equals(_class)) { stuList = item; } } if (stuList == null) { stuList = new StuList(); stuList.name = _class; list.Add(stuList); } return(stuList); }
// GET: Client/ajax public string Search(string query) { IEnumerable <client> StuList; ClientService cs = new ClientService(); StuList = cs.GetMany(a => a.clientName.StartsWith(query)); var result = "<div class=\"m-list-search__results\">"; if (StuList.Count() == 0) { result = result + " <span class=\"m-list-search__result-message\">"+ " No record found" + " </ span >"; } if (StuList.Count() != 0) { result = result + " <span class=\"m-list-search__result-category m-list-search__result-category--first\"> Client </span>"; foreach (var item in StuList) { result = result + "<a href=\" " + Url.Content("~/") + "Client/Details/" + item.idUser + " \" class=\"m-list-search__result-item\"> <span class=\"m-list-search__result-item-pic\">"; if (item.logo == null) { result = result + "<img class=\"m--img-rounded\" src=\" " + Url.Content("~/") + "Content/assets/app/media/img/users/user4.jpg\" />"; } else { result = result + "<img class=\"m--img-rounded\" src=\" " + Url.Content("~/") + "Content/ProfilePictures/" + item.logo + "\")\" />"; } result = result + "</span> <span class=\"m-list-search__result-item-text\">"+ item.clientName + "</span></a>"; } } result = result + "</div>"; return(result); }
private void changeSpecalAttribute(Model.Course course, StuList stuList, DataGridViewCellEventArgs e) { Student stu = stuList[editingStudentId]; DataGridViewColumn column = mainGrid.Columns[e.ColumnIndex]; string UUID = column.Name; SubAttandance subAtt = course.getSubAttandance(UUID); string value = (string)mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; if (subAtt != null) { Record recordToChangeTo = course.getRecord(value); changeAttandance(stu, subAtt, recordToChangeTo); mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = recordToChangeTo.recordColor; } else { subExtra subExt = course.getExtra(UUID); changeExtra(stu, subExt, value); mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = subExt[value].typeColor; } }
public void initTableViewContent() { mainGridCurrentScrollPosition = mainGrid.HorizontalScrollingOffset; if (mainGrid.CurrentRow != null) { mainGridCurrentRowIndex = mainGrid.CurrentRow.Index; } clearContent(); Model.Course course = courseRef; init_subAttandanceColumn(course); init_subExtraColumn(course); string StuListUUID = SelectedStuListUUID; StuList stuList = course.getStuList(StuListUUID); if (stuList != null) { init_rows(course, stuList); } startCellValueChanged(); mainGrid.HorizontalScrollingOffset = mainGridCurrentScrollPosition; setSeletedRow(mainGridCurrentRowIndex); }
private void addRowByExcelWithCoverEnable(bool coverEnable) { try { string fileName = HKOpenFileDialog.selectFile(HKDialogFilter.Excel); ExcelReader reader = ExcelReader.createReader(fileName); StuList currentStuList = SelectedStuList; if (coverEnable) { currentStuList.clear(); } StuList stulist = reader.appendStudentsToList(currentStuList); GlobalStation.shareInstance.librarySave(delegate() { initTableViewContent(); }, delegate() { GlobalStation.shareInstance.librarysInit(); }); } catch (ExcelReader.ExcelOpenFailedException e) { MessageBox.Show("文件打开失败:{0}", e.Message); }catch (ExcelReader.StudentParseException e) { MessageBox.Show("文件解析失败:{0}", e.Message); }catch (HKOpenFileDialog.CancelOpenFileException) { } }