public IActionResult Add(StudentTag studentTag)
        {
            if (ModelState.IsValid)
            {
                context.StudentTags.Add(studentTag);
                context.SaveChanges();
                return(Redirect("/StudentTag/"));
            }

            return(View("Add", studentTag));
        }
示例#2
0
        public TagHelp(List <string> StudentIDList)
        {
            TagDic = new Dictionary <string, List <StudentTagRecord> >();
            List <StudentTagRecord> StudentTagList = StudentTag.SelectByStudentIDs(StudentIDList);

            foreach (StudentTagRecord each in StudentTagList)
            {
                if (!TagDic.ContainsKey(each.RefStudentID))
                {
                    TagDic.Add(each.RefStudentID, new List <StudentTagRecord>());
                }
                TagDic[each.RefStudentID].Add(each);
            }
        }
示例#3
0
        /// <summary>
        /// 將學生編號轉換成 SCStudent 物件。
        /// </summary>
        /// <remarks>使用指定的學生編號,向 DAL 取得 VO 後轉換成 SCStudent 物件。</remarks>
        public static List <ReportStudent> ToReportStudent(this IEnumerable <string> studentIDs)
        {
            List <string>        StudentIDList = new List <string>();
            List <ReportStudent> students      = new List <ReportStudent>();

            foreach (JHStudentRecord each in JHStudent.SelectByIDs(studentIDs))
            {
                StudentIDList.Add(each.ID);
                students.Add(new ReportStudent(each));
            }
            // 取得學生類別List
            List <StudentTagRecord> StudTagRecList = StudentTag.SelectByStudentIDs(StudentIDList);

            // 取得特種身分學生,加分比
            Dictionary <string, decimal> StudAddWeightDict = DAL.DALTransfer.GetStudentAddWeightFormUDTByStudentTag(StudTagRecList, DAL.DALTransfer._SchoolType);
            // 取得特種身分學生名稱
            Dictionary <string, string> StudSpecTypeDict = DAL.DALTransfer.GetStudentSpcTypeFormUDTByStudentTag(StudTagRecList, DAL.DALTransfer._SchoolType);
            Dictionary <string, K12.Data.UpdateRecordRecord> studUpdateRec = DAL.DALTransfer.GetStudentUpdareDate3ByStudentID(StudentIDList);

            foreach (ReportStudent rs in students)
            {
                // 加分比
                if (StudAddWeightDict.ContainsKey(rs.StudentID))
                {
                    rs.AddWeight = StudAddWeightDict[rs.StudentID];
                }

                // 學生身分
                if (StudSpecTypeDict.ContainsKey(rs.StudentID))
                {
                    rs.SpcStudTypeName = StudSpecTypeDict[rs.StudentID];
                }

                // 轉入學生異動
                if (studUpdateRec.ContainsKey(rs.StudentID))
                {
                    if (studUpdateRec[rs.StudentID] != null)
                    {
                        DateTime dt;

                        if (DateTime.TryParse(studUpdateRec[rs.StudentID].UpdateDate, out dt))
                        {
                            rs.TransUpdateDateStr = (dt.Year - 1911).ToString() + "/" + dt.Month + "/" + dt.Day;
                        }
                        else
                        {
                            rs.TransUpdateDateStr = "";
                        }

                        rs.LastEnterSchoolyear = studUpdateRec[rs.StudentID].SchoolYear;
                        rs.LastEnterSemester   = studUpdateRec[rs.StudentID].Semester;
                        int gr;
                        if (int.TryParse(studUpdateRec[rs.StudentID].GradeYear, out gr))
                        {
                            rs.LastEnterGradeYear = gr;
                        }
                    }
                }
            }

            return(students);
        }
        public IActionResult Add()
        {
            StudentTag studentTag = new StudentTag();

            return(View(studentTag));
        }