Exemplo n.º 1
0
        public async Task <IActionResult> Create(ScoreViewModel myModel)
        {
            var model  = new ScoreViewModel();
            var aModel = new List <StudentScore>();

            if (myModel.ClassId != null)
            {
                model.Students = await stu.GetAllByClassID(myModel.ClassId.Value);

                //assign students values to StudentsSubmit
                foreach (var item in model.Students)
                {
                    var st = new StudentScore()
                    {
                        StudentId = item.Id, FullName = item.FullName, Score = 0
                    };
                    aModel.Add(st);
                }
                model.StudentSubmit  = aModel;
                ViewData["CourseId"] = new SelectList(crs.CourseByClassId(myModel.ClassId.Value), "Id", "Name");
            }

            InitializeDropdownlist();
            return(View(model));
        }
        public void GetAvgWorldScores_Successful() // test is meant to succeed
        {
            StudentScore result = new StudentScore();

            result = testerObj.GetAvgWorldScores(valid_studentId);
            Assert.That(result, Is.TypeOf(typeof(StudentScore)));
        }
Exemplo n.º 3
0
        private static void LoadSerialData()
        {
            Stream streamBinary = new FileStream("binary.txt", FileMode.Open, FileAccess.ReadWrite);
            Stream streamSoap   = new FileStream("soap.txt", FileMode.Open, FileAccess.ReadWrite);

            IFormatter formatter;

            formatter = new BinaryFormatter();
            StudentScore ssBinary = formatter.Deserialize(streamBinary) as StudentScore;

            if (ssBinary != null)
            {
                DisplayInfo(ssBinary);
            }

            formatter = new SoapFormatter();
            StudentScore ssSoap = formatter.Deserialize(streamSoap) as StudentScore;

            if (ssSoap != null)
            {
                DisplayInfo(ssSoap);
            }

            streamSoap.Close();
            streamBinary.Close();
        }
        public ActionResult Edit(
            [Bind(
                 Include =
                     "Subject,LocalId,StudentId,FirstName,LastName,Score,AssessmentType,SchoolTerm,SchoolYear,AssessmentDesc,AssessmentId"
                 )] StudentScore studentScore)
        {
            try
            {
                dbTIREntities          db                = new dbTIREntities();
                SiteUser               siteUser          = ((SiteUser)Session["SiteUser"]);
                AssessmentScoreService assessmentService = new AssessmentScoreService(siteUser, db);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");

                tblAssessmentScore assscore =
                    db.tblAssessmentScores.Where(
                        k => k.AssessmentId == studentScore.AssessmentId && k.StudentId == studentScore.StudentId)
                    .ToList()
                    .FirstOrDefault();
                assscore.Score = studentScore.Score;

                assessmentService.UpdateStudentScore(assscore);
                return(RedirectToAction("Search", TempData["AssessmentModel"]));
                //  return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return(View("GeneralError"));
            }
        }
Exemplo n.º 5
0
        public void CreateGrade(GradeDto grade)
        {
            if (grade == null)
            {
                throw new ArgumentNullException(nameof(grade));
            }
            var gradeEntity = new Grade
            {
                Id             = grade.Id,
                Score          = grade.Score,
                DateOfTheGrade = grade.DateOfTheGrade
            };

            Add(gradeEntity);
            Commit();

            var studentScore = new StudentScore
            {
                GradeId   = gradeEntity.Id,
                StudentId = grade.StudentId
            };

            _studentScoreRepo.Add(studentScore);
            Commit();
        }
 public ActionResult Edit(int studentId, string schoolYear, string schoolTerm, string assessmentType, string assessmentDesc, string localId, string subject)
 {
     try
     {
         if (TempData["AssessmentModel"] != null)
         {
             TempData["AssessmentModel"] = TempData["AssessmentModel"];
         }
         dbTIREntities db       = new dbTIREntities();
         SiteUser      siteUser = ((SiteUser)Session["SiteUser"]);
         assScoreService = new AssessmentScoreService(siteUser, db);
         List <StudentScore> studentScores = assScoreService.GetStudentAssessmentScore(studentId, schoolYear, schoolTerm, assessmentType, assessmentDesc, localId, subject);
         StudentScore        score         = studentScores.FirstOrDefault();
         //StudentExt studentExt = studentService.GetStudentDetail(studentId, schoolYear);
         //PopulateViewData(studentExt);
         // ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");
         return(View(score));
     }
     catch (Exception ex)
     {
         Logging log = new Logging();
         log.LogException(ex);
         return(View("GeneralError"));
     }
 }
