コード例 #1
0
        public void EditSpecialSession(SpecialSessionDTO specialSessionDTO)
        {
            var specialSession = MapperExtension.mapper.Map <SpecialSessionDTO, SpecialSession>(specialSessionDTO);

            _db.Entry(_db.SpecialSessions.Find(specialSessionDTO.SpecialSessionId)).CurrentValues.SetValues(specialSession);
            _db.SaveChanges();
        }
コード例 #2
0
        public void AddSpecialSession(SpecialSessionDTO specialSessionDTO)
        {
            var specialSession = MapperExtension.mapper.Map <SpecialSessionDTO, SpecialSession>(specialSessionDTO);

            _db.SpecialSessions.Add(specialSession);
            _db.SaveChanges();
        }
コード例 #3
0
        public async Task <bool> EditSpecialSessionAsync(SpecialSessionDTO specialSession)
        {
            var path   = Properties.Resources.editSpecialSessionPath;
            var result = await _apiHelper.Put(path, specialSession);

            return(result != null && result.ResponseType == ResponseType.Success);
        }
コード例 #4
0
 public PresentationSpecialSession(SpecialSessionDTO session)
 {
     InitializeComponent();
     WindowHelper.SmallWindowSettings(this);
     this.session = session;
     core         = new PresentationCore();
     articleCore  = new ArticleCore();
     FillSessionBoxes();
     LoadPresentations();
 }
コード例 #5
0
 public IHttpActionResult EditSpecialSession([FromBody] SpecialSessionDTO specialSession)
 {
     if (string.IsNullOrEmpty(specialSession.Title))
     {
         return(BadRequest());
     }
     if (_bll.EditSpecialSession(specialSession))
     {
         return(Ok());
     }
     return(InternalServerError());
 }
