private void addPanel_importButton_Click(string title) { try { string path = HKOpenFileDialog.selectFile(HKDialogFilter.Library); AttandanceLibrary lib = FileSerilizeOpener <AttandanceLibrary> .open(path); AttandanceLibrary oldLib = null; DJTUBinary librarys = GlobalStation.shareInstance.librarys; librarys.isCustomize = false; if (librarys.containsLibrary(lib)) { handleOverwrite(lib, ref oldLib); } librarys.addLib(lib); GlobalStation.shareInstance.librarySave(delegate() { initTableViewContent(); resize(null, null); }, delegate() { if (oldLib != null) { librarys.addLib(oldLib); } librarys.removeLib(lib.UUID); }); } catch (HKOpenFileDialog.CancelOpenFileException) { } }
private void excelImport_Click(object sender, EventArgs e) { try { string fileName = HKOpenFileDialog.selectFile(HKDialogFilter.Excel); ExcelReader reader = ExcelReader.createReader(fileName); List <StuList> list = reader.stuListsClassifyByClass(); Model.Course course = courseRef; foreach (StuList item in list) { if (course.containsStuListByName(item.name)) { course.getStuListByName(item.name).appendStudents(item); } else { course.addStuList(item); } } GlobalStation.shareInstance.librarySave(delegate() { initTabsContent(); }, null); }catch (ExcelReader.ExcelOpenFailedException ex) { MessageBox.Show("文件打开失败:{0}", ex.Message); }catch (HKOpenFileDialog.CancelOpenFileException ex) { Console.WriteLine(ex.Message); } }
private void addPanel_openButton_Click(string title) { try { string path = HKOpenFileDialog.selectFile(HKDialogFilter.Library); AttandanceLibrary lib = FileSerilizeOpener <AttandanceLibrary> .open(path); GlobalStation.shareInstance.librarys.isCustomize = true; GlobalStation.shareInstance.librarys.customizeLibrary = CustomLibrary.createLibrary(lib, path); LibraryHallPanel hall = new LibraryHallPanel(); hall.libraryUUID = lib.UUID; GlobalStation.shareInstance.entrance.showPanel(hall); }catch (HKOpenFileDialog.CancelOpenFileException) { } }
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) { } }
private void addPanel_importCourseBtn_Click(string title) { try { string path = HKOpenFileDialog.selectFile(HKDialogFilter.Course); Model.Course course = FileSerilizeOpener <Model.Course> .open(path); AttandanceLibrary lib = libraryRef; if (!lib.containsCourse(course.id)) { lib.addCourse(course); } else { overwriteOrCreateNew(lib, course); } GlobalStation.shareInstance.librarySave(delegate() { contentInit(); }, null); }catch (HKOpenFileDialog.CancelOpenFileException e) { Console.WriteLine(e.Message); }catch (FileSerilizeOpener <Model.Course> .FileOpenException e) { HKConfirmForm.showConfirmForm(e.Message); } }