Ejemplo n.º 1
0
        internal void addHistory(IAssignable item, User actionTakenByUser, string ActionDescription)
        {
            QmsWorkitemhistory itemHistory = new QmsWorkitemhistory();

            itemHistory.ActionTakenByUserId      = actionTakenByUser.UserId;
            itemHistory.CreatedAt                = DateTime.Now;
            itemHistory.WorkItemId               = item.Id;
            itemHistory.PreviousStatusId         = item.StatusId;
            itemHistory.PreviousAssignedByUserId = item.AssignedByUserId;
            itemHistory.PreviousAssignedToOrgId  = item.AssignedToOrgId;
            itemHistory.PreviousAssignedtoUserId = item.AssignedToUserId;
            itemHistory.ActionDescription        = ActionDescription;
            itemHistory.WorkItemTypeCode         = item.WorkItemType;
            context.Add(itemHistory);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
        private void sendIndividualMessage(IListable entity, NtfNotificationevent ne, User submitter, QmsWorkitemcomment comment)
        {
            if(submitter.UserId != entity.CreatedByUserId.Value) // if the person doing the action is the originator they don't get a message since they did the action
            {
                NtfNotification notification = new NtfNotification();
                notification.CreatedAt = DateTime.Now;
                notification.HasBeenRead = 0;
                notification.Title = string.Format(ne.TitleTemplate,entity.Id);
                notification.WorkitemId = entity.Id;
                notification.WorkItemTypeCode = WorkItemTypeEnum.CorrectiveActionRequest;
                notification.SendAsEmail = 1;
                notification.NotificationEventId = ne.NotificationEventId;
                notification.Message = entity.Message;
                switch(ne.NotificationEventCode)
                {
                    case CorrectiveActionNotificationType.CA_Assigned:
                        notification.UserId = entity.AssignedToUserId.Value;
//                        notification.Message = string.Format(ne.MessageTemplate,ca.Id, ca.AssignedAt.Value.ToShortDateString(),ca.EmplId,ca.Employee.FullName);
                        break;
                    case CorrectiveActionNotificationType.CA_Created:
                        notification.UserId = entity.CreatedByUserId.Value;
//                        notification.Message = string.Format(ne.MessageTemplate,ca.Id, ca.CreatedAt.ToShortDateString(),ca.EmplId,ca.Employee.FullName);
                        break;
                    case CorrectiveActionNotificationType.CA_Returned:
                        notification.UserId = entity.CreatedByUserId.Value;
//                        notification.Message = string.Format(ne.MessageTemplate,ca.Id, ca.UpdatedAt.Value.ToShortDateString(),ca.EmplId,ca.Employee.FullName);
                        break;
                    case CorrectiveActionNotificationType.CA_Closed:
                        notification.UserId = entity.CreatedByUserId.Value;
//                        notification.Message = string.Format(ne.MessageTemplate,ca.Id, ca.ResolvedAt.Value.ToShortDateString(),ca.EmplId,ca.Employee.FullName);
                        break;                    
                    case CorrectiveActionNotificationType.CA_Withdrawn:
                        notification.UserId = entity.AssignedToUserId.Value;
//                        notification.Message = string.Format(ne.MessageTemplate,ca.Id,  ca.UpdatedAt.Value.ToShortDateString(), ca.EmplId, ca.Employee.FullName);
                        break;
                    default:
                        //not a indivual message type
                        break;
                }
        
                context.Add(notification);
                context.SaveChanges();
            }


            
        }
Ejemplo n.º 3
0
 public void Insert(QmsKnowledgebase entity)
 {
     context.Add(entity);
     context.SaveChanges();
 }        
Ejemplo n.º 4
0
 public int Insert(NtfNotification notification)
 {
     context.Add(notification);
     return context.SaveChanges();
 }