Beispiel #1
0
        private void TralAction()
        {
            if (TimeCounts > 60)
            {
                int _timeCount = TimeCounts - 60;
                //不需要提示和弹窗,并且未查询填写情况
                int h, m, s;
                h = 0;
                m = 0;
                s = _timeCount % 60;
                if (_timeCount > 60)
                {
                    m = _timeCount / 60;
                    if (m > 60)
                    {
                        h = m / 60;
                        m = m % 60;
                    }
                }
                string timeTipStr = "";
                if (h > 0)
                {
                    timeTipStr = h.ToString() + "小时"+ m.ToString() + "分钟" + s + "秒";
                }
                else
                {
                    if (m > 0)
                    {
                        timeTipStr = timeTipStr + m.ToString() + "分钟" + s + "秒";
                    }
                    else
                    {
                        timeTipStr = timeTipStr + s + "秒";
                    }
                }
                this.ServiceStatus.Text = "当前不需要填写," + timeTipStr + "后查询服务器";
            }
            else
            {
                if (TimeCounts == 60)
                {
                    this.ServiceStatus.Text = "正在查询服务器信息,当前不可操作.....";
                    Proxy = ChannelFactory.CreateChannel();
                    expRecordWithFlag = Proxy.GetExpRecordWithFlag(Properties.Settings.Default.LabID);
                    //初始化填写窗口
                    switch (expRecordWithFlag.SignFlag)
                    {
                        case 0: //无课,不需填写
                            isSign = true;
                            this.ServiceStatus.Text = "当前无课,不需填写!";
                            break;
                        case 1: //已经填写
                            isSign = true;
                            this.ServiceStatus.Text = "已经填写本次实验记录!";
                            break;
                        case 2: //需要核对
                            isSign = false;
                            this.ServiceStatus.Text = "等待" + TimeCounts.ToString() + "秒后核对记录!";
                            SetForm(expRecordWithFlag.ExpRecord);
                            break;
                        case 3: //新填写
                            isSign = false;
                            this.ServiceStatus.Text = "等待" + TimeCounts.ToString() + "秒后填写记录!";
                            SetForm(expRecordWithFlag.ExpRecord);
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    if (!isSign)
                    {
                        //需要填写
                        if (TimeCounts > 30)
                        {
                            //初始化填写窗口
                            switch (expRecordWithFlag.SignFlag)
                            {
                                case 2: //需要核对
                                    this.ServiceStatus.Text = "等待" + TimeCounts.ToString() + "秒后核对记录!";
                                    break;
                                case 3: //新填写
                                    this.ServiceStatus.Text = "等待" + TimeCounts.ToString() + "秒后填写记录!";
                                    break;
                                default:
                                    break;
                            }
                        }
                        else
                        {
                            //0-30秒内
                            switch (expRecordWithFlag.SignFlag)
                            {
                                case 2: //需要核对
                                    this.ServiceStatus.Text = "等待核对记录!";
                                    break;
                                case 3: //新填写
                                    this.ServiceStatus.Text = "等待填写记录!";
                                    break;
                                default:
                                    break;
                            }

                            if (this.Visibility == Visibility.Hidden || this.WindowState == WindowState.Minimized)
                            {
                                if (tipWindow == null)
                                {
                                    tipWindow = new TipWindow(this);
                                }
                                tipWindow.timeTip.Text = TimeCounts.ToString();
                                if (TimeCounts > 0)
                                {
                                    //初始化填写窗口
                                    switch (expRecordWithFlag.SignFlag)
                                    {
                                        case 2: //需要核对
                                                tipWindow.windowUpAnimation("当前记录信息不一致,距离核对记录还有:", "立刻核对");
                                            break;
                                        case 3: //新填写
                                                tipWindow.windowUpAnimation("距离填写本次实验记录还有", "立刻填写");
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                else
                                {
                                    //TimeCounts == 0
                                    this.Visibility = Visibility.Visible;
                                    this.Show();
                                    tipWindow.Hide();
                                }
                            }

                            if (TimeCounts == 0)
                            {
                                TimeCounts++;
                            }

                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取当前时间实验是否需要填写
        /// </summary>
        /// <param name="labID">实验室ID</param>
        /// <returns>带填写标识的记录</returns>
        public ExpRecordWithFlag GetExpRecordWithFlag(int labID)
        {
            ExpRecordWithFlag expFlag = new ExpRecordWithFlag();
            int signFlag = 0;
            Exprecord expRecord = new Exprecord();
            using (JszxDataManager jszxDateManage = new JszxDataManager())
            {
                //当前课节
                ClassTime ct = GetCurrentClassTime();

                if (ct == null)
                {
                    //当前不在上课时间,返回空的待填实验记录
                    signFlag = 0;
                }
                else
                {
                    //在上课时间,判断当前是否有课
                    //当前学期
                    Term tm = GetCurrentTerm();
                    //当前周次
                    int wk = GetCurrentWeeks();
                    //当前工作日
                    int weekDay = GetCurrentWeekDay();

                    schedule_tb scd_tb = jszxDateManage.GetScheduleByCls(labID, tm.TermID, wk, weekDay, ct.ClsTmIndex);

                    if (scd_tb == null)
                    {
                        //没课,不需要填写
                        signFlag = 0;
                        expRecord = null;
                    }
                    else
                    {
                        //有课
                        //查询是否填写

                        exprecords_tb exp_tb = jszxDateManage.GetExprecordByCls(labID, tm.TermID, wk, weekDay, ct.ClsTmIndex);
                        if (exp_tb == null)
                        {
                            //未填写
                            signFlag = 3;
                            //未填写,构建实验记录,返回填写
                            expRecord.CourseName = scd_tb.courses_tb.CrsName;
                            expRecord.ExpClasses = scd_tb.courses_tb.CrsClasses;
                            expRecord.ExpCls = (sbyte?)scd_tb.ScdClass;
                            expRecord.ExpDate = DateTime.Now;
                            expRecord.ExpLab = scd_tb.labs_tb.LabName;
                            expRecord.ExpLabID = scd_tb.ScdLab;
                            expRecord.ExpName = "";
                            expRecord.ExpTerm = scd_tb.ScdTerm;
                            expRecord.ExpWeek = scd_tb.ScdWeek;
                            expRecord.ExpWeekDay = scd_tb.ScdWeekDay;
                            expRecord.Groups = scd_tb.courses_tb.CrsNum;
                            expRecord.InstrumentStatus = "正常";
                            expRecord.PerGroup = 1;
                            expRecord.Problems = "无";
                            expRecord.Realizer = scd_tb.courses_tb.CrsNum;
                            expRecord.Shoulder = scd_tb.courses_tb.CrsNum;
                            expRecord.StudentStatus = "良好";
                            expRecord.TeacherName = scd_tb.courses_tb.CrsTeacher;
                            expRecord.StudentName = "";
                            expRecord.TeacherNumber = "";
                            //expRecord.PostTime =

                        }
                        else
                        {
                            //已经填写
                            if (exp_tb.CourseName == scd_tb.courses_tb.CrsName)
                            {
                                //课程名称相同,判断为正确的记录
                                expRecord = null;
                                signFlag = 1;
                            }
                            else
                            {
                                //课程名称不相同,错误的填写记录
                                signFlag = 2;

                                //返回待确认记录
                                //未填写,构建实验记录,返回填写
                                expRecord.CourseName = exp_tb.CourseName;
                                expRecord.ExpClasses = exp_tb.ExpClasses;
                                expRecord.ExpCls = exp_tb.ExpCls;
                                expRecord.ExpDate = exp_tb.ExpDate;
                                expRecord.ExpLab = exp_tb.ExpLab;
                                expRecord.ExpLabID = exp_tb.ExpLabID;
                                expRecord.ExpName = exp_tb.ExpName;
                                expRecord.ExpTerm = exp_tb.ExpTerm;
                                expRecord.ExpWeek = exp_tb.ExpWeek;
                                expRecord.ExpWeekDay = exp_tb.ExpWeekDay;
                                expRecord.Groups = exp_tb.Groups;
                                expRecord.InstrumentStatus = exp_tb.InstrumentStatus;
                                expRecord.PerGroup = exp_tb.PerGroup;
                                expRecord.Problems = exp_tb.Problems;
                                expRecord.Realizer = exp_tb.Realizer;
                                expRecord.Shoulder = exp_tb.Shoulder;
                                expRecord.StudentStatus = exp_tb.StudentStatus;
                                expRecord.TeacherName = exp_tb.TeacherName;
                                expRecord.StudentName = exp_tb.StudentName;
                                expRecord.TeacherNumber = exp_tb.TeacherNumber;
                                expRecord.PostTime = exp_tb.PostTime;
                            }
                        }
                    }
                }
            }
            expFlag.SignFlag = signFlag;
            expFlag.ExpRecord = expRecord;
            return expFlag;
        }