コード例 #1
0
        /// <summary>
        /// 刷新指纹信息
        /// </summary>
        /// <param name="kkno">开课编号</param>
        /// <param name="ClassBriefcase">该节课的Briefcase</param>
        public void RefreshStudentInformation(long kkno, Briefcase ClassBriefcase)
        {
            IQueryable <XKTABLE_VIEWRO> xktableView1s =
                from c in
                remoteDataAdapter.GetTable <XKTABLE_VIEWRO>()
                where c.KKNO == kkno
                select c;

            ClassBriefcase.AddTable(
                OfflineHelper.TableListToDataTable(
                    xktableView1s.ToList(), "XKTABLE_VIEW1")); // 获取指纹信息并添加到Birefcase

            ClassBriefcase.WriteBriefcase();                   //保存更改
        }
コード例 #2
0
        /// <summary>
        /// 更改一个点名记录
        /// </summary>
        /// <param name="dkzt">到课状态 0 正常到课 1 迟到 2 早退 3 旷课 4 请假 </param>
        /// <param name="isArrive">学生是否来上课 true 来上课 false 没有来上课</param>
        private void ChangeOnedmtableRecord(Int16 dkzt, bool isArrive)
        {
            DataRow[] dmRows;                           //点名表的若干行

            DataRow[] displayRows;                      //显示表的若干行

            lock (ThreadLocker.CallingBriefcaseLocker)  //加锁
            {
                if (GridStudentName.CurrentRow == null) //F*****g DBA AGAIN!!!! 总是存在有问题的数据 所以会出错
                {
                    return;
                }
                //GridStudentName:用于显示学生信息的gridview

                dmRows = _dmTable.Select
                             ("XSID = '" + GridStudentName.CurrentRow.Cells[1].Value.ToString() + "'");//

                if (dmRows.Any())
                {
                    dmRows.First().BeginEdit();
                    dmRows.First()["DKZT"] = dkzt;

                    if (isArrive && dkzt == 1)
                    {
                        dmRows.First()["DMSJ1"] = DateTime.Now;
                    }
                    else if (DateTime.Now < _rollCallTime)
                    {
                        dmRows.First()["DMSJ1"] = DateTime.Now;
                    }
                    else
                    {
                        dmRows.First()["DMSJ1"] = _rollCallTime;
                    }

                    dmRows.First().EndEdit();
                    displayRows = displayTable.Select("学号 = '" + GridStudentName.CurrentRow.Cells[1].Value + "'");
                    if (displayRows.Any())
                    {
                        displayRows.First().BeginEdit();
                        switch (dkzt)
                        {
                        case 0:
                        {
                            displayRows.First()["到课状态"] = "正常到课";
                            break;
                        }

                        case 1:
                        {
                            displayRows.First()["到课状态"] = "迟到";
                            break;
                        }

                        case 2:
                        {
                            displayRows.First()["到课状态"] = "早退";
                            break;
                        }

                        case 3:
                        {
                            displayRows.First()["到课状态"] = "旷课";
                            break;
                        }

                        case 4:
                        {
                            displayRows.First()["到课状态"] = "请假";
                            break;
                        }

                        case 5:
                        {
                            displayRows.First()["到课状态"] = "未签到";
                            break;
                        }
                        }
                        displayRows.First().EndEdit();
                    }
                }
                _dmTable =
                    OfflineHelper.TableListToDataTable(
                        Helpers.EnumerableExtension.ToList <DMTABLE_08_NOPIC_VIEW>(_dmTable), _dmTable.TableName);
                classBriefcase.AddTable(_dmTable);
                classBriefcase.WriteBriefcase();
                FormChooseClassParams.ChooseClassBriefcase = classBriefcase;
            }
        }
