/// <summary>
        ///
        /// </summary>
        /// <param name="kkno">开课编号</param>
        /// <param name="kkName">开课名称</param>
        /// <param name="skno">上课编号</param>
        /// <param name="dateTime">上课时间</param>
        /// <returns></returns>
        public static string GenerateConfirmString(long kkno, string kkName, long skno, string dateTime)
        {
            const string basestring = "开课编号:{0}\n开课名称:{1}\n上课时间:{2}\n正常到课:{3} 迟到:{4} 旷课:{5} 早退:{6} ";

            var dmList = OfflineDataControl.GetDmtable(kkno, skno);  // 这已经是List了... 我干了什么...

            var ztrs = OfflineDataControl.CountLeaveEarlyStudent(dmList);

            var zcrs = OfflineDataControl.CountNormalStudent(dmList);

            var cdrs = OfflineDataControl.CountLateStudent(dmList);

            var kkrs = OfflineDataControl.CountAbsentStudent(dmList);

            return(string.Format(basestring, kkno, kkName, dateTime, zcrs, cdrs, kkrs, ztrs));
        }
        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);
        }
        /// <summary>
        /// 上传一节课.
        /// </summary>
        /// <param name="kkno">开课编号</param>
        /// <param name="skno">上课编号</param>
        public static void UploadOneClass(long kkno, long skno)
        {
            //todo:这个东西要重写

            //1.根据KKNo找到本地的Briefcase. 因为之前都查过了 所以这里就不用做Briefcase的检查了.  直接拉Briefcase过来饥渴.
            //2.根据skno在Briefcase中获取点名表和上课表.
            //3.对于上课表的更改, 直接在服务器上找到那节课对应的记录 然后改 然后上传即可.
            //4.todo:如果需要更新指纹信息,则需要再开启一个函数,用来更新指纹信息.

            //下面这个东西直接往数据库里塞就行

            var fDataModule = new DataModule();



            try {
                var verifyList = from c in fDataModule.GetJsandkkviewro() where c.KKNO == kkno select c;

                verifyList.Count(); // 败笔.  数一下就知道登录是否正确了.
            } catch (RemObjects.SDK.Exceptions.SessionNotFoundException) {
                MsgBox.ShowMsgBoxDialog("登录异常");
            }

            var dmList = OfflineDataControl.GetDmtable(kkno, skno); // 这已经是List了... 我干了什么...

            foreach (var dmlistRecord in dmList)
            {
                dmlistRecord.POSTDATE = DateTime.Now;

                dmlistRecord.POSTMANNO = Convert.ToInt64(Properties.Settings.Default.UserId);

                if (dmlistRecord.DKZT == 5)//如果是未签到 将其改成旷课
                {
                    dmlistRecord.DKZT = 3;
                }

                fDataModule.UpdateDmRow(dmlistRecord);
            }

            _waitForm = new WaitForm("准备上传点名信息");

            new Thread(() => {
                Thread.Sleep(1000);

                _waitForm.BeginInvoke(new MethodInvoker(() => {
                    _waitForm.SetInfo("正在上传点名信息");

                    _waitForm.SetValue(30);
                }));

                fDataModule.ApplyChanges();  //需要将该操作放到线程中.

                _waitForm.BeginInvoke(new MethodInvoker(() => {
                    _waitForm.SetInfo("点名信息上传完成");

                    _waitForm.SetValue(45);

                    _waitForm.Close(); // 关闭进度条框
                }));
            }).Start();

            _waitForm.ShowDialog();

            var skrecordList = OfflineDataControl.GetSktable(kkno);                        // 将来需要把这个拿来更新上课表

            var skrecord = (from c in skrecordList where c.SKNO == skno select c).First(); // linq  完了以后把第一条记录取出来(一共就有一条记录.)

            var ztrs = OfflineDataControl.CountLeaveEarlyStudent(dmList);

            var zcrs = OfflineDataControl.CountNormalStudent(dmList);

            var cdrs = OfflineDataControl.CountLateStudent(dmList);

            var kkrs = OfflineDataControl.CountAbsentStudent(dmList);

            skrecord.ZTRS = Convert.ToInt16(ztrs);                                    // 设置早退人数

            skrecord.ZCRS = Convert.ToInt16(zcrs);                                    // 设置正常出勤人数

            skrecord.KKRS = Convert.ToInt16(kkrs);                                    // 设置旷课人数

            skrecord.CDRS = Convert.ToInt16(cdrs);                                    //设置迟到人数

            skrecord.EDITDATE = DateTime.Now;                                         // 设置编辑时间

            skrecord.EDITMANNO = Convert.ToInt64(Properties.Settings.Default.UserId); // 设置编辑人员ID

            skrecord.SKZT = 1;                                                        //已经点名

            skrecord.DMFS = 1;

            fDataModule.UpdateSkTableRow(skrecord); // 上传上课信息.

            fDataModule.ApplyChanges();             //需要将该操作放到线程中.

            //再下载一遍上课表 该操作将会刷新PropertiesBriefcase中的ClassInfo表.

            _waitForm = new WaitForm("正在同步课程信息");

            new Thread(() => {
                Thread.Sleep(1000);

                _waitForm.BeginInvoke(new MethodInvoker(() => _waitForm.SetValue(70)));

                DataDownloadControl.SaveSkTable(kkno, skno, skrecord);

                _waitForm.BeginInvoke(new MethodInvoker(() => _waitForm.Close()));
            }).Start();

            _waitForm.ShowDialog();
        }
Esempio n. 5
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);
        }