コード例 #6
0
ファイル: SessionBLL.cs プロジェクト: 2644783865/ssd-cms
 public bool EditSpecialSession(SpecialSessionDTO specialSession)
 {
     try
     {
         _repository.EditSpecialSession(specialSession);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
コード例 #7
0
 public SessionDetails(SessionDTO session, SpecialSessionDTO specialSession)
 {
     InitializeComponent();
     WindowHelper.SmallWindowSettings(this);
     this.session        = session;
     this.specialSession = specialSession;
     roomCore            = new RoomCore();
     if (specialSession != null)
     {
         Title = "Special session details";
     }
     FillSessionBoxes();
 }
コード例 #8
0
        public AddEditSession(SessionDTO session, SpecialSessionDTO specialSession)
        {
            InitializeComponent();
            WindowHelper.SmallWindowSettings(this);
            core      = new SessionCore();
            authCore  = new AuthenticationCore();
            eventCore = new EventCore();
            roomCore  = new RoomCore();

            currentSession        = session;
            currentSpecialSession = specialSession;
            if (currentSession != null)
            {
                InitializeSessionFields();
            }
            if (currentSpecialSession != null)
            {
                InitializeSpecialSessionFields();
            }
            Refresh_Click(null, null);
        }
コード例 #9
0
ファイル: SessionBLL.cs プロジェクト: 2644783865/ssd-cms
        public PresentersListModel GetPresentersList(int?sessionId, int?specialSessionId)
        {
            SessionDTO        session        = null;
            SpecialSessionDTO specialSession = null;
            List <AccountDTO> presenters     = null;

            if (sessionId.HasValue)
            {
                session    = _repository.GetSessionById(sessionId.Value);
                presenters = _repository.GetPresentersForSession(sessionId.Value).ToList();
            }
            if (specialSessionId.HasValue)
            {
                specialSession = _repository.GetSpecialSessionById(specialSessionId.Value);
                presenters     = _repository.GetPresentersForSpecialSession(specialSessionId.Value).ToList();
            }

            return(new PresentersListModel()
            {
                Session = session,
                SpecialSession = specialSession,
                Presenters = presenters
            });
        }
コード例 #10
0
        private async void AddSessionButton_Click(object sender, RoutedEventArgs e)
        {
            AddSessionButton.IsEnabled = false;
            try
            {
                if (ValidateForm())
                {
                    if (await CheckDate() && await CheckChairman() && await CheckRoom())
                    {
                        if (currentSession == null && currentSpecialSession == null)
                        {
                            if (SpecialSessionCheck.IsChecked.Value)
                            {
                                var specialSession = new SpecialSessionDTO()
                                {
                                    Title        = TitleBox.Text,
                                    BeginDate    = BeginDatePicker.SelectedDate.Value,
                                    EndDate      = EndDatePicker.SelectedDate.Value,
                                    ChairId      = (await authCore.GetAccountByLoginAsync(ChairmanBox.Text)).AccountId,
                                    ConferenceId = UserCredentials.Conference.ConferenceId,
                                    Description  = DescriptionBox.Text,
                                    RoomId       = ((RoomDTO)RoomBox.SelectedItem).RoomID
                                };

                                if (await core.AddSpecialSessionAsync(specialSession))
                                {
                                    MessageBox.Show("Successfully added special session");
                                    Close();
                                }
                                else
                                {
                                    MessageBox.Show("Something went wrong while adding special session");
                                }
                            }
                            else
                            {
                                var session = new SessionDTO()
                                {
                                    Title        = TitleBox.Text,
                                    BeginDate    = BeginDatePicker.SelectedDate.Value,
                                    EndDate      = EndDatePicker.SelectedDate.Value,
                                    ChairId      = (await authCore.GetAccountByLoginAsync(ChairmanBox.Text)).AccountId,
                                    ConferenceId = UserCredentials.Conference.ConferenceId,
                                    Description  = DescriptionBox.Text,
                                    RoomId       = ((RoomDTO)RoomBox.SelectedItem).RoomID
                                };

                                if (await core.AddSessionAsync(session))
                                {
                                    MessageBox.Show("Successfully added session");
                                    Close();
                                }
                                else
                                {
                                    MessageBox.Show("Something went wrong while adding session");
                                }
                            }
                        }
                        if (currentSession != null)
                        {
                            currentSession.Title        = TitleBox.Text;
                            currentSession.BeginDate    = BeginDatePicker.SelectedDate.Value;
                            currentSession.EndDate      = EndDatePicker.SelectedDate.Value;
                            currentSession.ChairId      = (await authCore.GetAccountByLoginAsync(ChairmanBox.Text)).AccountId;
                            currentSession.ConferenceId = UserCredentials.Conference.ConferenceId;
                            currentSession.Description  = DescriptionBox.Text;
                            currentSession.RoomId       = ((RoomDTO)RoomBox.SelectedItem).RoomID;
                            if (await core.EditSessionAsync(currentSession))
                            {
                                MessageBox.Show("Successfully edited session");
                                Close();
                            }
                            else
                            {
                                MessageBox.Show("Something went wrong while editing session");
                            }
                        }
                        if (currentSpecialSession != null)
                        {
                            currentSpecialSession.Title        = TitleBox.Text;
                            currentSpecialSession.BeginDate    = BeginDatePicker.SelectedDate.Value;
                            currentSpecialSession.EndDate      = EndDatePicker.SelectedDate.Value;
                            currentSpecialSession.ChairId      = (await authCore.GetAccountByLoginAsync(ChairmanBox.Text)).AccountId;
                            currentSpecialSession.ConferenceId = UserCredentials.Conference.ConferenceId;
                            currentSpecialSession.Description  = DescriptionBox.Text;
                            currentSpecialSession.RoomId       = ((RoomDTO)RoomBox.SelectedItem).RoomID;
                            if (await core.EditSpecialSessionAsync(currentSpecialSession))
                            {
                                MessageBox.Show("Successfully edited special session");
                                Close();
                            }
                            else
                            {
                                MessageBox.Show("Something went wrong while editing special session");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Some data is overlapping with another session/event or login is invalid");
                        Refresh_Click(null, null);
                    }
                }
                else
                {
                    MessageBox.Show("Form invalid");
                }
            }
            catch
            {
                MessageBox.Show("Something went wrong, try again");
            }
            AddSessionButton.IsEnabled = true;
        }