예제 #1
0
        public int Add(int queueID, string note)
        {
            //todo: get employee id from session

            QueueNote queueNote = new QueueNote()
            {
                QueueID = queueID, Note = note, CreatedOn = DateTime.Now, CreatedBy = 2
            };

            using (var db = new ModelDBContext())
            {
                db.QueueNotes.Add(queueNote);
                db.SaveChanges();
            }

            return(queueNote.QueueNoteID);
        }
예제 #2
0
        /// <summary>
        /// add a new note for a queue
        /// </summary>
        /// <param name="queueID">the queue to add the note to</param>
        /// <param name="note">the note to add</param>
        /// <param name="employeeID">the employee id added the note</param>
        /// <returns></returns>
        public int Add(int queueID, string note, int employeeID)
        {
            QueueNote queueNote = new QueueNote()
            {
                QueueID = queueID, Note = note, CreatedOn = DateTime.Now, CreatedBy = employeeID
            };

            using (var db = new ModelDBContext())
            {
                db.QueueNotes.Add(queueNote);

                //when adding a note always set the queue status to in progress
                var inProgressQueueStatus = db.QueueStatus.FirstOrDefault(q => q.QueueStatusID == (int)QueueStatusEnum.InProgress);
                if (inProgressQueueStatus != null)
                {
                    var queue = db.Queues.Where(q => q.QueueID == queueID).First();
                    queue.QueueStatusID = inProgressQueueStatus.QueueStatusID;
                }
                db.SaveChanges();
            }

            return(queueNote.QueueNoteID);
        }