示例#1
0
        private void AEventB_Click(object sender, EventArgs e)
        {
            EventDataService eventDataService = new EventDataService();
            int result = eventDataService.AddEvent(EventNameBox.Text, ImportanceBox.Text, CreationDateBox.Text, usingUserId);

            if (result > 0)
            {
                MessageBox.Show("Event Added Succesfully!");
                eventListView.DataSource = eventDataService.GetEventList(this.usingUserId);
                EventNameBox.Text        = ImportanceBox.Text = CreationDateBox.Text = null;
            }
            else
            {
                MessageBox.Show("Sorry There Was An Error!");
                eventListView.DataSource = eventDataService.GetEventList(this.usingUserId);
            }
        }
示例#2
0
        private void CreateNewEvent(object obj)
        {
            _eventDataService.AddEvent(SelectedEvent);

            //The order here is critical because after LoadEvenNames() is called, the SelectedEvent gets changed. The original
            //SelectedEvent is needed later in order to be able to edit immediately after creating the new event.

            var newEvent = _eventDataService.GetEvent(SelectedEvent.Name);

            LoadEventNames();
            SelectedEvent.Name = newEvent.Name;
            SelectedEvent.Date = newEvent.Date;
            _eventToEdit       = _eventDataService.GetEvent(SelectedEvent.Name);

            _canEditEventDetails = true;
            _canCreateNewEvent   = false;
        }