public PostStudent(StudRecord stud)
        {
            IsStudentRead = false;

            _stud       = stud;
            className   = stud.ClassName;
            seatNo      = stud.SeatNo;
            StudentName = stud.StudentName;
            SALoginName = stud.loginName;
        }
        public PostParent(DataRow row, StudRecord stud)
        {
            parent_id      = "" + row["id"];
            account        = "" + row["account"];
            ref_student_id = "" + row["ref_student_id"];
            relationship   = "" + row["relationship"];

            _stud       = stud;
            className   = stud.ClassName;
            seatNo      = stud.SeatNo;
            StudentName = stud.StudentName;
        }
Ejemplo n.º 3
0
        static public List <StudRecord> GetStudent(List <string> studentIDList)
        {
            List <StudRecord> list = new List <StudRecord>();

            StringBuilder sb_sql = new StringBuilder();

            sb_sql.Append("select student.id,student.name,student.seat_no,class.class_name,sa_login_name ");
            sb_sql.Append("from student left join class on class.id=student.ref_class_id ");
            sb_sql.Append(string.Format("where student.id in ('{0}')", string.Join("','", studentIDList)));

            DataTable dt = tool._Q.Select(sb_sql.ToString());

            foreach (DataRow each in dt.Rows)
            {
                StudRecord stud = new StudRecord(each);
                list.Add(stud);
            }

            return(list);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 設定已讀數 & 發送數
        /// </summary>
        private void SetSendCount(List <string> noticeIDList, List <MessageLogRecord> messageList)
        {
            //取得學生記錄
            StudentDic = GetStudent(messageList);

            totalCount = DataManager.TotalCount();

            foreach (MessageLogRecord _record in messageList)
            {
                if (_record.studentList.Count > 0)
                {
                    //建立學生基本資料
                    foreach (string stud_id in _record.studentList)
                    {
                        if (StudentDic.ContainsKey(stud_id))
                        {
                            StudRecord stud = StudentDic[stud_id];

                            if (!_record.CheckStudentReadDic.ContainsKey(stud_id))
                            {
                                _record.CheckStudentReadDic.Add(stud_id, new PostStudent(stud));
                            }
                        }
                    }

                    //取得學生讀取記錄
                    StringBuilder sb_sql = new StringBuilder();
                    sb_sql.Append("select ref_notice_id,ref_student_id,ref_parent_id,time from $ischool.1campus.notice_log notice_log ");
                    sb_sql.Append(string.Format("where ref_notice_id='{0}' ", _record.notice_id));
                    sb_sql.Append(string.Format("and ref_student_id in ('{0}') ", string.Join("','", _record.studentList)));
                    //家長是空值 , 老師是空值
                    sb_sql.Append("and ref_parent_id is null and ref_teacher_id is null");

                    DataTable dt = tool._Q.Select(sb_sql.ToString());

                    foreach (DataRow row in dt.Rows)
                    {
                        string ref_student_id = "" + row["ref_student_id"];

                        if (_record.CheckStudentReadDic.ContainsKey(ref_student_id))
                        {
                            _record.CheckStudentReadDic[ref_student_id].IsStudentRead = true;

                            string time = "" + row["time"];
                            _record.CheckStudentReadDic[ref_student_id].IsStudentReadTime = time;
                        }
                    }
                }

                //需有家長才取得家長讀取記錄
                if (_record.parentList.Count > 0)
                {
                    //取得目前學生所關連之家長個人資料
                    StringBuilder sb_sParent_sql = new StringBuilder();
                    sb_sParent_sql.Append(string.Format("select * from student_parent where id in ('{0}')", string.Join("','", _record.parentList)));

                    DataTable dtsParent = tool._Q.Select(sb_sParent_sql.ToString());
                    foreach (DataRow row in dtsParent.Rows)
                    {
                        string ref_student_id = "" + row["ref_student_id"];

                        if (!_record.CheckParentReadDic.ContainsKey(ref_student_id))
                        {
                            _record.CheckParentReadDic.Add(ref_student_id, new Dictionary <string, PostParent>());
                        }

                        if (StudentDic.ContainsKey(ref_student_id))
                        {
                            PostParent parent = new PostParent(row, StudentDic[ref_student_id]);
                            _record.CheckParentReadDic[ref_student_id].Add(parent.parent_id, parent);
                        }
                    }

                    //取得家長讀取記錄
                    StringBuilder sb_parent_sql = new StringBuilder();
                    sb_parent_sql.Append("select ref_notice_id,ref_student_id,ref_parent_id,time from $ischool.1campus.notice_log notice_log ");
                    sb_parent_sql.Append(string.Format("where notice_log.ref_notice_id='{0}' ", _record.notice_id));
                    sb_parent_sql.Append(string.Format("and notice_log.ref_parent_id in ('{0}') ", string.Join("','", _record.parentList)));
                    sb_parent_sql.Append("and ref_parent_id is not null and ref_teacher_id is null ");
                    sb_parent_sql.Append("order by time");

                    DataTable dt_parent = tool._Q.Select(sb_parent_sql.ToString());
                    foreach (DataRow row in dt_parent.Rows)
                    {
                        string ref_parent_id  = "" + row["ref_parent_id"];
                        string ref_student_id = "" + row["ref_student_id"];
                        string time           = "" + row["time"];
                        if (_record.CheckParentReadDic.ContainsKey(ref_student_id))
                        {
                            if (_record.CheckParentReadDic[ref_student_id].ContainsKey(ref_parent_id))
                            {
                                _record.CheckParentReadDic[ref_student_id][ref_parent_id].IsParentRead = true;

                                if (string.IsNullOrEmpty(_record.CheckParentReadDic[ref_student_id][ref_parent_id].IsParentReadTime))
                                {
                                    _record.CheckParentReadDic[ref_student_id][ref_parent_id].IsParentReadTime = time;
                                }
                            }
                        }
                    }
                }
            }
        }