Esempio n. 1
0
 public int Update(NtfNotification newNotification)
 {
     NtfNotification oldNotification = RetrieveNotificationById(newNotification.NotificationId);
     context.Entry(oldNotification).State = EntityState.Deleted;
     context.Entry(newNotification).State = EntityState.Modified;
     return context.SaveChanges();           
 }
Esempio n. 2
0
 public int CreateUser(SecUser secUser)
 {
     context.SecUser.Add(secUser);
     foreach (var sur in secUser.SecUserRole)
     {
         context.SecUserRole.Add(sur);
     }
     context.SaveChanges();
     return(secUser.UserId);
 }
Esempio n. 3
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();
        }
Esempio n. 4
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();
            }


            
        }
 public void Insert(QmsKnowledgebase entity)
 {
     context.Add(entity);
     context.SaveChanges();
 }        
Esempio n. 6
0
 //public int SavePermission(string newPermissionCode, string newPermissionLabel) //(SecPermission secPermission)
 public int SavePermission(SecPermission secPermission)
 {
     context.SecPermission.Add(secPermission);
     context.SaveChanges();
     return(secPermission.PermissionId);
 }
Esempio n. 7
0
 public int CreateRole(SecRole secRole)
 {
     _context.SecRole.Add(secRole);
     _context.SaveChanges();
     return(secRole.RoleId);
 }
Esempio n. 8
0
 public int CreatePermission(SecPermission secPermission)
 {
     _context.SecPermission.Add(secPermission);
     _context.SaveChanges();
     return(secPermission.PermissionId);
 }
Esempio n. 9
0
 public void Save()
 {
     context.SaveChanges();
 }
Esempio n. 10
0
 public int CreateOrganization(SecOrg secOrg)
 {
     _context.SecOrg.Add(secOrg);
     _context.SaveChanges();
     return(secOrg.OrgId);
 }
Esempio n. 11
0
 internal void SaveEntry(SecSecuritylog logEntry)
 {
     context.SecSecuritylog.Add(logEntry);
     context.SaveChanges();
 }
Esempio n. 12
0
 internal int SaveEmailLog(NtfEmaillog emaillog)
 {
     this.context.Add(emaillog);
     return(context.SaveChanges());
 }
Esempio n. 13
0
 public int Create(SysModule newModule)
 {
     context.SysModule.Add(newModule);
     context.SaveChanges();
     return(newModule.ModuleId);
 }