Esempio n. 1
0
        public IActionResult AddConference(ConferenceDto conferenceDto)
        {
            var entity = new ConferenceEntity();

            _eventMapper.FillConferenceEntityWithDto(conferenceDto, entity);
            _eventRepository.AddEvent(entity);
            return(CreatedAtAction("GetEvent", new { eventId = entity.Id }, entity));
        }
        private async void _addEventToDatabase(Event newEvent)
        {
            if (newEvent is RecurringEvent tempRecurring)
            {
                _messageStatus = await Task.Run(() => _recurringEventRepository.AddEvent(tempRecurring));
            }
            else
            {
                _messageStatus = await Task.Run(() => _eventRepository.AddEvent(newEvent));
            }

            if (_messageStatus.ErrorStatus)
            {
                DialogResult result = MessageBox.Show(_messageStatus.Message, "ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                if (result == DialogResult.Cancel)
                {
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show(_messageStatus.Message, "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
        }
Esempio n. 3
0
        public ActionResult AddEvent(Event ev)
        {
            ev.Total = 0;
            EventRepository repo = new EventRepository(Properties.Settings.Default.ConnString);

            repo.AddEvent(ev);
            return(RedirectToAction("GetEvents", "Events"));
        }
Esempio n. 4
0
        public virtual IActionResult AddEvent([FromBody] Event body)
        {
            var result = _eventRepository.AddEvent(body);

            if (result == null)
            {
                return(BadRequest());
            }
            return(new ObjectResult(result));
        }
        public ActionResult AddEvent(CreateEventRequest createRequest)
        {
            var newEvent = _eventRepository.AddEvent(
                createRequest.Description,
                createRequest.Location,
                createRequest.Year,
                createRequest.IsCorrect);

            return(Created($"/api/event/{newEvent.Id}", newEvent));
        }
Esempio n. 6
0
        public void AddNewEvent(string employeeName)
        {
            string eventDescription = employeeName + "Added";
            Event  @event           = new Event()
            {
                EventDescription = eventDescription
            };

            EventRepository.AddEvent(@event);
        }
        public JsonResult CreateEvent(Events events)
        {
            string userid = Session["UserID"].ToString();

            eventRepository.AddEvent(events, userid);
            var status = true;

            return(new JsonResult {
                Data = new { status = status }
            });
        }
Esempio n. 8
0
        public void Given_EventsRepository_When_GettingAllEventsUntillDate_ThenShouldBeProperlyReturned()
        {
            RunOnDatabase(act =>
            {
                var repository = new EventRepository(act);

                var firstEvent = Event.Create("Fii", "fii ML", "Seminar de Machine Learning",
                                              "La Seminar",
                                              DateTime.Now, DateTime.Now.AddHours(2), "no-image");

                var secondEvent = Event.Create("Fii", "fii .net", "Laborator de .net",
                                               "Laborator de .net impreuna cu colegii meu",
                                               DateTime.Now.AddHours(2), DateTime.Now.AddHours(3), "no-image");

                repository.AddEvent(firstEvent);
                repository.AddEvent(secondEvent);

                Assert.AreEqual(1, repository.GetEventsUntill(DateTime.Now.AddHours(1)).Count);
            });
        }
        public ActionResult <int> AddEvent(CreateEventRequest createRequest)
        {
            if (!_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "users must have a name and date" }));
            }

            var newLeapee = _eventRepository.AddEvent(createRequest.EventName, createRequest.EventDate);

            return(Created($"api/event/{newLeapee.Id}", newLeapee));
        }
Esempio n. 10
0
        public ActionResult AddEvent(Event createRequest)
        {
            //if (_validator.Validate(createRequest))
            //    return BadRequest(new { error = "customer must have a First Name, Last Name and Email " });
            var newEvent = _eventRepository.AddEvent(createRequest);

            foreach (var volunteerServiceId in createRequest.SelectedServiceIds)
            {
                _eventVolunteerServiceRepository.AddEventVolunteerService(newEvent.Id, createRequest.UserVolunteerId, volunteerServiceId);
            }
            return(Created($"/api/event", newEvent));
        }
Esempio n. 11
0
        public ActionResult AddEvent(CreateEventRequest createRequest)
        {
            if (_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "users must have a name and event location" }));
            }

            var newEvent = _eventRepository.AddEvent(createRequest.Name,
                                                     createRequest.EventTime,
                                                     createRequest.EventLocation,
                                                     createRequest.NameOfEvent);

            return(Created($"api/event/{newEvent.Id}", newEvent));
        }
