/// <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>
        /// 从离线数据中 获取上课表 其中包含该门课程每节课的信息.
        /// </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>
        /// <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);
        }
예제 #9
0
        /// <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);
        }