Esempio n. 1
0
        public static void Not_AgendaTaskAssign(AgendaClass.AgendaTaskClass task)
        {
            using (boxEntities box = new boxEntities())
            {
                int uid = Profile.getUserID(task.Creator);
                NotificationHeader notH = new NotificationHeader();
                notH.NotType    = NotificationType.Agenda_Update.ToString();
                notH.NotDate    = DateTime.Now;
                notH.AgendaID   = task.AgendaID;
                notH.NotCreator = uid;
                box.NotificationHeaders.AddObject(notH);
                box.SaveChanges();

                var parti = Profile.GetUserIDs(task.Usernames).ToList();
                foreach (var i in parti)
                {
                    NotInfo notI = new NotInfo();
                    notI.UserID      = i;
                    notI.NotHeaderID = notH.NotID;
                    notI.Ack         = false;
                    notI.Seen        = false;
                    box.NotInfoes.AddObject(notI);
                }
                box.SaveChanges();
                // get data
                var emails = getEmails(parti);
                var mtitle = box.Agenda.Where(a => a.AgendaID == task.AgendaID).Select(a => a.Meeting.MeetingTitle).FirstOrDefault();
                var msg    = FormatTaskMsg(task, NotificationType.Task_Assignment, mtitle);

                SendEmail(emails, msg, NotificationType.Task_Assignment);
            }
        }
Esempio n. 2
0
        private static string FormatTaskMsg(AgendaClass.AgendaTaskClass m, NotificationType type, string mTitle)
        {
            string t = type.ToString();
            string msg;

            switch (t)
            {
            case "Task_Assignment":
                // note is meeting title
                msg  = "<b>You have been Assigned a new task for the meeting:</b><br><hr>";
                msg += "<b>Meeting Details</b><br>";
                msg += "Title: " + mTitle + "<br><hr>";
                msg += "<b>Task: </b>" + m.Title + "<br/>";
                msg += "<b>Due Date: </b>" + m.DueDate.ToShortDateString() + "<br/>";
                return(msg);

            default:
                return("");
            }
        }