Exemplo n.º 7
0
        public void Read()
        {
            List <GradScoreRecord> GraduateScores = ReadGraduateScore();

            //讓每個學生先預設一個空的資料。
            foreach (StudentScore each in Students.Values)
            {
                each.GraduateScore.Clear();
            }

            //將有資料的學生填上資料。
            foreach (GradScoreRecord gradscore in GraduateScores)
            {
                if (!Students.ContainsKey(gradscore.RefStudentID))
                {
                    continue;
                }
                StudentScore student = Students[gradscore.RefStudentID];

                student.GraduateScore.RawScore = gradscore;
                foreach (GradDomainScore dscore in gradscore.Domains.Values)
                {
                    if (!student.GraduateScore.Contains(dscore.Domain))
                    {
                        student.GraduateScore.Add(dscore.Domain, new GraduateScore());
                    }

                    student.GraduateScore[dscore.Domain].Value  = dscore.Score;
                    student.GraduateScore[dscore.Domain].Weight = 1;                 //算術平均。
                }
                student.GraduateScore.LearnDomainScore = gradscore.LearnDomainScore; //學習領域。
                student.GraduateScore.CourseLearnScore = gradscore.CourseLearnScore; //課程學習。
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,StudentId,ScoreId")] StudentScore studentScore)
        {
            if (id != studentScore.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studentScore);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentScoreExists(studentScore.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ScoreId"]   = new SelectList(_context.Scores, "Id", "Id", studentScore.ScoreId);
            ViewData["StudentId"] = new SelectList(_context.Students, "Id", "Email", studentScore.StudentId);
            return(View(studentScore));
        }
Exemplo n.º 9
0
        public ClassExamScoreData(JHClassRecord cla)
        {
            Class = cla;
            //Students = cla.Students;
            Students          = new List <JHStudentRecord>();
            _StudentScoreDict = new Dictionary <string, StudentScore>();

            List <StudentScore> studentScores = new List <StudentScore>();

            foreach (JHStudentRecord student in cla.Students)
            {
                if (student.Status == K12.Data.StudentRecord.StudentStatus.一般 ||
                    student.Status == K12.Data.StudentRecord.StudentStatus.輟學)
                {
                    Students.Add(student);
                    studentScores.Add(new StudentScore(student));
                }
            }
            StudentScore.SetClassMapping();
            studentScores.ReadCalculationRule(null);
            _StudentScoreDict = new Dictionary <string, StudentScore>();
            foreach (var score in studentScores)
            {
                if (!_StudentScoreDict.ContainsKey(score.Id))
                {
                    _StudentScoreDict.Add(score.Id, score);
                }
            }

            Rows           = new StudentRows();
            ValidCourseIDs = new List <string>();
        }
Exemplo n.º 10
0
        private static void TransSerialData()
        {
            TcpClient     server    = new TcpClient("127.0.0.1", 7000);
            NetworkStream netStream = server.GetStream();

            StudentScore ssChoi = new StudentScore {
                Id = 2, Name = "최재규", Kor = 100, Math = 85, Eng = 90, RegDate = DateTime.Now
            };

            IFormatter   formatter = new SoapFormatter();
            MemoryStream memStream = new MemoryStream();

            formatter.Serialize(memStream, ssChoi);

            byte[] data     = memStream.GetBuffer();
            int    dataSize = (int)memStream.Length;

            byte[] totalSize = BitConverter.GetBytes(dataSize);

            netStream.Write(totalSize, 0, 4);
            netStream.Write(data, 0, dataSize);
            netStream.Flush();

            memStream.Close();
            netStream.Close();
            server.Close();
        }
Exemplo n.º 11
0
        public ActionResult DeleteConfirmed(long id)
        {
            StudentScore studentScore = db.StudentScores.Find(id);

            db.StudentScores.Remove(studentScore);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void Update(StudentScore studentScore)
 {
     using (var unitOfWork = _unitOfWorkFactory.GetCurrentUnitOfWork())
     {
         _studentScoreRepository.Edit(studentScore);
         unitOfWork.Commit();
     }
 }
Exemplo n.º 13
0
 public StudentRow(StudentScore studentScore)
 {
     RawScoreList    = new List <HC.JHSCETakeRecord>();
     CourseScoreList = new List <CourseScore>();
     CourseIDs       = new List <string>();
     Scores          = new FinalScores();
     RankResult      = new RankScore(decimal.Zero, null);
     StudentScore    = studentScore;
 }
Exemplo n.º 14
0
 public BoundaryValueTest()
 {
     _studentScore = new StudentScore();
     _students     = new List <Student>
     {
         new Student("4094W020"),
         new Student("4094W021"),
     };
 }
Exemplo n.º 15
0
 public StudentScoreProxy(StudentScore sc)
 {
     this.ScoreId      = sc.Id;
     this.Name         = sc.Student.FirstName_EN + " " + sc.Student.LastName_EN;
     this.ImageUrl     = sc.Student.ImageUrl;
     this.StudentId    = sc.Student.StudentId;
     this.Score        = sc.Score;
     this.CurriculumId = sc.CurriculumId;
 }
Exemplo n.º 16
0
 private static void DisplayInfo(StudentScore student)
 {
     Console.WriteLine($"학번: {student.Id}");
     Console.WriteLine($"이름: {student.Name}");
     Console.WriteLine($"국어: {student.Kor}");
     Console.WriteLine($"수학: {student.Math}");
     Console.WriteLine($"영어: {student.Eng}");
     Console.WriteLine($"입력일: {student.RegDate}");
 }
Exemplo n.º 17
0
    public static void AddScore(string studentID)
    {
        MongoServer server = MongoServer.Create(connectionString);
        MongoDatabase db = server.GetDatabase(dbString);
        MongoCollection collection = db.GetCollection(collectionString);

        StudentScore studentScore = new StudentScore(studentID);

        collection.Insert<StudentScore>(studentScore);
    }
        public List <StudentScore> Read()
        {
            #region 讀取成績計算規則。
            IStatusReporter Rep = Reporter;
            Rep.Feedback("讀取成績計算規則...", 0);

            UniqueSet <string> ruleids = new UniqueSet <string>();
            foreach (StudentScore each in Students)
            {
                if (!string.IsNullOrEmpty(each.RefCalculationRuleID))
                {
                    if (!ruleids.Contains(each.RefCalculationRuleID))
                    {
                        ruleids.Add(each.RefCalculationRuleID);
                    }
                }

                JHClassRecord cr = each.Class;
                if (cr != null)
                {
                    if (string.IsNullOrEmpty(cr.RefScoreCalcRuleID))
                    {
                        continue;
                    }

                    if (!ruleids.Contains(cr.RefScoreCalcRuleID))
                    {
                        ruleids.Add(cr.RefScoreCalcRuleID);
                    }
                }
            }

            FunctionSpliter <string, JHScoreCalcRuleRecord> spliter = new FunctionSpliter <string, JHScoreCalcRuleRecord>(10, Util.MaxThread);
            spliter.Function = delegate(List <string> idsPart)
            {
                return(JHScoreCalcRule.SelectByIDs(idsPart));
            };
            spliter.ProgressChange = delegate(int progress)
            {
                Rep.Feedback("讀取成績計算規則...", Util.CalculatePercentage(ruleids.Count, progress));
            };
            StudentScore.SetRuleMapping(spliter.Execute(ruleids.ToList()));

            List <StudentScore> noRule = new List <StudentScore>();
            foreach (StudentScore each in Students)
            {
                if (each.CalculationRule == null)
                {
                    noRule.Add(each);
                }
            }
            return(noRule);

            #endregion
        }
Exemplo n.º 19
0
 public void Add(Curriculum entity, StudentScore score)
 {
     using (var context = new SwuDBContext()) {
         var existing = context.Curriculums.Where(i => i.Id == entity.Id).FirstOrDefault();
         var student  = this._userManager.FindById(score.Student.Id);
         context.Users.Attach(student);
         context.Curriculums.Attach(existing);
         existing.StudentScores.Add(score);
         context.SaveChanges();
     }
 }
Exemplo n.º 20
0
 public ActionResult Edit([Bind(Include = "Id,StudentId,Course,Score")] StudentScore studentScore)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentScore).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentId = new SelectList(db.Students, "Id", "Name", studentScore.StudentId);
     return(View(studentScore));
 }
        public async Task <IActionResult> Create([Bind("id,StudentId,ScoreId")] StudentScore studentScore)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studentScore);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ScoreId"]   = new SelectList(_context.Scores, "Id", "Id", studentScore.ScoreId);
            ViewData["StudentId"] = new SelectList(_context.Students, "Id", "Email", studentScore.StudentId);
            return(View(studentScore));
        }
