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(); }
public int CreateUser(SecUser secUser) { context.SecUser.Add(secUser); foreach (var sur in secUser.SecUserRole) { context.SecUserRole.Add(sur); } context.SaveChanges(); return(secUser.UserId); }
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(); }
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(); }
//public int SavePermission(string newPermissionCode, string newPermissionLabel) //(SecPermission secPermission) public int SavePermission(SecPermission secPermission) { context.SecPermission.Add(secPermission); context.SaveChanges(); return(secPermission.PermissionId); }
public int CreateRole(SecRole secRole) { _context.SecRole.Add(secRole); _context.SaveChanges(); return(secRole.RoleId); }
public int CreatePermission(SecPermission secPermission) { _context.SecPermission.Add(secPermission); _context.SaveChanges(); return(secPermission.PermissionId); }
public void Save() { context.SaveChanges(); }
public int CreateOrganization(SecOrg secOrg) { _context.SecOrg.Add(secOrg); _context.SaveChanges(); return(secOrg.OrgId); }
internal void SaveEntry(SecSecuritylog logEntry) { context.SecSecuritylog.Add(logEntry); context.SaveChanges(); }
internal int SaveEmailLog(NtfEmaillog emaillog) { this.context.Add(emaillog); return(context.SaveChanges()); }
public int Create(SysModule newModule) { context.SysModule.Add(newModule); context.SaveChanges(); return(newModule.ModuleId); }