Esempio n. 12
0
        public JsonResult AddEvent([Bind(Include = "Name, Description")] EventViewModel item)
        {
            Event @event      = new Event(item);
            var   currentUser = User.Identity.GetUserId();

            if (_eventRepository.AddEvent(ref @event, currentUser))
            {
                return(Json(new EventViewModel(@event), JsonRequestBehavior.DenyGet));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 13
0
        public void Given_EventsRepository_When_AddingEvent_ThenShouldBeProperlyAdded()
        {
            RunOnDatabase(act =>
            {
                var repository = new EventRepository(act);

                var ev = Event.Create("Fii", "fii .net", "Laborator de .net",
                                      "Laborator de .net impreuna cu colegii meu",
                                      DateTime.Now.AddHours(1), DateTime.Now.AddHours(2), "no-image");

                repository.AddEvent(ev);

                Assert.AreEqual(1, repository.GetAllActiveEvents().Count);
            });
        }
Esempio n. 14
0
        public async Task <ActionResult> AddEvent([Bind(Include = "EventId,EventName,EventDesc, UserAddress, EventVenueId,EventDate,EventTime,EventFee, EventType")] EventViewModel events, int EventVenueId)
        {
            var getRecord = await eventRepository.AddEvent(events, events.EventVenueId);

            if (getRecord != null)
            {
                ViewBag.DisplayMessage = "success";
                ModelState.AddModelError("", "Event created successfully!");
            }
            else
            {
                ViewBag.DisplayMessage = "Info";
                ModelState.AddModelError("", "Ooops, something went wrong, event not created! kindly check your input and try again.");
            }
            LoadDropDownList();
            return(View());
        }
Esempio n. 15
0
        public void Given_EventsRepository_When_DeletingAnEvent_ThenShouldBeProperlyDeleted()
        {
            RunOnDatabase(act =>
            {
                var repository = new EventRepository(act);

                var firstEvent = Event.Create("Fii", "fii ML", "Seminar de Machine Learning",
                                              "La Seminar",
                                              DateTime.Now, DateTime.Now.AddHours(2), "no-image");

                repository.AddEvent(firstEvent);

                repository.DeleteEvent(firstEvent);

                Assert.AreEqual(0, repository.GetAllActiveEvents().Count);
            });
        }
Esempio n. 16
0
        public ActionResult AddEvent(CreateEventRequest createRequest)
        {
            if (_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "event must have a name" }));
            }

            var newEvent = _eventRepository.AddEvent(
                createRequest.EventName,
                createRequest.Description,
                createRequest.Date,
                createRequest.Location,
                createRequest.IsCorrected,
                createRequest.LeapeeId
                );

            return(Created($"api/events/{newEvent.Id}", newEvent));
        }
