public EditAssetPageControl(FormMain form, int?userAssetID)
        {
            _userAssetID = userAssetID;
            DataBaseAccess dataBase = new DataBaseAccess();

            dataBase.StartConnection();
            _curUserAsset = dataBase.getAsset((int)userAssetID);
            dataBase.CloseConnection();
            InitializeComponent();
            pictureGallery1.InitializePictureGallery((int)_curUserAsset.GetAuthor().GetUserID(), (int)_userAssetID);

            formMain = form;
            if (formMain.UsersAccounts.GetCurrentUser() != null)
            {
                if (_curUserAsset == null || userAssetID == null)
                {
                    MessageBox.Show("Error: Asset Not Found");
                }
                else
                {
                    txtTitle.Text = _curUserAsset.GetAssetTitle();
                    cboAssetType.SelectedIndex   = (int)_curUserAsset.GetAssetType();
                    txtSoftwareUsed.Text         = _curUserAsset.GetSoftwareUsed();
                    cboPegi.SelectedIndex        = (int)_curUserAsset.GetPegiRating();
                    cboAssetStatus.SelectedIndex = (int)_curUserAsset.GetAssetStatus() - 1;
                    txtNotes.Text = _curUserAsset.GetNotes();
                    pictureGallery1.AddPicturesToGallery(_curUserAsset.GetPicturesPath());
                    picThumbnail.ImageLocation = _curUserAsset.GetThumbNail();

                    _userAsset.SetAssetTitle(_curUserAsset.GetAssetTitle());
                    _userAsset.SetAssetStatus(_curUserAsset.GetAssetStatus());
                    _userAsset.SetAssetType(_curUserAsset.GetAssetType());
                    _userAsset.SetSoftwareUsed(_curUserAsset.GetSoftwareUsed());
                    _userAsset.SetPegiRating(_curUserAsset.GetPegiRating());
                    _userAsset.SetNotes(_curUserAsset.GetNotes());
                }
            }
            else
            {
                MessageBox.Show("Error: No user logged in");
            }
        }
        public ViewAssetPageControl(FormMain form, int?userAssetID)
        {
            formMain     = form;
            _userAssetID = userAssetID;

            DataBaseAccess dataBase = new DataBaseAccess();

            dataBase.StartConnection();
            _userAsset = dataBase.getAsset((int)userAssetID);
            dataBase.CloseConnection();

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

            galPictureGallery.SetToLarge();
            galPictureGallery.IsEditable(false);
            galPictureGallery.AddPicturesToGallery(_userAsset.GetPicturesPath());
            pictureBox1.ImageLocation  = _userAsset.GetThumbNail();
            lblTitleDisplay.Text       = _userAsset.GetAssetTitle();
            lblAssetTypeDisplay.Text   = _userAsset.GetAssetType().ToString();
            lblSoftwareDisplay.Text    = _userAsset.GetSoftwareUsed();
            lblPegiDisplay.Text        = _userAsset.GetPegiRating().ToString();
            lblAssetStatusDisplay.Text = _userAsset.GetAssetStatus().ToString();
            lblCreatorDisplay.Text     = _userAsset.GetAuthor().userName;
            lblDescription.Text        = _userAsset.GetNotes();
            starOverall._canSetRating  = false;
            if (_curUserData == null)
            {
                starRating.Visible       = false;
                lblRatingMessage.Visible = false;
            }
            else
            {
                starRating.valueChangedEvent += rating_Click;
            }
        }
        private void btnUploadAsset_Click(object sender, EventArgs e)
        {
            bool errorDetected = false;

            if (txtTitle.Text == string.Empty)
            {
                lblErrorTitle.Show();
                errorDetected = true;
            }
            if (cboAssetType.SelectedIndex < 0)
            {
                lblErrorAssetType.Show();
                errorDetected = true;
            }
            if (txtSoftwareUsed.Text == string.Empty)
            {
                lblErrorSoftwareUsed.Show();
                errorDetected = true;
            }
            if (cboPegi.SelectedIndex < 0)
            {
                lblErrorPegi.Show();
                errorDetected = true;
            }
            if (cboAssetType.SelectedIndex < 0)
            {
                lblErrorAssetStatus.Show();
                errorDetected = true;
            }
            if (_assetUploaded == false)
            {
                lblErrorAssetStatus.Show();
                errorDetected = true;
            }

            if (errorDetected == false)
            {
                DataBaseAccess dataBase = new DataBaseAccess();
                dataBase.StartConnection();
                int assetDatabaseID = dataBase.AddAsset(_userAsset.GetAssetTitle(), (int)formMain.UsersAccounts.GetCurrentUser().GetUserID(), _userAsset.GetAssetStatus(), _userAsset.GetAssetType(), _userAsset.GetSoftwareUsed(), _userAsset.GetNotes(), "", _userAsset.GetPegiRating());
                dataBase.ChangeAssetPath(assetDatabaseID, HelperTools.AddFileToStorage(_assetFilePath, (int)_curUserID, assetDatabaseID));
                dataBase.CloseConnection();

                formMain.curSelectedAssetID = assetDatabaseID;

                formMain.ChangeToPage(FormMain.Pages.EditAssetPage);
            }
        }
        private void btnConfirmChanges_Click(object sender, EventArgs e)
        {
            bool errorDetected = false;

            if (txtTitle.Text == string.Empty || txtTitle.Text == "Title")
            {
                lblErrorTitle.Show();
                errorDetected = true;
            }
            if (cboAssetType.SelectedIndex < 0)
            {
                lblErrorAssetType.Show();
                errorDetected = true;
            }
            if (txtSoftwareUsed.Text == string.Empty || txtSoftwareUsed.Text == "Software Used")
            {
                lblErrorSoftwareUsed.Show();
                errorDetected = true;
            }
            if (cboPegi.SelectedIndex < 0)
            {
                lblErrorPegi.Show();
                errorDetected = true;
            }
            if (cboAssetStatus.SelectedIndex < 0)
            {
                lblErrorAssetStatus.Show();
                errorDetected = true;
            }

            if (errorDetected == false)
            {
                DataBaseAccess dataBase = new DataBaseAccess();
                dataBase.StartConnection();
                if (_curUserAsset.GetAssetTitle() != _userAsset.GetAssetTitle())
                {
                    dataBase.ChangeAssetName((int)_userAssetID, _userAsset.GetAssetTitle());
                }

                if (_curUserAsset.GetAssetType() != _userAsset.GetAssetType())
                {
                    dataBase.ChangeAssetType((int)_userAssetID, _userAsset.GetAssetType());
                }

                if (_curUserAsset.GetSoftwareUsed() != _userAsset.GetSoftwareUsed())
                {
                    dataBase.ChangeAssetSoftware((int)_userAssetID, _userAsset.GetSoftwareUsed());
                }

                if (_curUserAsset.GetAssetStatus() != _userAsset.GetAssetStatus())
                {
                    dataBase.ChangeAssetStatus((int)_userAssetID, _userAsset.GetAssetStatus());
                }

                if (_curUserAsset.GetNotes() != _userAsset.GetNotes())
                {
                    dataBase.ChangeAssetNotes((int)_userAssetID, _userAsset.GetNotes());
                }

                if (_thumbNailPic != null)
                {
                    dataBase.ChangeAssetThumbnail((int)_userAssetID, _thumbNailPic);
                }

                List <string> tempPictureHolder = pictureGallery1.GetPicturesPathFromGallery();
                _curUserAsset.SetPicturesPath(tempPictureHolder);
                if (tempPictureHolder.Count >= 1)
                {
                    dataBase.ChangeAssetGalleryOne((int)_userAssetID, tempPictureHolder[0]);
                }
                if (tempPictureHolder.Count >= 2)
                {
                    dataBase.ChangeAssetGalleryTwo((int)_userAssetID, tempPictureHolder[1]);
                }
                if (tempPictureHolder.Count >= 3)
                {
                    dataBase.ChangeAssetGalleryThree((int)_userAssetID, tempPictureHolder[2]);
                }
                if (tempPictureHolder.Count >= 4)
                {
                    dataBase.ChangeAssetGalleryFour((int)_userAssetID, tempPictureHolder[3]);
                }
                if (tempPictureHolder.Count >= 5)
                {
                    dataBase.ChangeAssetGalleryFive((int)_userAssetID, tempPictureHolder[4]);
                }

                dataBase.CloseConnection();


                formMain.curSelectedAssetID = _userAssetID;
                formMain.ChangeToPage(FormMain.Pages.ViewAssetPage);
            }
        }