public static bool InsertEMPNotification(int Type, string notification, int ActionByID, int ID, int UserID, string URL) { using (HRMEntities db = new HRMEntities()) { try { HR_Emp_Notification entity = new HR_Emp_Notification(); entity.Notification = notification; entity.NotificationTypeID = Type; entity.UserSpecific = true; entity.EmployeeID = UserID; entity.NotificationURL = URL; entity.ActionBY = ActionByID; entity.DateCreated = DateTime.Now; entity.Active = true; entity.Deleted = false; entity.RecordID = ID; db.HR_Emp_Notification.Add(entity); db.SaveChanges(); return(true); } catch (Exception) { db.Dispose(); } } return(false); }
public bool DeleteHRQualificationNotification(int ID) { try { HR_Emp_Notification entity = db.HR_Emp_Notification.FirstOrDefault(x => x.RecordID == ID); if (entity != null && entity.NotificationID > 0) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); return(true); } catch (Exception) { throw; } return(false); }
public bool InsertNotification(string roleType, int Type, string notification, int EmpID, int ID) { try { HR_Emp_Notification entity = new HR_Emp_Notification(); entity.Notification = notification; entity.NotificationTypeID = Type; if (Type == Convert.ToInt16(Utilities.NotificationType.Qualification)) { entity.NotificationURL = HRQualificationNotificationURL; } else if (Type == Convert.ToInt16(Utilities.NotificationType.Dependent)) { entity.NotificationURL = HRDependentNotificationURL; } else if (Type == Convert.ToInt16(Utilities.NotificationType.Pre_Job_History)) { entity.NotificationURL = HRPreJobNotificationURL; } entity.ActionBY = EmpID; entity.RoleType = roleType; entity.DateCreated = DateTime.Now; entity.Active = true; entity.Deleted = false; entity.RecordID = ID; db.HR_Emp_Notification.Add(entity); db.SaveChanges(); return(true); } catch (Exception) { throw; } return(false); }