/// <summary> /// 定期実行(Aipo4,5) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void WhatsnewProcess(bool isCheckNow, bool isStartup) { if (!isLogin) { return; } if (String.IsNullOrEmpty(SettingManager.UserId) || String.IsNullOrEmpty(SettingManager.LoginName) || String.IsNullOrEmpty(SettingManager.UserPassword)) { return; } DateTime dt = DateTime.Now; /* * タイマーで5分間隔で新着情報をチェックするため、現在の時刻が5分、10分…55分かチェックし、 * 5分、10分…55分の場合のみ、以降の処理を実行する。 * ただし、isCheckNowがtrueの場合(起動時や設定保存時、今すぐチェックする場合)はそのまま以降の処理を実行する。 */ if (!isCheckNow) { if (dt.Minute != 0 && dt.Minute != 5 && dt.Minute != 10 && dt.Minute != 15 && dt.Minute != 20 && dt.Minute != 25 && dt.Minute != 30 && dt.Minute != 35 && dt.Minute != 40 && dt.Minute != 45 && dt.Minute != 50 && dt.Minute != 55) { return; } } try { notificationDic = new Dictionary<string, BalloonItem>(); ScheduleManager sm = new ScheduleManager(dt); List<ScheduleItem> oneDayScheduleList = null; // 終日スケジュールをチェック if (isStartup) { oneDayScheduleList = sm.CheckOneDaySchedule(); } // もうすぐ始まるスケジュールをチェック List<ScheduleItem> scheduleList = new List<ScheduleItem>(); scheduleList = sm.CheckSchedule(); if (scheduleList != null && scheduleList.Count > 0 || oneDayScheduleList != null && oneDayScheduleList.Count > 0) { Form2 f = new Form2(); if (scheduleList != null && scheduleList.Count > 0) { f.ScheduleList = scheduleList; } if (oneDayScheduleList != null && oneDayScheduleList.Count > 0) { f.OneDayScheduleList = oneDayScheduleList; } f.Show(); } // 新着情報を取得するためのDataSetと検索条件を設定 WhatsnewDataSet data = new WhatsnewDataSet(); WhatsnewDataSet.search_eip_t_whatsnewRow paramRow = data.search_eip_t_whatsnew.Newsearch_eip_t_whatsnewRow(); paramRow.user_id = SettingManager.UserId; data.search_eip_t_whatsnew.Rows.Add(paramRow); WhatsnewModel m = new WhatsnewModel(); m.Execute(m.GetWhatsnewInfo, data); // 新着情報を取り出す StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.eip_t_whatsnew_blog.Count; i++) { if (i == 0) { sb.AppendLine("[ ブログ ] 新着記事"); } string whatsnew_id = data.eip_t_whatsnew_blog[i].whatsnew_id; string title = data.eip_t_whatsnew_blog[i].title; string last_name = data.eip_t_whatsnew_blog[i].last_name; string first_name = data.eip_t_whatsnew_blog[i].first_name; string update_date = data.eip_t_whatsnew_blog[i].update_date; // リストに詰める List<UserNameObject> list = new List<UserNameObject>(); list.Add(new UserNameObject(last_name, first_name)); BalloonItemBlog item = new BalloonItemBlog(whatsnew_id, title, null, list, update_date); notificationDic.Add("blog" + i.ToString(), item); sb.AppendLine(item.ToString()); } for (int i = 0; i < data.eip_t_whatsnew_blog_comment.Count; i++) { if (i == 0) { sb.AppendLine("[ ブログ ] 新着コメント"); } // 同じブログに対して複数のコメントがある場合、カンマ区切りで表示する。 string entry_id = data.eip_t_whatsnew_blog_comment[i].entry_id; DataRow[] row = data.eip_t_whatsnew_blog_comment.Select("entry_id = " + entry_id, "update_date desc"); List<UserNameObject> list = new List<UserNameObject>(); StringBuilder sbName = new StringBuilder(); for (int j = 0; j < row.Length; j++) { string last_name = (string)row[j].ItemArray[3]; string first_name = (string)row[j].ItemArray[4]; if (sbName.Length != 0) { sbName.Append(","); } sbName.Append(last_name); sbName.Append(" "); sbName.Append(first_name); list.Add(new UserNameObject(last_name, first_name)); } string whatsnew_id = data.eip_t_whatsnew_blog_comment[i].whatsnew_id; string title = data.eip_t_whatsnew_blog_comment[i].title; string update_date = data.eip_t_whatsnew_blog_comment[i].update_date; i += row.Length; BalloonItemBlogComment item = new BalloonItemBlogComment(whatsnew_id, title, null, list, update_date); notificationDic.Add("blog_comment" + i.ToString(), item); sb.AppendLine(item.ToString()); } for (int i = 0; i < data.eip_t_whatsnew_msgboard.Count; i++) { if (i == 0) { sb.AppendLine("[ 掲示板 ] 新しい書き込み"); } string whatsnew_id = data.eip_t_whatsnew_msgboard[i].whatsnew_id; string topic_id = data.eip_t_whatsnew_msgboard[i].topic_id; string topic_name = data.eip_t_whatsnew_msgboard[i].topic_name; string last_name = data.eip_t_whatsnew_msgboard[i].last_name; string first_name = data.eip_t_whatsnew_msgboard[i].first_name; string update_date = data.eip_t_whatsnew_msgboard[i].update_date; // リストに詰める List<UserNameObject> list = new List<UserNameObject>(); list.Add(new UserNameObject(last_name, first_name)); BalloonItemMsgboard item = new BalloonItemMsgboard(topic_id, topic_name, null, list, update_date); notificationDic.Add("msgboard" + i.ToString(), item); sb.AppendLine(item.ToString()); } for (int i = 0; i < data.eip_t_whatsnew_schedule.Count; i++) { if (i == 0) { sb.AppendLine("[ スケジュール ] 新着予定"); } string whatsnew_id = data.eip_t_whatsnew_schedule[i].whatsnew_id; string name = data.eip_t_whatsnew_schedule[i].name; string last_name = data.eip_t_whatsnew_schedule[i].last_name; string first_name = data.eip_t_whatsnew_schedule[i].first_name; string update_date = data.eip_t_whatsnew_schedule[i].update_date; // リストに詰める List<UserNameObject> list = new List<UserNameObject>(); list.Add(new UserNameObject(last_name, first_name)); BalloonItemSchedule item = new BalloonItemSchedule(whatsnew_id, name, null, list, update_date); notificationDic.Add("schedule" + i.ToString(), item); sb.AppendLine(item.ToString()); } for (int i = 0; i < data.eip_t_whatsnew_workflow.Count; i++) { if (i == 0) { sb.AppendLine("[ ワークフロー ] 新着依頼"); } string whatsnew_id = data.eip_t_whatsnew_workflow[i].whatsnew_id; string request_name = data.eip_t_whatsnew_workflow[i].request_name; string category_name = data.eip_t_whatsnew_workflow[i].category_name; string last_name = data.eip_t_whatsnew_workflow[i].last_name; string first_name = data.eip_t_whatsnew_workflow[i].first_name; string update_date = data.eip_t_whatsnew_workflow[i].update_date; // リストに詰める List<UserNameObject> list = new List<UserNameObject>(); list.Add(new UserNameObject(last_name, first_name)); BalloonItemWorkflow item = new BalloonItemWorkflow(whatsnew_id, category_name, request_name, list, update_date); notificationDic.Add("workflow" + i.ToString(), item); sb.AppendLine(item.ToString()); } for (int i = 0; i < data.eip_t_whatsnew_memo.Count; i++) { if (i == 0) { sb.AppendLine("[ 伝言メモ ] 新着メモ"); } string whatsnew_id = data.eip_t_whatsnew_memo[i].whatsnew_id; string client_name = data.eip_t_whatsnew_memo[i].client_name; string subject_type = data.eip_t_whatsnew_memo[i].subject_type; string custom_subject = data.eip_t_whatsnew_memo[i].custom_subject; string last_name = data.eip_t_whatsnew_memo[i].last_name; string first_name = data.eip_t_whatsnew_memo[i].first_name; string update_date = data.eip_t_whatsnew_memo[i].update_date; string subject = ""; switch (subject_type) { case "0": subject = custom_subject; break; case "1": subject = MessageConstants.SUBJECT_TYPE1; break; case "2": subject = MessageConstants.SUBJECT_TYPE2; break; case "3": subject = MessageConstants.SUBJECT_TYPE3; break; case "4": subject = MessageConstants.SUBJECT_TYPE4; break; } // リストに詰める List<UserNameObject> list = new List<UserNameObject>(); list.Add(new UserNameObject(last_name, first_name)); BalloonItemMemo item = new BalloonItemMemo(whatsnew_id, client_name, subject, list, update_date); notificationDic.Add("memo" + i.ToString(), item); sb.AppendLine(item.ToString()); } if (!String.IsNullOrEmpty(sb.ToString())) { // タスクトレイアイコンを点滅させる this.AnimatedTasktrayIcon(true); if (checkBoxInformation.Checked) { if (!alertWindow1.isShow()) { alertWindow1.ShowCloseButton = true; alertWindow1.BackColor = Color.White; alertWindow1.BackColor2 = Color.FromArgb(255, 136, 0); alertWindow1.Time = 10000; alertWindow1.Icon = AlertIcons.Custom; alertWindow1.CustomIcon = Properties.Resources.information_orange; alertWindow1.Show(sb.ToString(), MessageConstants.MSG_INFORMATION_01); } } else { // バルーンを表示する this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; this.notifyIcon1.BalloonTipTitle = MessageConstants.MSG_INFORMATION_02; this.notifyIcon1.BalloonTipText = sb.ToString(); this.notifyIcon1.ShowBalloonTip(10000); } } else { // タスクトレイアイコンの点滅を停止 this.AnimatedTasktrayIcon(false); } } catch (DBException ex) { Debug.Print(ex.toString()); } }
/// <summary> /// 定期実行(Aipo6) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void WhatsnewProcessV7(bool isCheckNow, bool isStartup) { if (!isLogin) { return; } if (String.IsNullOrEmpty(SettingManager.UserId) || String.IsNullOrEmpty(SettingManager.LoginName) || String.IsNullOrEmpty(SettingManager.UserPassword)) { return; } DateTime dt = DateTime.Now; /* * タイマーで5分間隔で新着情報をチェックするため、現在の時刻が5分、10分…55分かチェックし、 * 5分、10分…55分の場合のみ、以降の処理を実行する。 * ただし、isCheckNowがtrueの場合(起動時や設定保存時、今すぐチェックする場合)はそのまま以降の処理を実行する。 */ if (!isCheckNow) { if (dt.Minute != 0 && dt.Minute != 5 && dt.Minute != 10 && dt.Minute != 15 && dt.Minute != 20 && dt.Minute != 25 && dt.Minute != 30 && dt.Minute != 35 && dt.Minute != 40 && dt.Minute != 45 && dt.Minute != 50 && dt.Minute != 55) { return; } } try { notificationDic = new Dictionary<string, BalloonItem>(); ScheduleManager sm = new ScheduleManager(dt); List<ScheduleItem> oneDayScheduleList = null; // 終日スケジュールをチェック if (isStartup) { oneDayScheduleList = sm.CheckOneDaySchedule(); } // もうすぐ始まるスケジュールをチェック List<ScheduleItem> scheduleList = new List<ScheduleItem>(); scheduleList = sm.CheckSchedule(); if (scheduleList != null && scheduleList.Count > 0 || oneDayScheduleList != null && oneDayScheduleList.Count > 0) { Form2 f = new Form2(); if (scheduleList != null && scheduleList.Count > 0) { f.ScheduleList = scheduleList; } if (oneDayScheduleList != null && oneDayScheduleList.Count > 0) { f.OneDayScheduleList = oneDayScheduleList; } f.Show(); } // あなた宛てのお知らせを取得するためのDataSetと検索条件を設定 ActivityDataSet data = new ActivityDataSet(); ActivityDataSet.search_activityRow paramRow = data.search_activity.Newsearch_activityRow(); paramRow.login_name = SettingManager.LoginName; data.search_activity.Rows.Add(paramRow); ActivityModel m = new ActivityModel(); m.Execute(m.GetActivityInfo, data); // 新着情報を取り出す StringBuilder sb = new StringBuilder(); foreach (ActivityDataSet.activityRow activity in data.activity) { // リストに詰める ActivityItem item = new ActivityItem(activity.id, activity.last_name, activity.first_name, activity.title, activity.update_date); sb.AppendLine(item.ToString()); } if (!String.IsNullOrEmpty(sb.ToString())) { // タスクトレイアイコンを点滅させる this.AnimatedTasktrayIcon(true); if (checkBoxInformation.Checked) { if (!alertWindow1.isShow()) { alertWindow1.ShowCloseButton = true; alertWindow1.BackColor = Color.White; alertWindow1.BackColor2 = Color.FromArgb(255, 136, 0); alertWindow1.Time = 10000; alertWindow1.Icon = AlertIcons.Custom; alertWindow1.CustomIcon = Properties.Resources.information_orange; alertWindow1.Show(sb.ToString(), MessageConstants.MSG_INFORMATION_01); } } else { // バルーンを表示する this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; this.notifyIcon1.BalloonTipTitle = MessageConstants.MSG_INFORMATION_02; this.notifyIcon1.BalloonTipText = sb.ToString(); this.notifyIcon1.ShowBalloonTip(10000); } } else { // タスクトレイアイコンの点滅を停止 this.AnimatedTasktrayIcon(false); } } catch (DBException ex) { Debug.Print(ex.toString()); } }