Exemplo n.º 22
0
        public override void Start()
        {
            StudentScore studentScore = new StudentScore();

            studentScore.StudentID = 1;
            var properties            = PropertyHelper.GetProperties <StudentScore>();
            var primaryKeysProperties = PropertyHelper.FiltrateByAttribute <PrimaryKeyAttribute>(properties);

            EntityHelper.GetKeysValues <StudentScore>(studentScore, primaryKeysProperties).ForEach((string keyvalue) =>
            {
                DisplayMessage(keyvalue);
            });
        }
Exemplo n.º 23
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() != GetType())
            {
                return(false);
            }
            StudentScore studentScore = (StudentScore)obj;

            if (studentScore.Lesson == Lesson && studentScore.Score == Score && studentScore.StudentNumber == StudentNumber)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 24
0
        // GET: StudentScores/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentScore studentScore = db.StudentScores.Find(id);

            if (studentScore == null)
            {
                return(HttpNotFound());
            }
            return(View(studentScore));
        }
Exemplo n.º 25
0
 public void AddScore(StudentScore score, int curriculumId, string studentId)
 {
     using (var context = new SwuDBContext())
     {
         var existing = context.Curriculums.Where(i => i.Id == curriculumId).FirstOrDefault();
         var student  = this._userManager.FindById(studentId);
         context.Users.Attach(student);
         context.Curriculums.Attach(existing);
         score.Student    = student;
         score.Curriculum = existing;
         context.StudentScore.Add(score);
         context.SaveChanges();
     }
 }
