Esempio n. 1
0
        public IHttpActionResult Set(Evalution evalution)
        {
            //拿已登入的流水
            string      token       = Request.Headers.Authorization.Parameter;
            JwtAuthUtil jwtAuthUtil = new JwtAuthUtil();
            string      userseq     = jwtAuthUtil.Getuserseq(token);

            string user = userseq.Substring(0, 1);

            if (user == "C")
            {
                return(Ok(new
                {
                    result = "廠商無法評價"
                }));
            }

            evalution.del_flag = "N";
            evalution.postday  = DateTime.Now;
            ModelState.Clear();
            Validate(evalution);

            db.Evalution.Add(evalution);
            db.SaveChanges();
            return(Ok(new
            {
                result = "評價完成"
            }));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Evalution evalution = db.Evalutions.Find(id);

            db.Evalutions.Remove(evalution);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 protected override void ExecuteOperation(IEntity entity)
 {
     foreach (var item in students)
     {
         Evalution e = (Evalution)entity;
         e.Student       = item;
         item.Evalutions = repository.GetAll(e).Cast <Evalution>().ToList();
     }
 }
        public async Task <bool> Evalute(string projectId, Evalution evalution)
        {
            var EvaluatedProject = await _NoDb.FindAsync(projectId, projectId);

            EvaluatedProject.Evalution = evalution;
            var result = await _NoDb.UpdateAsync(EvaluatedProject);

            return(result.IsSuccess);
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ID,S_Desc,I_CREATE_UID,I_EVT_ID,I_Type,I_Course_ID,TIME_CREATE,F_Score,C_STA,F_TeachObj,F_TeachMethod,F_TeachAbility,F_TeachAttitude,F_StudentRelation")] Evalution evalution)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evalution).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(evalution));
 }
        public async Task <IActionResult> Evalution([FromRoute] string projectId, [FromForm] Evalution evalution)
        {
            if (ModelState.IsValid)
            {
                var result = await _superVisor.Evalute(projectId, evalution);

                if (result)
                {
                    return(Ok(new { status = 1, message = "evaluted successfully" }));
                }
                return(BadRequest(new { status = 0, message = "evaluted failed" }));
            }
            return(BadRequest(new { status = 0, message = "invalid request" }));
        }
Esempio n. 7
0
        // GET: Evalutions/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Evalution evalution = db.Evalutions.Find(id);

            if (evalution == null)
            {
                return(HttpNotFound());
            }
            return(View(evalution));
        }
        private void btnFinish_Click(object sender, EventArgs e)
        {
            int sumPoint = 0;

            foreach (Control cPnl in this.Controls)
            {
                if (cPnl is Panel)
                {
                    foreach (Control cLbl in ((Panel)cPnl).Controls)
                    {
                        if (cLbl is Label)
                        {
                            Question ques = db.Questions.FirstOrDefault(q => q.MainQuestion == ((Label)cLbl).Text);
                            foreach (Control CRb in ((Panel)cPnl).Controls)
                            {
                                if (CRb is RadioButton)
                                {
                                    if (((RadioButton)CRb).Checked && ques.CorrrectAnswer == CRb.Text)
                                    {
                                        sumPoint += 10;
                                    }
                                    else
                                    {
                                        sumPoint += 0;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            double?avg = db.Grades.Where(g => g.StudentID == currentStu.ID && g.LessonID == currentLesson.ID).Select(g => g.Point).Average();


            Evalution newEval = new Evalution
            {
                StudentID       = currentStu.ID,
                LessonID        = currentLesson.ID,
                AfeterExamPoint = sumPoint,
                BeforeExamPoint = (int)(avg * 5)
            };

            db.Evalutions.Add(newEval);
            db.SaveChanges();
            MessageBox.Show($"Your final exam point is {sumPoint}");
            this.Close();
        }
        public void ShowUserFinalResult()
        {
            Evalution currentUserEval = db.Evalutions.FirstOrDefault(e => e.StudentID == currentStu.ID && e.LessonID == slctdLesson.ID);

            if (currentUserEval == null)
            {
                btnGoToExam.Enabled = true;
                lblFinalResult.Text = $"You not finish the exam from {slctdLesson.Name} yet.";
            }
            else
            {
                btnGoToExam.Enabled = false;
                if (currentUserEval.AfeterExamPoint < 17 || currentUserEval.AfeterExamPoint + currentUserEval.BeforeExamPoint < 51)
                {
                    lblFinalResult.Text = $"Your current final result is {currentUserEval.BeforeExamPoint} + {currentUserEval.AfeterExamPoint} = {currentUserEval.BeforeExamPoint + currentUserEval.AfeterExamPoint}.(Fail)";
                }
                else
                {
                    lblFinalResult.Text = $"Your current final result is {currentUserEval.BeforeExamPoint} + {currentUserEval.AfeterExamPoint} = {currentUserEval.BeforeExamPoint + currentUserEval.AfeterExamPoint}.(Pass)";
                }
            }
        }
        internal void ValueChanged(DataGridViewCellEventArgs e, DataGridView dgvGradeStudent, ComboBox cbClassificationPeriod)
        {
            Evalution evalution = new Evalution()
            {
                Student = GetValueDGV(0, e.RowIndex, dgvGradeStudent) as Student,
                ClassificationPeriod = (ClassificationPeriod)cbClassificationPeriod.SelectedItem,
                GradeType            = SetGradeType(e.ColumnIndex),
                Grade   = (Grades)dgvGradeStudent[e.ColumnIndex, e.RowIndex].Value,
                Subject = schoolClass.Students[0].CurrentSubject
            };

            switch (e.ColumnIndex)
            {
            case 1:
                if (oralEvalutions.Any(ev => ev.Student.Id == evalution.Student.Id))
                {
                    oralEvalutions.Remove(oralEvalutions.ToList().Single(ev => ev.Student.Id == evalution.Student.Id));
                }
                oralEvalutions.Add(evalution);
                break;

            case 2:
                if (controlEvalutions.Any(ev => ev.Student.Id == evalution.Student.Id))
                {
                    controlEvalutions.Remove(controlEvalutions.ToList().Single(ev => ev.Student.Id == evalution.Student.Id));
                }
                controlEvalutions.Add(evalution);
                break;

            case 3:
                if (writtenEvalutions.Any(ev => ev.Student.Id == evalution.Student.Id))
                {
                    writtenEvalutions.Remove(writtenEvalutions.ToList().Single(ev => ev.Student.Id == evalution.Student.Id));
                }
                writtenEvalutions.Add(evalution);
                break;
            }
        }
Esempio n. 11
0
        public ActionResult PutAssessment([Bind(Include = "ID,S_Desc,I_CREATE_UID,I_EVT_ID,I_Type,I_Course_ID,TIME_CREATE,F_Score,C_STA,F_TeachObj,F_TeachMethod,F_TeachAbility,F_TeachAttitude,F_StudentRelation")] Evalution evalution)
        {
            // 测试队列
            //MsList ms = new MsList();

            //ms.Add(new MsItem("Post过来的数据", assessment)); // 测试完成,数据到达!

            try
            {
                if (ModelState.IsValid)
                {
                    //准备查找评价表 为修改评价表中分值做准备

                    IQueryable <EvalutionForm> _ef = null;
                    //准备查找课程模板表 为修课程模板表中分值做准备
                    IQueryable <CourseTemp> _ct = null;

                    //1)查看是否有记录 用户是都已经评价过此评价表
                    IQueryable <Evalution> _al = db.Evalutions.AsNoTracking().Where(x => x.I_EVT_ID == evalution.I_EVT_ID && x.I_CREATE_UID == evalution.ID) as IQueryable <Evalution>;

                    if (_al.Count() > 0)
                    {//如果记录中有匹配的记录 1>0的  那就修改
                        evalution.ID = _al.FirstOrDefault().ID;
                        db.Entry(evalution).State = EntityState.Modified;

                        //测试数据 有匹配的记录 评价表
                        //ms.Add(new MsItem("有匹配的记录评价表", assessment));
                    }
                    else
                    {//如果记录中没有匹配的记录 0!>0的
                        db.Evalutions.Add(evalution);
                        //测试数据 没有匹配的记录 评价表
                        //ms.Add(new MsItem("没有匹配的记录的记录评价表", assessment));
                    }



                    //修改评价表中的分值
                    //查找评价表
                    _ef = db.EvalutionForms.Where(x => x.ID == evalution.I_EVT_ID).AsNoTracking().Take(1) as IQueryable <EvalutionForm>;


                    //取出用户评价的评价表对象
                    EvalutionForm ef = _ef.FirstOrDefault();

                    //测试数据查找评价表
                    //ms.Add(new MsItem("测试数据 查找的评价表", ef));

                    //执行操作 存入评价
                    db.SaveChanges();



                    //2) 修改分数  如果不能保存 若没有人评价 则没有评价记录就不用查找了 算分等。。

                    //查找出多少人提交了对ef 此评价表的 评价
                    IQueryable <Evalution> _ae = db.Evalutions.AsNoTracking().Where(x => x.I_EVT_ID == ef.ID) as IQueryable <Evalution>;
                    if (_ae.Count() > 0)
                    {
                        //记录人数
                        int eNum = _ae.Count();

                        //TSET: 记录人数
                        //ms.Add(new MsItem("TSET:提交了对ef 此评价表的人数", eNum));

                        //TSET: 所有给评价表评价的评价记录
                        //ms.Add(new MsItem("TSET:所有给评价表评价的评价记录", _ae.ToList()));
                        //清空从新计算
                        ef.F_Score = 0;
                        //遍历 所有给评价表评价的评价记录
                        foreach (Evalution a in _ae.ToList())
                        {
                            ef.F_Score += a.F_Score;
                        }


                        //取平均
                        ef.F_Score = (ef.F_Score / eNum);
                        //TSET: 取平均
                        //ms.Add(new MsItem("TSET: 评价表取平均", ef.score));
                    }



                    _ct = db.CourseTemps.AsNoTracking().Where(x => x.ID == evalution.I_Course_ID).Take(1) as IQueryable <CourseTemp>;
                    //取出用户评价的 课程模板表对象
                    CourseTemp ct = _ct.FirstOrDefault();

                    //TSET: 取出课程模板表对象
                    //ms.Add(new MsItem("TSET:取出课程模板表对象", ct));

                    //查找出多少人提交了对ed 此对象 评价表的 评价
                    IQueryable <Evalution> _ac = db.Evalutions.AsNoTracking().Where(x => x.I_Course_ID == ct.ID) as IQueryable <Evalution>;
                    //记录人数
                    if (_ct.Count() > 0)
                    {
                        int cNum = _ac.Count();


                        //TSET: cNum
                        //ms.Add(new MsItem("TSET:cNum", cNum));

                        //清空从新计算
                        ct.F_Score = 0;
                        foreach (Evalution a in _ac.ToList())
                        {
                            ct.F_Score += a.F_Score;
                        }
                        //取平均
                        ct.F_Score = (ct.F_Score / cNum);
                        //TSET: 取平均
                        //ms.Add(new MsItem("TSET:ct取平均", ct.CourseScore));
                        //修改课程模板表分数
                        db.Entry(ct).State = EntityState.Modified;
                    }



                    //修改评价表分数
                    db.Entry(ef).State = EntityState.Modified;

                    db.SaveChanges();

                    //return Json(ms);
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.ToString()));
            }


            return(Json(true));
        }