public bool Add(ViewModel.UpcomingEvents upcomingEvents)
        {

            var account = new Intranet.Common.AccountInfo();
            var entityEvent = new UpcomingEvents();
            TimeSpan interval = TimeSpan.Parse(upcomingEvents.EventTime); 
            var fullName = account.GetFullName();
            entityEvent.IsDeleted = false;
            entityEvent.CreatedDate = DateTime.Now;
            entityEvent.CreatedBy = fullName;
            entityEvent.LastUpdatedDate = DateTime.Now;
            entityEvent.LastUpdatedBy = fullName;
            entityEvent.Title = upcomingEvents.Title;
            entityEvent.Location = upcomingEvents.Location;
            entityEvent.Organizers = upcomingEvents.Organizers;
            entityEvent.StartDate = upcomingEvents.StartDate;
            entityEvent.EndDate = upcomingEvents.EndDate;
            entityEvent.Venue = upcomingEvents.Venue;
            entityEvent.Duration = upcomingEvents.Duration;
            entityEvent.IsActive = upcomingEvents.IsActive;
            entityEvent.Date = upcomingEvents.Date.Add(interval);
            entityEvent.ApproverName = upcomingEvents.ApproverName;
            entityEvent.IsApproved = upcomingEvents.IsApproved;


            var insertedRec = UpcomingEventsService.InsertUpcomingEvents(entityEvent);
            //to do change the logic

            var notification = new Notification()
            {
                ReciverName = upcomingEvents.ApproverName,
                SenderName = fullName,
                CreatedBy = fullName,
                LastUpdatedBy = fullName,
                LastUpdatedDate = DateTime.Now,
                CreatedDate = DateTime.Now,
                RecordId = insertedRec.Id,
                ModuleName = "Event",
                IsApproved = false
            };
            NotificationService.InsertNotification(notification);
            SendStatusUpdateEmail(upcomingEvents, upcomingEvents.ApproverName, true, fullName);


            return true;
            
        }
        public bool Update(ViewModel.UpcomingEvents upcomingEvents)
        {

            var account = new Intranet.Common.AccountInfo();
            var fullName = account.GetFullName();



            var entityEvent = new UpcomingEvents();
            TimeSpan interval = TimeSpan.Parse(upcomingEvents.EventTime);
            entityEvent.Id = upcomingEvents.Id;
            entityEvent.LastUpdatedDate = DateTime.Now;
            entityEvent.LastUpdatedBy = fullName;
            entityEvent.CreatedDate = upcomingEvents.CreatedDate;
            entityEvent.IsDeleted = false;
            entityEvent.CreatedBy = upcomingEvents.CreatedBy;
            entityEvent.Title = upcomingEvents.Title;
            entityEvent.Location = upcomingEvents.Location;
            entityEvent.Organizers = upcomingEvents.Organizers;
            entityEvent.StartDate = upcomingEvents.StartDate;
            entityEvent.EndDate = upcomingEvents.EndDate;
            entityEvent.Venue = upcomingEvents.Venue;
            entityEvent.Duration = upcomingEvents.Duration;
            entityEvent.IsActive = upcomingEvents.IsActive;
            entityEvent.Date = Convert.ToDateTime(upcomingEvents.Date.ToShortDateString()).Add(interval);
            entityEvent.ApproverName = upcomingEvents.ApproverName;
            entityEvent.IsApproved = upcomingEvents.IsApproved;

            if (!upcomingEvents.IsApproved)
            {
                var notificationExited = NotificationService.GetAllNotificationByRecoedId("Event",
                    upcomingEvents.Id);
                NotificationService.DeleteNotification(notificationExited);
                var notification = new Notification()
                {
                    ReciverName = upcomingEvents.ApproverName,
                    SenderName = fullName,
                    CreatedBy = upcomingEvents.CreatedBy,
                    LastUpdatedBy = fullName,
                    LastUpdatedDate = DateTime.Now,
                    CreatedDate = upcomingEvents.CreatedDate,
                    RecordId = upcomingEvents.Id,
                    ModuleName = "Event",
                    IsApproved = false
                };
                NotificationService.InsertNotification(notification);
                SendStatusUpdateEmail(upcomingEvents, upcomingEvents.ApproverName, false, upcomingEvents.CreatedBy);
            }
            else
            {
                var notificationExited = NotificationService.GetAllNotificationByRecoedId("Event",
                       upcomingEvents.Id);
                if (notificationExited != null)
                    NotificationService.DeleteNotification(notificationExited);

                var notification = new Notification()
                {
                    ReciverName = upcomingEvents.CreatedBy,
                    SenderName = upcomingEvents.ApproverName,
                    CreatedBy = upcomingEvents.CreatedBy,
                    LastUpdatedBy = fullName,
                    LastUpdatedDate = DateTime.Now,
                    CreatedDate = upcomingEvents.CreatedDate,
                    RecordId = upcomingEvents.Id,
                    ModuleName = "Event",
                    IsApproved = true
                };
                NotificationService.InsertNotification(notification);
                SendStatusUpdateEmail(upcomingEvents, upcomingEvents.CreatedBy, false, upcomingEvents.CreatedBy);
            }




            return UpcomingEventsService.UpdateUpcomingEvents(entityEvent);
            
        }