Beispiel #1
0
        public string GetResponseMessage(int requestApprovalId)
        {
            ResponseApprovalMessage responseMessage     = db.ResponseApprovalMessage.Where(r => r.RequestApprovalMessageID == requestApprovalId).FirstOrDefault();
            BaseMessage             existingBaseMessage = db.BaseMessage.Where(b => b.BaseMessageID == responseMessage.BaseMessageID).FirstOrDefault();

            return(existingBaseMessage.MessageText.ToString());
        }
Beispiel #2
0
        public ActionResult CreateResponseApprovalMessage(int requestApprovalMessageId, int senderId, int receiverId, string messageText, string response)
        {
            BaseMessage baseMessage = new BaseMessage();

            baseMessage.SenderID        = senderId;
            baseMessage.RecieverID      = receiverId;
            baseMessage.MessageText     = messageText;
            baseMessage.MessageSendDate = DateTime.Now;

            ResponseApprovalMessage responseMessage = new ResponseApprovalMessage();

            responseMessage.RequestApprovalMessageID = requestApprovalMessageId;
            responseMessage.BaseMessage = baseMessage;

            responseMessage.Response = Convert.ToBoolean(response);
            db.ResponseApprovalMessage.Add(responseMessage);
            RequestApprovalMessage existingRequestMessage = db.RequestApprovalMessage.Find(requestApprovalMessageId);
            BaseMessage            existingBaseMessage    = db.BaseMessage.Where(b => b.BaseMessageID == existingRequestMessage.BaseMessageID).FirstOrDefault();

            // BaseMessage existingRequestMessage = db.BaseMessage.Find(requestApprovalMessageId);

            existingBaseMessage.MessageReadDate    = DateTime.Now;
            db.Entry(existingRequestMessage).State = EntityState.Modified;

            db.SaveChanges();


            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        private IEnumerable <ResponseApprovalMessage> GetResponseApprovalMessage(List <CourseTeacher> teachersCourse, CourseOccurrence courseOccurrence)
        {
            List <ResponseApprovalMessage> responseApprovalMessageList = new List <ResponseApprovalMessage>();

            foreach (Teacher teacher in teachersCourse.Select(t => t.Teacher).ToList())
            {
                ResponseApprovalMessage responseToAdd = (ResponseApprovalMessage)db.ResponseApprovalMessage.Where(x => x.BaseMessage.SenderID == teacher.TeacherId && x.RequestApprovalMessage.CourseOccurrence.CourseOccurrenceID == courseOccurrence.CourseOccurrenceID).ToList().LastOrDefault();
                responseApprovalMessageList.Add(responseToAdd);
            }

            return(responseApprovalMessageList);
        }
Beispiel #4
0
        public string GetResponseStatus(int requestApprovalId)
        {
            ResponseApprovalMessage responseMessage = db.ResponseApprovalMessage.Where(r => r.RequestApprovalMessageID == requestApprovalId).FirstOrDefault();

            return(responseMessage.Response.ToString());
        }