Esempio n. 1
0
        /// <summary>
        /// 設定已讀數 & 發送數
        /// </summary>
        private void SetSendCount(List <string> noticeIDList, List <MessageLogRecord> messageList)
        {
            //取得學生記錄
            TeacherDic = GetTeacher(messageList);

            foreach (MessageLogRecord _record in messageList)
            {
                if (_record.teacherList.Count > 0)
                {
                    //建立學生基本資料
                    foreach (string teac_id in _record.teacherList)
                    {
                        if (TeacherDic.ContainsKey(teac_id))
                        {
                            TeacRecord teac = TeacherDic[teac_id];

                            if (!_record.CheckTeacherReadDic.ContainsKey(teac_id))
                            {
                                _record.CheckTeacherReadDic.Add(teac_id, new PostTeacher(teac));
                            }
                        }
                    }

                    //取得教師讀取記錄
                    StringBuilder sb_sql = new StringBuilder();
                    sb_sql.Append("select ref_notice_id,ref_teacher_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_teacher_id in ('{0}') ", string.Join("','", _record.teacherList)));
                    //老師不是空值
                    sb_sql.Append("and ref_teacher_id is not null");

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

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

                        if (_record.CheckTeacherReadDic.ContainsKey(ref_teacher_id))
                        {
                            _record.CheckTeacherReadDic[ref_teacher_id].IsTeacherRead = true;

                            string time = "" + row["time"];
                            _record.CheckTeacherReadDic[ref_teacher_id].IsTeacherReadTime = time;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        static public List <TeacRecord> GetTeacher(List <string> teacherIDList)
        {
            List <TeacRecord> list = new List <TeacRecord>();

            StringBuilder sb_sql = new StringBuilder();

            sb_sql.Append("select teacher.id,teacher.teacher_name,teacher.st_login_name ");
            sb_sql.Append("from teacher ");
            sb_sql.Append(string.Format("where teacher.id in ('{0}')", string.Join("','", teacherIDList)));

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

            foreach (DataRow each in dt.Rows)
            {
                TeacRecord teac = new TeacRecord(each);
                list.Add(teac);
            }
            return(list);
        }
 public PostTeacher(TeacRecord teac)
 {
     id          = teac.ID;
     loginName   = teac.loginName;
     TeacherName = teac.TeacherName;
 }