コード例 #3
0
        /// <summary>
        /// 下载课程的过程中比较费时的操作都在这个函数里面
        /// </summary>
        /// <param name="kkno">开课编号</param>
        /// <param name="courseBriefcase">该堂课要存的briefcase</param>
        private static void DownloadData(long kkno, Briefcase courseBriefcase)
        {
            Thread.Sleep(1000);//等待进度条窗口建立完毕

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetInfo("下载学生信息 \n 该过程可能会比较耗时")));

            var fDataModule = new DataModule();                     // 再新建一个datamodule..  好浪费资源的说 反正C#会自己做内存回收...

            var xktable = from c in fDataModule.GetxktableViewros() // 将选课表(学生信息)拿出来
                          where c.KKNO == kkno
                          select c;

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetInfo("下载学生信息 \n 该过程会耗时30秒左右")));  // 更改等待窗口的文字

            var xkDatatable = EnumerableExtension.ListToDataTable(xktable.ToList(), "XKTABLE");     // 下载选课表

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetValue(20)));                      // 设置进度条 20

            courseBriefcase.AddTable(xkDatatable);                                                  // 将选课表加到briefcase中

            courseBriefcase.WriteBriefcase();                                                       // 写入硬盘

            var sktable = from c in fDataModule.GetSktable07Viewro() where c.KKNO == kkno select c; // 拉取上课表

            var dmtable = from c in fDataModule.GetdmTable() where c.KKNO == kkno select c;         //拉取选课表

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetInfo("下载课程信息 \n 该过程不会消耗太长时间")));

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetValue(50)));

            var sktableList = sktable.ToList();                                            // 下载上课表

            var skdatatable = EnumerableExtension.ListToDataTable(sktableList, "SKTABLE"); //将上课表转换成datatable

            courseBriefcase.AddTable(skdatatable);                                         // 将datatable写入briefcase中

            courseBriefcase.WriteBriefcase();                                              // 写入硬盘

            _waitform.Invoke(new MethodInvoker(() => _waitform.SetInfo("下载考勤信息 \n 该过程不会消耗太长时间")));

            var dmtableList = dmtable.ToList(); // 下载点名表

            foreach (var sktable07Viewro in sktable)
            {
                var viewro = sktable07Viewro; // resharper说一定要这么写

                var dmtablesinglelist = from c in dmtableList where c.SKNO == viewro.SKNO select c;

                var dmtableSingleDatatable = EnumerableExtension.ListToDataTable(dmtablesinglelist.ToList(),
                                                                                 sktable07Viewro.SKNO.ToString(CultureInfo.InvariantCulture)); // 将list转换成datatable

                courseBriefcase.AddTable(dmtableSingleDatatable);

                _waitform.Invoke(new MethodInvoker(() => _waitform.Increase(1)));    // 每次下载都在进度条上加1
            }

            courseBriefcase.WriteBriefcase(); // 保存将对briefcase的更改写入硬盘

            var classInfoTable = courseBriefcase.FindTable("ClassInfo");

            //以下注释的代码作为参考用.
            //courseInfoTable.Columns.Add ("上课编号", typeof (string));

            //courseInfoTable.Columns.Add ("上课日期", typeof (string));

            //courseInfoTable.Columns.Add ("上课状态", typeof (string));

            foreach (var sktable07Viewro in sktableList)
            {
                var viewro = sktable07Viewro;                                              //resharper说要这么写

                var classInfoRow = classInfoTable.NewRow();                                //新建一行

                classInfoRow["上课编号"] = viewro.SKNO.ToString(CultureInfo.InvariantCulture); //指定这一行的上课编号

                classInfoRow["上课日期"] = viewro.YDSKDATE.ToString();                         //指定这一行的上课日期

                if (viewro.SKZT == 0)                                                      //将上课状态转换成文字

                {
                    classInfoRow["上课状态"] = "未签到";
                }
                else
                {
                    classInfoRow["上课状态"] = "已签到";
                }

                classInfoTable.Rows.Add(classInfoRow);//将这一行加到datatable里
            }

            courseBriefcase.AddTable(classInfoTable);//将datatable加到briefcase里

            courseBriefcase.WriteBriefcase();

            _waitform.Invoke(new MethodInvoker(() => _waitform.Close()));   //关闭进度窗口
        }