Esempio n. 17
0
        private async void AddUpdateEvent()
        {
            if (tbx_name.Text.Equals(""))
            {
                MessageBox.Show(Strings.ErrorEmptyName, Strings.Error);
                return;
            }
            EventRepository eventRepository = EventRepository.Instance;

            temporaryEvent.Name        = tbx_name.Text;
            temporaryEvent.TypeName    = cbx_type.Text;
            temporaryEvent.Location    = tbx_location.Text;
            temporaryEvent.CreatedDate = dtp_date.Value;
            temporaryEvent.Note        = rtbx_note.Text;

            RecurringEvent recurringEvent = new RecurringEvent();

            recurringEvent.Status  = cbx_frequency.Text;
            recurringEvent.EndDate = dtp_enddate.Value;

            bool result = false;

            if (temporaryEvent.TypeName.Equals("Task"))
            {
                temporaryEvent.Type = false;
            }
            else
            {
                temporaryEvent.Type = true;
            }

            Contact contact = (Contact)cbx_contact.SelectedItem;

            if (contact == null)
            {
                if (string.IsNullOrWhiteSpace(cbx_contact.Text))
                {
                    temporaryEvent.ContactID = 0;
                }
                else
                {
                    ContactRepository contactsRepository = ContactRepository.Instance;
                    temporaryEvent.ContactID = await Task.Run(() => contactsRepository.AddContact(new Contact
                    {
                        Name = cbx_contact.Text, UserID = Instances.User.ID
                    }));
                }
            }
            else
            {
                temporaryEvent.ContactID = contact.ID;
            }

            if (chbx_recurring.Checked && temporaryEvent.ID == 0)
            {
                RecurringEvent temporaryRecurringEvent = new RecurringEvent
                {
                    Name        = temporaryEvent.Name,
                    Location    = temporaryEvent.Location,
                    Type        = temporaryEvent.Type,
                    Note        = temporaryEvent.Note,
                    CreatedDate = temporaryEvent.CreatedDate,
                    UserID      = temporaryEvent.UserID,
                    ContactID   = temporaryEvent.ContactID
                };

                if (chbx_infinite.Checked)
                {
                    temporaryRecurringEvent.EndDate = DateTime.MinValue;
                }
                else
                {
                    temporaryRecurringEvent.EndDate = dtp_enddate.Value;
                }

                temporaryRecurringEvent.Status = cbx_frequency.Text;

                RecurringEventRepository recurringEventRepository = RecurringEventRepository.Instance;
                bool i = await Task.Run(() => recurringEventRepository.AddRecurringEvent(temporaryRecurringEvent));

                if (i == false)
                {
                    MessageBox.Show(Strings.SomethingError);
                    return;
                }
            }

            if (temporaryEvent.ID > 0)
            {
                result = await Task.Run(() => eventRepository.EditEvent(temporaryEvent));
            }
            else
            {
                result = await Task.Run(() => eventRepository.AddEvent(temporaryEvent));
            }

            if (temporaryEvent.ID > 0 && result)
            {
                MessageBox.Show(Strings.EditEventOkay, Strings.Success);
                Dispose();
            }
            else if (result)
            {
                MessageBox.Show(Strings.AddEventOkay, Strings.Success);
                Dispose();
            }
            else
            {
                MessageBox.Show(Strings.SomethingError, Strings.Error);
            }
        }
Esempio n. 18
0
        public ActionResult AddEvent(CreateEventRequest createRequest)
        {
            var newEvent = _eventRepository.AddEvent(createRequest.Name, createRequest.Date, createRequest.IsCorrected);

            return(Created($"api/leapers/{newEvent.Id}", newEvent));
        }