Exemplo n.º 26
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StudentScore = await _context.StudentScore.FirstOrDefaultAsync(m => m.id == id);

            if (StudentScore == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 27
0
        public async Task <StudentScore> GiveScore(GiveScoreRequest giveScoreRequest, int providedById)
        {
            var scoreModel = new StudentScore()
            {
                StudentId    = giveScoreRequest.StudentId,
                SubjectId    = giveScoreRequest.SubjectId,
                Value        = giveScoreRequest.Score,
                ProvidedById = providedById
            };

            _context.Set <StudentScore>().Add(scoreModel);
            await _context.SaveChangesAsync();

            return(scoreModel);
        }
Exemplo n.º 28
0
        public void Read()
        {
            List <SemesterHistoryRecord> histories = ReadSemesterHistory();

            foreach (SemesterHistoryRecord each in histories)
            {
                if (Students.ContainsKey(each.RefStudentID))
                {
                    StudentScore student = Students[each.RefStudentID];
                    foreach (SemesterHistoryItem item in each.SemesterHistoryItems)
                    {
                        student.SHistory.Add(new SemesterData(item.GradeYear, item.SchoolYear, item.Semester));
                    }
                }
            }
        }
Exemplo n.º 29
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StudentScore = await _context.StudentScore.FindAsync(id);

            if (StudentScore != null)
            {
                _context.StudentScore.Remove(StudentScore);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 30
0
        static void Main(string[] args)
        {
            TcpListener server = new TcpListener(IPAddress.Parse("127.0.0.1"), 7000);

            server.Start();

            Console.WriteLine("서버 시작 ...");
            TcpClient     client    = server.AcceptTcpClient();
            NetworkStream netStream = client.GetStream();
            MemoryStream  memStream = new MemoryStream();

            byte[] data      = new byte[4];
            int    recv_size = netStream.Read(data, 0, 4);

            if (recv_size > 0)
            {
                int size = BitConverter.ToInt32(data, 0);

                while (size > 0)
                {
                    data      = new byte[1024];
                    recv_size = netStream.Read(data, 0, recv_size);
                    memStream.Write(data, 0, recv_size);

                    size -= recv_size;
                }

                memStream.Position = 0;
                IFormatter formatter;

                formatter = new SoapFormatter();
                StudentScore ss = formatter.Deserialize(memStream) as StudentScore;
                if (ss != null)
                {
                    Console.WriteLine(ss.ToString());
                }
            }

            memStream.Close();
            netStream.Close();
            client.Close();
            server.Stop();

            Console.ReadLine();
        }
Exemplo n.º 31
0
        public override void Start()
        {
            TestToModel model = new TestToModel
            {
                ID     = 1001,
                LongID = 100001,
                Name   = "Eagle",
                Age    = 22
            };

            DisplayMessage(string.Format("TestToModel' key is {0}", ""));

            StudentScore studentScore = new StudentScore()
            {
                StudentID = 1
            };

            DisplayMessage(string.Format("StudentScore' key is {0}", ""));
        }