예제 #1
0
        public BrokenRuleInfo(DeductionRule deductionRule)
        {
            if (deductionRule == null)
            {
                throw new ArgumentNullException("deductionRule");
            }

            DeductionRule = deductionRule;
            BreakTime     = DateTime.Now;
        }
예제 #2
0
 private void dataGridViewDeduction_Click(object sender, EventArgs e)
 {
     if (dataGridViewDeduction.SelectedRows.Count > 0)
     {
         SelectedRule = dataGridViewDeduction.SelectedRows[0].DataBoundItem as DeductionRule;
     }
     else
     {
         SelectedRule = null;
     }
 }
예제 #3
0
        public void BreakeRule(ExamMessage message)
        {
            var _deductionRule = new DeductionRule();

            _deductionRule.ExamItemName   = message.DeductionRule.ExamItemName;
            _deductionRule.RuleName       = message.DeductionRule.DeductedReason;
            _deductionRule.DeductedScores = message.DeductionRule.DeductedScores;

            //扣分还要更新分数
            _deductionRules.Insert(0, _deductionRule);
            ruleBindingSource         = new BindingSource(_deductionRules, "");
            dgvDeductRules.DataSource = ruleBindingSource;
            dgvDeductRules.Refresh();

            //收到扣分就需要更新分数
            var status = message.IsPreliminaryExam ? "初考" : "补考";

            lblNameStatusScore.Text = string.Format("姓名:{0}   状态:{1}   成绩:{2}分", message.ExamStudent.Name, status, message.Score);
        }
예제 #4
0
        /// <summary>
        /// 如果是通过项目
        /// </summary>
        /// <param name="cmdType"></param>
        public void SendMessage(CmdTypeEnum cmdType, ExamItemEnum ExamItem = ExamItemEnum.CommonExamItem, DeductionRule rule = null)
        {
            if (CurrentExamCar == null)
            {
                MessageBox.Show("请分配考生", "监考大厅");
                return;
            }
            ExamMessage message = new ExamMessage();

            //我其实是依赖与这个给考生赋值
            message.ExamStudent = CurrentExamCar.ExamStudent;
            if (cmdType != CmdTypeEnum.SendExamStudentInfo)
            {
                message.ExamStudent.IDCardImage = null;
            }
            if (cmdType == CmdTypeEnum.SendExamStudentInfo)
            {
                //如果照片被清空 直接取指定路径读取照片
                if (message.ExamStudent.IDCardImage == null)
                {
                    //直接还思路
                    message.ExamStudent.IDCardImage = GetIDCardByte();
                }
            }
            //直接再界面取怎么样?
            message.SendTime = DateTime.Now;
            message.CmdType  = cmdType;
            message.ExamItem = ExamItem;

            if (cmdType == CmdTypeEnum.BreakeRule)
            {
                //发送扣分
                message.DeductionRule                = new ExamMessageDeductionRule();
                message.DeductionRule.ExamItemId     = rule.ExamItemId;
                message.DeductionRule.RuleCode       = rule.RuleCode;
                message.DeductionRule.RuleName       = rule.RuleName;
                message.DeductionRule.ExamItemName   = rule.ExamItemName;
                message.DeductionRule.SubRuleCode    = rule.SubRuleCode;
                message.DeductionRule.DeductedScores = rule.DeductedScores;
            }
            // message.DeductionRule = rule;

            var msg = JsonConvert.SerializeObject(message);

            //消息以Upd的行驶发出去
            //
            //todo:我终于也用上了GitHub了
            //todo:这个还是需要考虑进行优化的
            //todo:可以考虑是用框架 看看性能各方面如何
            this.udpCarSignalSeedV4.SocketSend(msg, Position);
            //  udpServer.Send(msg, CurrentExamCar.Ip, CurrentExamCar.Port);
        }
예제 #5
0
 private void btnExit_Click(object sender, EventArgs e)
 {
     SelectedRule = null;
     this.Close();
 }
예제 #6
0
        /// <summary>
        /// 如果是通过项目
        /// </summary>
        /// <param name="cmdType"></param>
        public void SendMessage(CmdTypeEnum cmdType, ExamItemEnum ExamItem = ExamItemEnum.CommonExamItem, DeductionRule rule = null)
        {
            if (CurrentExamCar == null)
            {
                MessageBox.Show("请分配考生", "监考大厅");
                return;
            }
            ExamMessage message = new ExamMessage();

            message.ExamStudent = CurrentExamCar.ExamStudent;

            message.SendTime = DateTime.Now;
            message.CmdType  = cmdType;
            message.ExamItem = ExamItem;

            if (message.CmdType == CmdTypeEnum.BreakeRule)
            {
                //发送扣分
                message.DeductionRule                = new ExamMessageDeductionRule();
                message.DeductionRule.ExamItemId     = rule.ExamItemId;
                message.DeductionRule.RuleCode       = rule.RuleCode;
                message.DeductionRule.RuleName       = rule.RuleName;
                message.DeductionRule.ExamItemName   = rule.ExamItemName;
                message.DeductionRule.SubRuleCode    = rule.SubRuleCode;
                message.DeductionRule.DeductedScores = rule.DeductedScores;
            }
            // message.DeductionRule = rule;

            var msg = JsonConvert.SerializeObject(message);

            //消息以Upd的行驶发出去
            udpServer.Send(msg, CurrentExamCar.Ip, CurrentExamCar.Port);
        }