Esempio n. 19
0
        private async void DoRecurringEvent()
        {
            EventRepository          transactionRepository    = EventRepository.Instance;
            RecurringEventRepository recurringEventRepository = RecurringEventRepository.Instance;

            if (Instances.User == null)
            {
                return;
            }
            List <RecurringEvent> recurringEvents = recurringEventRepository.GetRecurringEvents(Instances.User.ID);

            foreach (RecurringEvent recurringEvent in recurringEvents)
            {
                if (Instances.User == null)
                {
                    return;
                }
                if (DateTime.Now > recurringEvent.EndDate && recurringEvent.EndDate != DateTime.MinValue)
                {
                    continue;
                }
                DateTime accTime = Instances.User.LastAccessDate;
                DateTime nowTime = DateTime.Now;
                int      days    = (nowTime - accTime).Days;
                DateTime recTime = Instances.User.LastAccessDate;
                TimeSpan ts      = new TimeSpan(
                    recurringEvent.CreatedDate.Hour,
                    recurringEvent.CreatedDate.Minute,
                    recurringEvent.CreatedDate.Second
                    );
                recTime = recTime.Date + ts;
                for (int i = 0; i <= days; i++)
                {
                    if (recurringEvent.Status.Equals("Weekly"))
                    {
                        if (recTime.DayOfWeek != recurringEvent.CreatedDate.DayOfWeek)
                        {
                            recTime = recTime.AddDays(1);
                            continue;
                        }
                    }
                    if (recurringEvent.Status.Equals("Monthly"))
                    {
                        if (recTime.Day != recurringEvent.CreatedDate.Day)
                        {
                            recTime = recTime.AddDays(1);
                            continue;
                        }
                    }
                    if (recurringEvent.Status.Equals("Yearly"))
                    {
                        string recTimeString     = recTime.ToString("dd/MM");
                        string createdDateString = recurringEvent.CreatedDate.ToString("dd/MM");
                        if (!recTimeString.Equals(createdDateString))
                        {
                            recTime = recTime.AddDays(1);
                            continue;
                        }
                    }
                    if (recTime > accTime && recTime <= nowTime && recTime > recurringEvent.CreatedDate)
                    {
                        if (Instances.User == null)
                        {
                            return;
                        }
                        await Task.Run(() => transactionRepository.AddEvent(new Event
                        {
                            Name        = recurringEvent.Name,
                            UserID      = recurringEvent.UserID,
                            ContactID   = recurringEvent.ContactID,
                            Type        = recurringEvent.Type,
                            Location    = recurringEvent.Location,
                            Note        = recurringEvent.Note,
                            CreatedDate = recTime
                        }));

                        bw_recurring.ReportProgress(1, "New event has been added!");
                    }
                    recTime = recTime.AddDays(1);
                }
            }
        }
        static void Main(string[] args)
        {
            // Initialize Event Repository and create events
            var eventRepository  = new EventRepository();
            var leaperRepository = new LeaperRepository();

            var myLeaper = new Leaper();

            leaperRepository.AddLeaper(myLeaper);

            var event1 = new Event
            {
                Location   = "Moon Landing",
                Date       = new DateTime(2069, 07, 20),
                Host       = "Buzz Aldrin",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event1);

            var event2 = new Event
            {
                Location   = "Assassination of Franz Ferdinand",
                Date       = new DateTime(1914, 06, 28),
                Host       = "Gavrilo Princip",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event2);

            var event3 = new Event
            {
                Location   = "Attack on Pearl Harbor",
                Date       = new DateTime(1941, 12, 7),
                Host       = "Franklin D. Roosevelt",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event3);

            var event4 = new Event
            {
                Location   = "Assassination of J.F.K.",
                Date       = new DateTime(1967, 08, 20),
                Host       = "Jackie Onassis Kennedy",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event4);

            var event5 = new Event
            {
                Location   = "Signing of the Treaty of Versailles",
                Date       = new DateTime(1919, 06, 28),
                Host       = "Woodrow Wilson",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event5);

            var event6 = new Event
            {
                Location   = "Bombing of Hiroshima",
                Date       = new DateTime(1945, 08, 06),
                Host       = "Major General Curtis Lemay",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event6);

            var event7 = new Event
            {
                Location   = "Boston Tea Party",
                Date       = new DateTime(1773, 12, 16),
                Host       = "Samuel Adams",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event7);

            var event8 = new Event
            {
                Location   = "Day Frito-Lay stops making Doritos 3D",
                Date       = new DateTime(2092, 02, 16),
                Host       = "Someone who really freakin' loves Doritos 3D",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event8);

            var event9 = new Event
            {
                Location   = "Fall of the Berlin Wall",
                Date       = new DateTime(1989, 11, 09),
                Host       = "Mikhail Gorbachev",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event9);

            var event10 = new Event
            {
                Location   = "Chernobyl Disaster",
                Date       = new DateTime(1986, 04, 26),
                Host       = "Anatoly Dyatlov",
                IsPutRight = false,
            };

            eventRepository.AddEvent(event10);



            // Creates a Dictionary and adds each event to it
            Dictionary <int, Event> eventDictionary = new Dictionary <int, Event>();
            var allEvents = eventRepository.GetAllEvents();

            for (var i = 0; i < allEvents.Count; i++)
            {
                eventDictionary.Add(i, eventRepository.GetAllEvents()[i]);
            }

            // Checks if the leaper has leaped yet
            // If they have and leap again the "would you like to leap" prompt is skipped
            int leapCount = 0;

            void LeapPrompt()
            {
                var budget = new Budget();

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine((leapCount == 0 ? " After theorizing that time travel could happen within your own lifetime,\n" +
                                   " you stepped into the Quantum Leap accelerator, and vanished.\n " +
                                   "When you awoke you found yourself trapped in the past,\n" +
                                   " facing a mirror image that was not your own.\n" +
                                   " Now driven by an unknown force to change history for the better\n" +
                                   " you are guided by AI (a Hologram that only you can see and hear).\n AI asks in a robotic voice... \n " : null));
                Console.ForegroundColor = ConsoleColor.White;

                int windowWidth = Console.WindowWidth;
                int size        = windowWidth;

                Console.WriteLine();
                Console.WriteLine("".PadLeft(size, '=').PadRight(size, '='));
                Console.WriteLine();

                Console.WriteLine("Press enter to continue...");
                Console.ReadKey();
                Console.Clear();

                Console.WriteLine((leapCount == 0 ? $"Welcome, traveller. Would you like to take a leap? (y/n)" : null));
                Console.WriteLine();
                string answer = (leapCount == 0 ? Console.ReadLine().ToUpper() : "Y");

                while (true)
                {
                    if (answer == "N")
                    {
                        Console.Clear();
                        Console.WriteLine();
                        Console.WriteLine("FINE! BE BORING!");
                        Console.WriteLine();
                        Environment.Exit(0);
                        break;
                    }

                    if (answer == "Y")
                    {
                        if (myLeaper.Name == null)
                        {
                            Console.Clear();
                            Console.WriteLine();
                            Console.WriteLine("You are very brave to attempt such a feat. What's your name?");
                            Console.WriteLine();
                            var nameResponse = Console.ReadLine();
                            Console.Clear();
                            myLeaper.Name = nameResponse;
                        }

                        // Loops through the dictionary and prints each event, also adds 1 to each Key so
                        // that they don't start with 0

                        // Filter out current event if user has already made a leap

                        // Removes event permanently

                        if (myLeaper.CurrentEventObj != null)
                        {
                            var currentEventToRemove = eventDictionary.First(x => x.Value == myLeaper.CurrentEventObj).Key;
                            eventDictionary.Remove(currentEventToRemove);
                        }

                        foreach (var singleEvent in eventDictionary)
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine();
                            Console.WriteLine($"{singleEvent.Key + 1} Location: {singleEvent.Value.Location}");
                            Console.WriteLine($"Date: {singleEvent.Value.Date}");
                            Console.WriteLine($"Host: {singleEvent.Value.Host}");
                            Console.WriteLine($"Made Right? {singleEvent.Value.IsPutRight}");

                            // Doesn't let current event write to the console when making a new leap

                            //Console.ForegroundColor = ConsoleColor.Yellow;
                            //Console.WriteLine();
                            //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"{singleEvent.Key + 1} Location: {singleEvent.Value.Location}"));
                            //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Date: {singleEvent.Value.Date}"));
                            //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Host: {singleEvent.Value.Host}"));
                            //Console.WriteLine((singleEvent.Value == myLeaper.CurrentEventObj ? null : $"Made Right? {singleEvent.Value.IsPutRight}"));
                        }
                        Console.ForegroundColor = ConsoleColor.White;
                        // Expects the user to enter the number associated with the event
                        // and subtracts 1 to match dictionary's index
                        Console.WriteLine();
                        Console.WriteLine($"Please select the leap you would like to complete, {myLeaper.Name}.");
                        Console.WriteLine();
                        int chosenLeapIndex = int.Parse(Console.ReadLine());
                        Console.Clear();
                        var chosenLeap = eventDictionary[chosenLeapIndex - 1];

                        // Returns the number of days between today and the chosen leap
                        var attemptedLeap = eventRepository.DaysBetweenEvents(eventRepository.StartingDate(), chosenLeap.Date);

                        // Uses TimeSpan, that's where .Days comes from
                        Console.WriteLine();
                        Console.WriteLine($"Days to leap: {Math.Abs(attemptedLeap.Days)}");

                        // Prints cost to leap between two dates
                        Console.WriteLine();
                        Console.WriteLine($"Cost to leap: ${budget.TotalLeapCost(attemptedLeap)}");

                        // Checks budget
                        Console.WriteLine();
                        budget.checkBalance(budget.TotalLeapCost(attemptedLeap), chosenLeap);

                        Console.WriteLine();
                        leaperRepository.TakeTheLeap(chosenLeap, myLeaper);

                        Console.WriteLine();
                        Console.WriteLine($"You are now inhabiting the body of {myLeaper.CurrentEventObj.Host}.");

                        Console.WriteLine();
                        Console.WriteLine("You arrived just in time to make this situation right.");

                        var futureDateToChange = eventRepository.UpdateEvent(chosenLeap.Date);

                        Console.WriteLine();
                        Console.WriteLine($"However, your actions have also changed the {futureDateToChange.Location}.");

                        Console.WriteLine();
                        Console.WriteLine("Take heed. Every action you take throughout time can change the course of history.");

                        break;
                    }
                    Console.WriteLine();
                    Console.WriteLine("Please reply with y or n");
                    answer = Console.ReadLine().ToUpper();
                }
            }

            void Prompter()
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine();
                Console.WriteLine("1. Make another leap");
                Console.WriteLine("2. See leap history");
                Console.WriteLine("3. End Journey");
                Console.WriteLine();
                int resp = int.Parse(Console.ReadLine());

                Console.Clear();
                ExecuteProgram(resp);
            }

            void ExecuteProgram(int response)
            {
                if (response == 1)
                {
                    LeapPrompt();
                    Prompter();
                }
                else if (response == 2)
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    leaperRepository.GetLeapHistory(myLeaper);
                    Prompter();
                }
                else if (response == 3)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Adios!");
                    return;
                }
            }

            LeapPrompt();
            leapCount++;

            Console.WriteLine();
            int windowWidth1 = Console.WindowWidth;
            int size1        = windowWidth1;

            Console.WriteLine();
            Console.WriteLine("".PadLeft(size1, '=').PadRight(size1, '='));
            Console.WriteLine();


            Prompter();
        }
