public LogCountForm(MessageLogRecord record) { InitializeComponent(); _record = record; Run(); }
/// <summary> /// 2018/5/29 - Dylan 新增再發送的功能效果 /// </summary> public PostNotice_SP(PostNotice_SP.Type type, MessageLogRecord record) { _Type = type; _Record = record; InitializeComponent(); _backgroundWorker = new BackgroundWorker(); _backgroundWorker.DoWork += new DoWorkEventHandler(_backgroundWorker_DoWork); _backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_backgroundWorker_RunWorkerCompleted); }
private void btnViewContent_Click(object sender, EventArgs e) { if (dataGridViewX1.SelectedRows.Count == 1) { MessageLogRecord record = (MessageLogRecord)dataGridViewX1.SelectedRows[0].Tag; LogViewForm view = new LogViewForm(record, "student"); view.ShowDialog(); } else { MsgBox.Show("請選擇一筆資料"); } }
private void btnViewCount_Click(object sender, EventArgs e) { //顯示已讀清單 if (dataGridViewX1.SelectedRows.Count == 1) { MessageLogRecord record = (MessageLogRecord)dataGridViewX1.SelectedRows[0].Tag; LogCountForm lcf = new LogCountForm(record); lcf.ShowDialog(); } else { MsgBox.Show("請選擇一筆資料"); } }
/// <summary> /// 統計學生數 /// </summary> static public void SetStudentCount(List <string> noticeIDList, List <MessageLogRecord> messageList) { Dictionary <string, MessageLogRecord> MessageDic = new Dictionary <string, MessageLogRecord>(); foreach (MessageLogRecord log in messageList) { if (!MessageDic.ContainsKey(log.notice_id)) { MessageDic.Add(log.notice_id, log); } } StringBuilder sb_sql = new StringBuilder(); sb_sql.Append("select notice_target.ref_notice_id,student.id as student_id,student.name as student_name,"); sb_sql.Append("student_parent.id as parent_id,student_parent.relationship,student_parent.account "); sb_sql.Append("from $ischool.1campus.notice_target notice_target "); sb_sql.Append("left join student on student.id= notice_target.ref_student_id "); sb_sql.Append("left join student_parent on student.id=student_parent.ref_student_id "); sb_sql.Append(string.Format("where notice_target.ref_notice_id in ('{0}') and notice_target.ref_teacher_id is null and notice_target.ref_student_id is not null ", string.Join("','", noticeIDList))); DataTable dt = tool._Q.Select(sb_sql.ToString()); foreach (DataRow row in dt.Rows) { string notice_id = "" + row["ref_notice_id"]; string student_id = "" + row["student_id"]; string parent_id = "" + row["parent_id"]; if (MessageDic.ContainsKey(notice_id)) { MessageLogRecord log = MessageDic[notice_id]; if (!log.studentList.Contains(student_id)) { log.studentList.Add(student_id); } if (parent_id != "") { if (!log.parentList.Contains(parent_id)) { log.parentList.Add(parent_id); } } } } }
private void dataGridViewX1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex > -1 && e.RowIndex > -1) { if (e.ColumnIndex <= 3) { MessageLogRecord record = (MessageLogRecord)dataGridViewX1.SelectedRows[0].Tag; LogViewForm view = new LogViewForm(record, "teacher"); view.ShowDialog(); } else { MessageLogRecord record = (MessageLogRecord)dataGridViewX1.SelectedRows[0].Tag; LogTeacherCountForm view = new LogTeacherCountForm(record); view.ShowDialog(); } } }
/// <summary> /// 取得目前簡訊歷程 /// /// </summary> static public List <MessageLogRecord> GetNoticeList(string dateTime1, string dateTime2, bool IsTeacher) { List <MessageLogRecord> list = new List <MessageLogRecord>(); StringBuilder sb_sql = new StringBuilder(); sb_sql.Append("select notice.uid as notice_id,notice.message,notice.display_sender,notice.post_time,"); sb_sql.Append("notice.title,notice.parent_visible,notice.student_visible "); sb_sql.Append("from $ischool.1campus.notice notice "); //是否為老師訊息 if (IsTeacher) { sb_sql.Append("join (select notice.uid as notice_id "); sb_sql.Append("from $ischool.1campus.notice notice "); sb_sql.Append("left join $ischool.1campus.notice_target notice_target on notice.uid=notice_target.ref_notice_id "); sb_sql.Append("where notice_target.ref_teacher_id is not null "); sb_sql.Append("group by notice.uid ) teacher_notice on teacher_notice.notice_id=notice.uid "); sb_sql.Append("where notice.post_time >='{0}' and notice.post_time <='{1}'"); } else { sb_sql.Append("where not notice.uid in (select notice.uid as notice_id "); sb_sql.Append("from $ischool.1campus.notice notice "); sb_sql.Append("left join $ischool.1campus.notice_target notice_target on notice.uid=notice_target.ref_notice_id "); sb_sql.Append("where notice_target.ref_teacher_id is not null "); sb_sql.Append("group by notice.uid "); sb_sql.Append(") and notice.post_time >='{0}' and notice.post_time <='{1}'"); } sb_sql.Append("order by notice.post_time desc"); DataTable dt = tool._Q.Select(string.Format(sb_sql.ToString(), dateTime1, dateTime2)); foreach (DataRow row in dt.Rows) { MessageLogRecord mesgR = new MessageLogRecord(row); list.Add(mesgR); } return(list); }
public LogViewForm(MessageLogRecord record, string type) { InitializeComponent(); _record = record; _type = type; lbTime.Text = "發送時間:" + _record.post_time; lbUser.Text = "發送人員:" + _record.display_sender; lbTitle.Text = "標 題:" + _record.title; if (type == "teacher") { cbParent.Visible = false; cbStudent.Visible = false; lbSendToUser.Visible = false; } else if (type == "student") { cbParent.Checked = _record.parent_visible == "true" ? true : false; cbStudent.Checked = _record.student_visible == "true" ? true : false; } //取得目前的專案dll檔的 絕對路徑(若在使用者端 就會抓絕對的使用者電腦路徑) FileInfo projectDllURL = new FileInfo(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "")); //取得html 相對路徑 string htmlRelativeURL = Path.Combine(projectDllURL.DirectoryName, "HTMLResouces\\html\\content.html");; //2017/8/15 穎驊註解, 下面為穎驊的開發機 Html 的絕對位子,在開發測試完畢後,將使用相對路徑 找到html 檔案 //ChromiumWebBrowser myBrowser = new ChromiumWebBrowser(@"C:\Users\ED\Documents\ischool_github\1campus.notice.v17\HTMLResouces\html\content.html"); ChromiumWebBrowser myBrowser = new ChromiumWebBrowser(htmlRelativeURL); //ChromiumWebBrowser myBrowser = new ChromiumWebBrowser(@"http://www.maps.google.com"); _myBrowser = myBrowser; _myBrowser.LoadHtml(_record.message, "http://www.ischool.com.tw/1campus-app.html"); this.panel1.Controls.Add(myBrowser); }
//2018/5/29 - Dylan 新增再發送的功能效果 public RePostNotice(RePostNotice.Type type, MessageLogRecord record) { _Type = type; _Record = record; InitializeComponent(); }