예제 #1
0
파일: Global.asax.cs 프로젝트: ollana/CAMS
        private void FindUsersAndNotifications(NotificationFrequency frequency)
        {
            NotificationsController controller = new NotificationsController();

            foreach (var user in controller.GetEmailSubscribers(frequency))
            {
                NotificationViewModel notificationModel = new NotificationViewModel(user, controller);
                List <Notification>   notifications     = notificationModel.Notifications;
                if (notifications.Count > 0)
                {
                    string msg = "<table>";
                    msg += "<tr> <td> מחלקה </td> <td> בניין </td> <td> כיתה </td> <td> עמדה </td>  <td> פירוט התראה </td><th></th></tr> ";

                    foreach (var notification in notificationModel.Notifications)
                    {
                        msg += "<tr> <td>" + notification.DepartmentName + "</td> ";
                        msg += "<td>" + notification.Building + "</td> ";
                        msg += "<td>" + notification.RoomNumber + "</td> ";
                        msg += "<td>" + notification.ComputerName + "</td> ";
                        switch (notification.NotificationType)
                        {
                        case Constant.NotificationType.Disconnected:
                            msg += "<td> לא מחובר " + notification.Days + " ימים </td> ";
                            break;

                        case Constant.NotificationType.NotUsed:
                            msg += "<td> לא בשימוש " + notification.Days + " ימים </td> ";
                            break;
                        }
                        msg += "</tr>";
                    }
                    msg += "</table>";
                    SendEmail(msg, user);
                }
            }
        }