コード例 #1
0
 private void btnRead_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvNotification.SelectedRows.Count == 1)
         {
             DataRow            row    = notificationTable.Rows[dgvNotification.SelectedRows[0].Index];
             DialogNotification dialog = new DialogNotification(GetNotification(row), staff);
             dialog.Show();
         }
         else
         {
             if (dgvNotification.SelectedRows.Count > 1)
             {
                 throw new Exception("Bạn chỉ có thể xem một thông báo một lần!");
             }
             else
             {
                 throw new Exception("Bạn chưa chọn thông báo để xem!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
        private void ShowNotificationDialog(Notification notification, int status)
        {
            DialogNotification dialog = new DialogNotification(notification, staff);

            this.Invoke((MethodInvoker) delegate()
            {
                dialog.Show();
            });
        }
コード例 #3
0
 private void CheckNotification()
 {
     while (checking)
     {
         DateTime     today        = DateTime.Now;
         Notification notification = notificationBUS.GetUnrepliedNotificationByStaffId(staff.ID);
         if (notification.ID != null)
         {
             if (today.CompareTo(notification.Deadline) > 0)
             {
                 if (notification.Times == 0)
                 {
                     notification.Status = 3;
                     if (staff.Type != 1 && staff.Type != 2)
                     {
                         String   detail   = "Cán bộ " + staff.Name + " chưa trả lời thư!";
                         DateTime deadline = DateTime.Now.AddHours(3);
                         notificationBUS.Insert(staff.ID, "Nhắc nhở", detail, DateTime.Now, deadline, 2);
                     }
                 }
                 else
                 {
                     notification.ReceiveTime = DateTime.Now;
                     notification.Deadline    = notification.Deadline.AddMinutes(30);
                     notification.Times--;
                     DialogNotification dialog = new DialogNotification(notification, staff);
                     this.Invoke((MethodInvoker) delegate()
                     {
                         dialog.Show();
                     });
                 }
                 notificationBUS.Update(notification);
                 notificationBUS.UpdateNotificationStatus(staff.ID, notification.ID, notification.Status);
                 if (notifications != null)
                 {
                     notifications.RemoveRange(0, notifications.Count);
                 }
                 notifications = notificationBUS.GetLastTenRowsByStaffId(staff.ID);
                 SetList(notifications);
             }
         }
         Thread.Sleep(30000);
     }
 }
コード例 #4
0
        private void lvNotification_DoubleClick(object sender, EventArgs e)
        {
            DialogNotification dialog = new DialogNotification(notifications[lvNotification.SelectedIndices[0]], staff);

            dialog.Show();
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: ASQL/LichCongTacVaNhacViec
 private void ShowNotificationDialog(Notification notification, int status)
 {
     DialogNotification dialog = new DialogNotification(notification, staff);
     this.Invoke((MethodInvoker)delegate()
     {
         dialog.Show();
     });
 }
コード例 #6
0
ファイル: frmMain.cs プロジェクト: ASQL/LichCongTacVaNhacViec
 private void lvNotification_DoubleClick(object sender, EventArgs e)
 {
     DialogNotification dialog = new DialogNotification(notifications[lvNotification.SelectedIndices[0]], staff);
     dialog.Show();
 }
コード例 #7
0
ファイル: frmMain.cs プロジェクト: ASQL/LichCongTacVaNhacViec
 private void CheckNotification()
 {
     while (checking)
     {
         DateTime today = DateTime.Now;
         Notification notification = notificationBUS.GetUnrepliedNotificationByStaffId(staff.ID);
         if (notification.ID != null)
         {
             if (today.CompareTo(notification.Deadline) > 0)
             {
                 if (notification.Times == 0)
                 {
                     notification.Status = 3;
                     if (staff.Type != 1 && staff.Type != 2)
                     {
                         String detail = "Cán bộ " + staff.Name + " chưa trả lời thư!";
                         DateTime deadline = DateTime.Now.AddHours(3);
                         notificationBUS.Insert(staff.ID, "Nhắc nhở", detail, DateTime.Now, deadline, 2);
                     }
                 }
                 else
                 {
                     notification.ReceiveTime = DateTime.Now;
                     notification.Deadline = notification.Deadline.AddMinutes(30);
                     notification.Times--;
                     DialogNotification dialog = new DialogNotification(notification, staff);
                     this.Invoke((MethodInvoker)delegate()
                     {
                         dialog.Show();
                     });
                 }
                 notificationBUS.Update(notification);
                 notificationBUS.UpdateNotificationStatus(staff.ID, notification.ID, notification.Status);
                 if (notifications != null)
                 {
                     notifications.RemoveRange(0, notifications.Count);
                 }
                 notifications = notificationBUS.GetLastTenRowsByStaffId(staff.ID);
                 SetList(notifications);
             }
         }
         Thread.Sleep(30000);
     }
 }