public EditProjectPageControl(FormMain form, int?curUserProjectID)
        {
            InitializeComponent();
            formMain          = form;
            _curUserProjectID = curUserProjectID;

            if (formMain.UsersAccounts.GetCurrentUser() != null)
            {
                DataBaseAccess dataBase = new DataBaseAccess();
                dataBase.StartConnection();
                _curUserProject = dataBase.getProject((int)curUserProjectID);
                dataBase.CloseConnection();

                if (curUserProjectID == null || _curUserProject == null)
                {
                    MessageBox.Show("Error: Asset Not Found");
                }
                else
                {
                    txtTitle.Text = _curUserProject.GetProjectTitle();
                    cboProjectType.SelectedIndex = (int)_curUserProject.GetProjectType();
                    txtNotes.Text = _curUserProject.GetNotes();
                    picThumbnail.ImageLocation = _curUserProject.GetThumbNail();

                    _userProject.SetProjectTitle(_curUserProject.GetProjectTitle());
                    _userProject.SetProjectType(_curUserProject.GetProjectType());
                    _userProject.SetNotes(_curUserProject.GetNotes());
                }
            }
            else
            {
                MessageBox.Show("Error: No user logged in");
            }
        }
示例#2
0
 public UploadProjectPageControl(FormMain form)
 {
     InitializeComponent();
     cboUploadType.SelectedIndex = 1;
     formMain = form;
     if (formMain.UsersAccounts.GetCurrentUser() != null)
     {
         _userProject = new UserProject(formMain.UsersAccounts.GetCurrentUser());
     }
     else
     {
         MessageBox.Show("Error: No user logged in");
     }
 }
        public ViewProjectPageControl(FormMain form, int?userProjectID)
        {
            InitializeComponent();

            formMain = form;

            _userProjectID = userProjectID;

            DataBaseAccess dataBase = new DataBaseAccess();

            dataBase.StartConnection();
            _userProject = dataBase.getProject((int)userProjectID);
            dataBase.CloseConnection();

            _curUserData = formMain.UsersAccounts.GetCurrentUser();
            InitializeComponent();

            if (formMain.UsersAccounts.GetCurrentUser() != null)
            {
                if (_userProject == null)
                {
                    formMain.ChangeToPage(FormMain.Pages.HomePage);
                }
                else
                {
                    if (_curUserData.GetUserID() == _userProject.GetAuthor().GetUserID())
                    {
                        btnEdit.Show();
                    }
                }
            }

            lblTitleDisplay.Text       = _userProject.GetProjectTitle();
            lblAssetTypeDisplay.Text   = _userProject.GetProjectType().ToString();
            lblCreatorDisplay.Text     = _userProject.GetAuthor().userName;
            lblDescriptionDisplay.Text = _userProject.GetNotes();
            picThumbNail.ImageLocation = _userProject.GetThumbNail();
            picThumbNail.Show();
        }
 public void AddUserProject(UserProject project)
 {
     _userProjects.Add(project);
 }