コード例 #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            timer1.Stop();

            if (!string.IsNullOrEmpty(BuzzPressTeamlbl.Text))
            {
                int questionnid = Convert.ToInt32(questionidlabel.Text);
                int LevelId     = Convert.ToInt32(Level.Split(',')[1]);
                int RoundId     = Convert.ToInt32(Round.Split(',')[1]);

                var checkforattamt = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId &&
                                                                              x.QuestionId == questionnid && x.AcademicYear == Program.CurrAcademicYear).ToList();

                if (checkforattamt.Count() == 0)
                {
                    AttamtedQuestions attamtedQuestions = new AttamtedQuestions();
                    attamtedQuestions.QuestionId   = Convert.ToInt32(questionidlabel.Text);
                    attamtedQuestions.LevelId      = Convert.ToInt32(Level.Split(',')[1]);
                    attamtedQuestions.RoundId      = Convert.ToInt32(Round.Split(',')[1]);
                    attamtedQuestions.Marks        = 20;
                    attamtedQuestions.TeamId       = _quizTeamService.GetAll().Where(x => x.Name == BuzzPressTeamlbl.Text).Select(x => x.Id).FirstOrDefault();
                    attamtedQuestions.TeamName     = BuzzPressTeamlbl.Text;
                    attamtedQuestions.AcademicYear = AcademicYearlabel.Text;
                    attamtedQuestions.IsTrue       = true;
                    attamtedQuestions.CreatedBy    = "Admin";
                    attamtedQuestions.CreatedDate  = DateTime.Now;

                    _attamtedQuestionsService.Add(attamtedQuestions);
                    _attamtedQuestionsService.Save();

                    QuizTeam quizTeam = _quizTeamService.FindBy(x => x.Id == attamtedQuestions.TeamId).FirstOrDefault();
                    quizTeam.Marks += attamtedQuestions.Marks;

                    _quizTeamService.Edit(quizTeam);
                    _quizTeamService.Save();

                    SuccessForm success = new SuccessForm();
                    success.Text = "Correct answer";
                    success.ShowDialog();

                    CalculateMarks();
                }
                else
                {
                    MessageBox.Show("You have already attempted this question, please go to next question", "Alert");
                }
            }
            else
            {
                MessageBox.Show("Please select team name", "Alert");
            }
        }
コード例 #2
0
        private void Rightbtn_Click(object sender, EventArgs e)
        {
            timer1.Stop();

            int questionnid = Convert.ToInt32(questionidlabel.Text);
            int LevelId     = Convert.ToInt32(Level.Split(',')[1]);
            int RoundId     = Convert.ToInt32(Round.Split(',')[1]);

            var checkforattamt = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId &&
                                                                          x.QuestionId == questionnid && x.AcademicYear == Program.CurrAcademicYear).ToList();

            if (checkforattamt.Count() == 0)
            {
                AttamtedQuestions attamtedQuestions = new AttamtedQuestions();
                attamtedQuestions.QuestionId   = Convert.ToInt32(questionidlabel.Text);
                attamtedQuestions.LevelId      = Convert.ToInt32(Level.Split(',')[1]);
                attamtedQuestions.RoundId      = Convert.ToInt32(Round.Split(',')[1]);
                attamtedQuestions.Marks        = 5 * Convert.ToInt32(CorrectcounttextBox.Text);
                attamtedQuestions.TeamId       = _quizTeamService.GetAll().Where(x => x.Name == TeanNamelabel.Text).Select(x => x.Id).FirstOrDefault();
                attamtedQuestions.TeamName     = TeanNamelabel.Text;
                attamtedQuestions.AcademicYear = AcademicYearlabel.Text;
                attamtedQuestions.IsTrue       = true;
                attamtedQuestions.CreatedBy    = "Admin";
                attamtedQuestions.CreatedDate  = DateTime.Now;

                _attamtedQuestionsService.Add(attamtedQuestions);
                _attamtedQuestionsService.Save();

                SuccessForm success = new SuccessForm();
                success.Text = "Correct answer";
                success.ShowDialog();

                CalculateMarks();
            }
            else
            {
                MessageBox.Show("You have already attempted this question, please go to next question", "Alert");
            }
        }
コード例 #3
0
 private void tbOrderAuthCode_TextChanged(object sender, System.EventArgs e)
 {
     if (this.tbOrderAuthCode.Text.Length == 5)
     {
         this.lbMessage.Text = string.Empty;
         if (this.m_regHelper.CheckOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId, this.tbOrderAuthCode.Text) != ResponseReuslt.SUCCESS)
         {
             this.lbMessage.Text = "验证码输入错误";
             this.tbOrderAuthCode.Text = string.Empty;
             this.pbAuthCode.Image = this.m_regHelper.GetOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId);
             return;
         }
         this.lbMessage.Text = "提交中...";
         OrderSuccessInfo orderSuccessInfo = this.m_regHelper.OrderSave(this.m_orderPost + "code=" + this.tbOrderAuthCode.Text);
         if (orderSuccessInfo.ResResult != ResponseReuslt.SUCCESS)
         {
             this.lbMessage.Text = "验证码校验失败";
             this.tbOrderAuthCode.Text = string.Empty;
             this.pbAuthCode.Image = this.m_regHelper.GetOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId);
             return;
         }
         base.Hide();
         this.lbMessage.Text = "提交成功";
         SuccessForm successForm = new SuccessForm(orderSuccessInfo);
         successForm.ShowDialog();
         successForm.Dispose();
         base.Close();
     }
 }