public bool Update(VacancyViewModel vacancy) { var account = new Intranet.Common.AccountInfo(); var fullName = account.GetFullName(); var vac = new Vacancy() { Id = vacancy.Id, Location = vacancy.Location, Url = vacancy.Url, IsActive = vacancy.IsActive, ApproverName = vacancy.ApproverName, CreatedBy = vacancy.CreatedBy, CreatedDate = vacancy.CreatedDate, IsDeleted = false, LastUpdatedDate = DateTime.Now, LastUpdatedBy = fullName, IsApproved =vacancy.IsApproved }; VacancyService.UpdateVacancy(vac); if (!vacancy.IsApproved) { var notificationExited = NotificationService.GetAllNotificationByRecoedId("Vacancies", vacancy.Id); if(notificationExited!=null) NotificationService.DeleteNotification(notificationExited); var notification = new Notification() { ReciverName = vacancy.ApproverName, SenderName = fullName, CreatedBy = vacancy.CreatedBy, LastUpdatedBy = fullName, LastUpdatedDate = DateTime.Now, CreatedDate = vacancy.CreatedDate, RecordId = vacancy.Id, ModuleName = "Vacancies", IsApproved = false }; NotificationService.InsertNotification(notification); SendStatusUpdateEmail(vacancy, vacancy.ApproverName, false, vacancy.CreatedBy); } else { var notificationExited = NotificationService.GetAllNotificationByRecoedId("Vacancies", vacancy.Id); if (notificationExited != null) NotificationService.DeleteNotification(notificationExited); var notification = new Notification() { ReciverName = vacancy.CreatedBy, SenderName = vacancy.ApproverName, CreatedBy = vacancy.CreatedBy, LastUpdatedBy = fullName, LastUpdatedDate = DateTime.Now, CreatedDate = vacancy.CreatedDate, RecordId = vacancy.Id, ModuleName = "Vacancies", IsApproved = true }; NotificationService.InsertNotification(notification); SendStatusUpdateEmail(vacancy, vacancy.CreatedBy, false, vacancy.CreatedBy); } return true; }
public bool Add(VacancyViewModel vacancy) { var account = new Intranet.Common.AccountInfo(); var fullName = account.GetFullName(); var vac = new Vacancy() { Location = vacancy.Location, Url = vacancy.Url, IsActive = vacancy.IsActive, ApproverName = vacancy.ApproverName, CreatedBy = fullName, CreatedDate = DateTime.Now, LastUpdatedBy = fullName, LastUpdatedDate = DateTime.Now, IsDeleted = false, IsApproved = false }; return VacancyService.InsertVacancy(vac); }