예제 #1
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);
     }
 }
예제 #2
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (notification.Status == 1)
         {
             notification.Status = 2;
             notificationBUS.Update(notification);
             notificationBUS.UpdateNotificationStatus(staff.ID, notification.ID, notification.Status);
             String detail = "Nhân viên " + staff.Name + " nhận công việc.";
             notificationBUS.SendResponse(detail, DateTime.Now, DateTime.Now.AddHours(3), notification.ID, 3);
             scheduleBUS.AcceptWork(staff.ID, notification.ID);
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }