/// <summary> /// 下载一门课程 包括显示进度条等界面操作 /// </summary> /// <param name="kkno"></param> /// public static void DownloadOneCourse(long kkno) { var fDataModule = new DataModule(); //新建一个datamodule var jsandkkview = from c in fDataModule.GetJsandkkviewro() //传进来kkno 将对应课程的信息拉出来 where c.KKNO == kkno select c; var kkrecord = jsandkkview.First(); //取第一条记录 var courseBriefcase = BriefcaseControl.CreateBriefcase(kkrecord); //根据开课表的一行记录建立briefcase if (courseBriefcase == null) { return; } _waitform = new WaitForm("初始化下载进程"); new Thread(() => DownloadData(kkno, courseBriefcase)).Start(); //将费时的操作放在一个线程中 _waitform.ShowDialog(); MsgBox.ShowMsgBoxDialog("选定的课程下载完毕."); }
/// <summary> /// 从离线数据中 获取上课表 其中包含该门课程每节课的信息. /// </summary> /// <param name="skno">上课编号</param> /// <returns>开课编号对应的上课表(上课信息 一堂课一条记录)</returns> public static List <SKTABLE_07_VIEW> GetSktable(long kkno) { var courseBriefcase = BriefcaseControl.GetBriefcase(kkno); var skDatatable = courseBriefcase.FindTable("SKTABLE"); return(skDatatable.ToList <SKTABLE_07_VIEW> ()); }
/// <summary> /// 从离线数据中 获取选课表 里面包含学生信息 /// </summary> /// <param name="kkno">开课编号</param> /// <returns>开课编号对应的选课表(学生信息 一个学生一条记录)</returns> public static DataTable GetXktable(long kkno) { var courseBriefCase = BriefcaseControl.GetBriefcase(kkno); var xkTable = courseBriefCase.FindTable("XKTABLE"); return(xkTable); }
/// <summary> /// 显示辅助函数 获取第一个页面的Listbox的数据源(Dictionary) /// Dp开头的为显示辅助函数. /// </summary> /// <returns>可直接绑定在listbox的Dictionary</returns> public static Dictionary <long, string> GetCourseInfoDictionary( ) { var courseInfoDatatable = BriefcaseControl.GetCourseInfoDataTable(); var courseInfoDictionary = CourseInfoToDictionary(courseInfoDatatable); return(courseInfoDictionary); }
/// <summary> /// 从离线数据中 根据开课编号和上课编号找到点名表 /// </summary> /// <param name="kkno">开课编号</param> /// <param name="skno">上课编号</param> /// <returns>DMTABLE的一个List</returns> public static List <DMTABLE_08_NOPIC_VIEW> GetDmtable(long kkno, long skno) { var courseBriefcase = BriefcaseControl.GetBriefcase(kkno); var dmDatatable = courseBriefcase.FindTable(skno.ToString()); return(dmDatatable.ToList <DMTABLE_08_NOPIC_VIEW>()); }
public static void SaveSkTable(List <SKTABLE_07_VIEW> skTable, long kkno) { var courseBriefcase = BriefcaseControl.GetBriefcase(kkno); var skDatatable = EnumerableExtension.ListToDataTable(skTable, "SKTABLE"); courseBriefcase.AddTable(skDatatable); courseBriefcase.WriteBriefcase(); }
/// <summary> /// 传入 kkno 和点名表, 将点名表存入Briefcase中. 上课编号从点名表中获取. /// </summary> /// <param name="kkno">开课编号</param> /// <param name="dmTable">点名表 (datatable)</param> /// <returns></returns> public static void SaveDmDatatable(long kkno, DataTable dmTable) { //该函数已经在BriefcaseControl中实现 但是在BriefcaseControl中, 传入的是Briefcase. var classBriefcase = BriefcaseControl.GetBriefcase(kkno); if (null != classBriefcase) { BriefcaseControl.SaveDmTable(classBriefcase, dmTable); } }
/// <summary> /// 根据 kkno 和skno 获取点名表 /// 需要对空值进行判断 /// </summary> /// <param name="kkno"></param> /// <param name="skno"></param> /// <returns></returns> public static DataTable GetDmDatatable(long kkno, long skno) { var classBriefcase = BriefcaseControl.GetBriefcase(kkno); // 获取这门课对应的Briefcase if (classBriefcase == null) { return(null); // 如果获取到的Briefcase为空,则返回的Datatable也应为空 } else { return(classBriefcase.FindTable(skno.ToString(CultureInfo.InvariantCulture))); } }
public static void SetOneCourseDidNotSubmit(long kkno, long skno) { var courseBriefcase = BriefcaseControl.GetBriefcase(kkno); var classInfoTable = OfflineDataControl.GetClassInfoTable(kkno); var classInfoRows = classInfoTable.Select(string.Format("上课编号 = '{0}'", skno)); classInfoRows.First().BeginEdit(); classInfoRows.First()["上课状态"] = "未提交"; classInfoRows.First().EndEdit(); courseBriefcase.AddTable(classInfoTable); courseBriefcase.WriteBriefcase(); }
/// <summary> /// 传入开课编号 上课编号 实际上课时间 初始化考勤信息 /// 这里需要对指纹进行初始化 /// </summary> /// <param name="kkno">开课编号</param> /// <param name="skno">上课编号</param> /// <param name="expectedArriveTime">实际考勤时间</param> public static List <Student> Init(long kkno, long skno, DateTime expectedArriveTime) { var classBriefcase = BriefcaseControl.GetBriefcase(kkno); // 拿课程对应的Briefcase Student.ClassBriefcase = classBriefcase; // 用于缓存classBriefcase 当手动签到结束后应该刷新Student.ClassBriefcase 变量 var dmTable = OfflineDataControl.GetDmDatatable(kkno, skno); // 拿本节课对应的点名表 Student.DmTable = dmTable; // 缓存点名表 手动签到时候要刷新Student.DmTable变量 var xkTable = OfflineDataControl.GetXktable(kkno); // 拿课程对应的学生信息 var dmTableList = dmTable.ToList <DMTABLE_08_NOPIC_VIEW> (); var studentList = InitStudentList(xkTable, dmTableList, expectedArriveTime, skno, kkno); studentList = StartInitFingerprint(studentList); CopyOfStudentList = studentList; return(studentList); }
public static List <Student> InitStudentList(DataTable xkTableList, List <DMTABLE_08_NOPIC_VIEW> dmTableList, DateTime expectedArriveTime, long skno, long kkno) { var studentList = new List <Student> (); var bjTable = BriefcaseControl.GetBjTableDictionary(); foreach (DataRow xkRecord in xkTableList.Rows) { var index = dmTableList.FindIndex(s => s.XSID == (string)xkRecord["XSID"]); if (-1 == index) { continue; // 如果点名表里没这个学生的话 就跳过该学生 } var dmRecord = dmTableList[index]; var student = new Student(xkRecord, dmRecord, expectedArriveTime); var classId = student.ClassId; var bjName = bjTable[classId]; student.ClassName = bjName; student.skno = skno; student.kkno = kkno; if (dmRecord.DMSJ1 != null) { student.ArriveTime = dmRecord.DMSJ1.Value; } studentList.Add(student); } return(studentList); }
/// <summary> /// 保存上课表 并更新PropertiesBriefcase中的上课状态. /// </summary> /// <param name="kkno"></param> public static void SaveSkTable(long kkno, long skno, SKTABLE_07_VIEW skRecord) { var fDataModule = new DataModule(); var sktable = from c in fDataModule.GetSktable07Viewro() where c.KKNO == kkno select c; // 拉取上课表 var sktableList = sktable.ToList(); var courseBriefcase = BriefcaseControl.GetBriefcase(kkno); var skdatatable = courseBriefcase.FindTable("SKTABLE"); //将上课表转换成datatable var skDatarow = skdatatable.Select(string.Format("SKNO = {0}", skno)); skDatarow.First().BeginEdit(); skDatarow.First()["EDITMANNO"] = skRecord.EDITMANNO; skDatarow.First()["EDITDATE"] = skRecord.EDITDATE; skDatarow.First()["DMFS"] = skRecord.DMFS; skDatarow.First()["CDRS"] = skRecord.CDRS; skDatarow.First()["ZCRS"] = skRecord.ZCRS; skDatarow.First()["ZTRS"] = skRecord.ZTRS; skDatarow.First()["KKRS"] = skRecord.KKRS; skDatarow.First()["SKDATE"] = skRecord.SKDATE; skDatarow.First()["XKDATE"] = skRecord.XKDATE; skDatarow.First().EndEdit(); skdatatable = EnumerableExtension.ListToDataTable(skdatatable.ToList <SKTABLE_07_VIEW> (), "SKTABLE"); courseBriefcase.AddTable(skdatatable); courseBriefcase.WriteBriefcase(); var classInfoTable = OfflineDataControl.GetClassInfoTable(kkno); //var classInfoTable = courseBriefcase.FindTable("ClassInfo"); var classInfoRow = classInfoTable.Select(string.Format("上课编号='{0}'", skno)); classInfoRow.First().BeginEdit(); classInfoRow.First()["上课状态"] = "已签到"; classInfoRow.First().EndEdit(); courseBriefcase.AddTable(classInfoTable); courseBriefcase.WriteBriefcase(); //todo:改PropertiesBriefcase!!!! //foreach (DataRow sktableRow in skdatatable.Rows) { // if ((Int16)sktableRow["SKZT"] == 3) // continue; // var index = sktableList.FindIndex(a => a.SKNO == (long) sktableRow["SKNO"]); // sktableRow.BeginEdit(); // sktableRow[["ZTRS"]] //} //courseBriefcase.AddTable (skdatatable); // 将datatable写入briefcase中 //var ttttt = courseBriefcase.FindTable("SKTABLE"); //courseBriefcase.WriteBriefcase (); // 写入硬盘 ////刷新PropertiesBriefcase //RefreshClassInfoTable(courseBriefcase , sktableList); }