Esempio n. 21
0
        private void InsertEventDetails(DataTable eventTable)
        {
            try
            {
                RoleRepository roleRepository = new RoleRepository();
                Role           role           = roleRepository.FindRoleId(ConstantValues.POC);

                foreach (DataRow row in eventTable.Rows)
                {
                    string          eventID         = row["Event ID"].ToString();
                    EventRepository eventRepository = new EventRepository();
                    Event           Event           = eventRepository.FindEvent(eventID);
                    if (Event == null)
                    {
                        Event         = new Event();
                        Event.EventId = eventID;
                        if (!row.IsNull("Month"))
                        {
                            Event.Month = row["Month"].ToString();
                        }
                        if (!row.IsNull("Base Location"))
                        {
                            Event.Location = row["Base Location"].ToString();
                        }
                        if (!row.IsNull("Beneficiary Name"))
                        {
                            Event.BeneficaryName = row["Beneficiary Name"].ToString();
                        }
                        if (!row.IsNull("Venue Address"))
                        {
                            Event.Address = row["Venue Address"].ToString();
                        }
                        if (!row.IsNull("Council Name"))
                        {
                            Event.CouncilName = row["Council Name"].ToString();
                        }
                        if (!row.IsNull("Project"))
                        {
                            Event.Project = row["Project"].ToString();
                        }
                        if (!row.IsNull("Category"))
                        {
                            Event.Category = row["Category"].ToString();
                        }
                        if (!row.IsNull("Event Name"))
                        {
                            Event.EventName = row["Event Name"].ToString();
                        }
                        if (!row.IsNull("Event Description"))
                        {
                            Event.EventDescription = row["Event Description"].ToString();
                        }
                        if (!row.IsNull("Event Date (DD-MM-YY)"))
                        {
                            String[] date      = row["Event Date (DD-MM-YY)"].ToString().Split(new[] { '-' });
                            int      day       = Convert.ToInt32(date[0]);
                            int      month     = Convert.ToInt32(date[1]);
                            int      a         = 20;
                            int      year      = int.Parse(a.ToString() + date[2].ToString());
                            DateTime eventDate = new DateTime(year, month, day);
                            Event.EventDate = eventDate;
                        }
                        if (!row.IsNull("Total no. of volunteers"))
                        {
                            Event.VolunteerCount = Convert.ToInt32(row["Total no. of volunteers"]);
                        }
                        if (!row.IsNull("Total Volunteer Hours"))
                        {
                            Event.VolunteerHours = Convert.ToInt32(row["Total Volunteer Hours"]);
                        }
                        if (!row.IsNull("Total Travel Hours"))
                        {
                            Event.TravelHours = Convert.ToInt32(row["Total Travel Hours"]);
                        }
                        if (!row.IsNull("Overall Volunteering Hours"))
                        {
                            Event.TotalVolunteeringHours = Convert.ToInt32(row["Overall Volunteering Hours"]);
                        }
                        if (!row.IsNull("Lives Impacted"))
                        {
                            Event.LivesImpacted = Convert.ToInt32(row["Lives Impacted"]);
                        }
                        if (!row.IsNull("Activity Type"))
                        {
                            Event.ActivityType = Convert.ToInt32(row["Activity Type"]);
                        }
                        if (!row.IsNull("Status"))
                        {
                            Event.Status = row["Status"].ToString();
                        }
                        eventRepository.AddEvent(Event);

                        // Add POC User

                        String[] pocID = null; String[] pocName = null;

                        if (role != null)
                        {
                            if (!row.IsNull("POC ID"))
                            {
                                pocID = row["POC ID"].ToString().Split(new[] { ';' });
                            }
                            if (!row.IsNull("POC Name"))
                            {
                                pocName = row["POC Name"].ToString().Split(new[] { ';' });
                            }
                            for (int i = 0; i < pocID.Length; i++)
                            {
                                User user = new User
                                {
                                    AssociateID   = pocID[i],
                                    AssociateName = pocName[i],
                                    RoleID        = role.RoleID,
                                    EventId       = eventID
                                };
                                UserRepository userRepository = new UserRepository();
                                userRepository.AddUser(user);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger logger = new ExceptionLogger()
                {
                    ControllerName      = "ExcelToDB",
                    ActionrName         = "InsertEventDetails",
                    ExceptionMessage    = ex.Message,
                    ExceptionStackTrace = ex.StackTrace,
                    LogDateTime         = DateTime.Now
                };
                ExceptionRepository exceptionRepository = new ExceptionRepository();
                exceptionRepository.AddException(logger);
                throw ex;
            }
        }
        public async void _checkRecurringEvent()
        {
            EventRepository          _eventRepository          = new EventRepository();
            RecurringEventRepository _recurringEventRepository = new RecurringEventRepository();
            List <RecurringEvent>    recurringEventList        = _recurringEventRepository.GetEvents(UserSession.UserData.Id);

            foreach (RecurringEvent recurringEvent in recurringEventList)
            {
                int noOfDays = (DateTime.Now - UserSession.UserData.LastAccessDate).Days;

                DateTime recurringTime = UserSession.UserData.LastAccessDate;
                TimeSpan timeSpan      = new TimeSpan(recurringEvent.EventDate.Hour, recurringEvent.EventDate.Minute, recurringEvent.EventDate.Second);
                recurringTime = recurringTime.Date + timeSpan;

                for (int i = 0; i <= noOfDays; i++)
                {
                    if (recurringEvent.Status.Equals("Weekly"))
                    {
                        if (recurringTime.DayOfWeek != recurringEvent.EventDate.DayOfWeek)
                        {
                            recurringTime = recurringTime.AddDays(1);
                            continue;
                        }
                    }

                    if (recurringEvent.Status.Equals("Monthly"))
                    {
                        if (recurringTime.Day != recurringEvent.EventDate.Day)
                        {
                            recurringTime = recurringTime.AddDays(1);
                            continue;
                        }
                    }

                    if (recurringEvent.Status.Equals("Yearly"))
                    {
                        string recurringTimeString = recurringTime.ToString("dd/MM");
                        string createdDateString   = recurringEvent.EventDate.ToString("dd/MM");
                        if (!recurringTimeString.Equals(createdDateString))
                        {
                            recurringTime = recurringTime.AddDays(1);
                            continue;
                        }
                    }

                    if (recurringTime > UserSession.UserData.LastAccessDate && recurringTime <= DateTime.Now && recurringTime > recurringEvent.EventDate)
                    {
                        _messageStatus = await Task.Run(() => _eventRepository.AddEvent(new Event
                        {
                            Name      = recurringEvent.Name,
                            Location  = recurringEvent.Location,
                            Type      = recurringEvent.Type,
                            EventDate = recurringTime,
                            Note      = recurringEvent.Note,
                            ContactId = recurringEvent.ContactId,
                            UserId    = recurringEvent.UserId
                        }));

                        RecurringBackground.ReportProgress(1, "New Event has been Added");
                    }
                    recurringTime = recurringTime.AddDays(1);
                }
            }
        }