private void cboUploadType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboUploadType.Text == "Project")
     {
         formMain.currentPage.Hide();
         formMain.ChangeToPage(FormMain.Pages.UploadProjectPage);
     }
 }
示例#2
0
 private void picAsset_Click(object sender, EventArgs e)
 {
     if (_isAsset)
     {
         _formMain.curSelectedAssetID = _userAssetOrProjectID;
         _formMain.ChangeToPage(FormMain.Pages.ViewAssetPage);
     }
     else if (!_isAsset)
     {
         _formMain.curSelectedUserProjectID = _userAssetOrProjectID;
         _formMain.ChangeToPage(FormMain.Pages.ViewProjectPage);
     }
 }
示例#3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            UsersAccounts.UserData m_user = formMain.UsersAccounts.RetrieveUserData(txtUserName.Text);

            lblErrorUsername.Hide();
            lblErrorPassword.Hide();

            if (m_user != null)
            {
                if (m_user.IsValidPassword(txtPassword.Text))
                {
                    formMain.UsersAccounts.SetCurrentUser(m_user);
                    formMain.ChangeToPage(FormMain.Pages.HomePage);
                    this.Hide();
                    return;
                }
                lblErrorPassword.Show();
                return;
            }
            lblErrorUsername.Show();
        }
        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 btnConfirmChanges_Click(object sender, EventArgs e)
        {
            bool errorDetected = false;

            if (txtTitle.Text == string.Empty || txtTitle.Text == "Title")
            {
                lblErrorTitle.Show();
                errorDetected = true;
            }
            if (cboProjectType.SelectedIndex < 0)
            {
                lblErrorProjectType.Show();
                errorDetected = true;
            }

            if (errorDetected == false)
            {
                DataBaseAccess dataBase = new DataBaseAccess();
                dataBase.StartConnection();
                if (_curUserProject.GetProjectTitle() != _userProject.GetProjectTitle())
                {
                    dataBase.ChangeProjectName((int)_curUserProjectID, _userProject.GetProjectTitle());
                }

                if (_curUserProject.GetProjectType() != _userProject.GetProjectType())
                {
                    dataBase.ChangeProjectType((int)_curUserProjectID, _userProject.GetProjectType());
                }

                if (_curUserProject.GetNotes() != _userProject.GetNotes())
                {
                    dataBase.ChangeProjectDescription((int)_curUserProjectID, _userProject.GetNotes());
                }

                if (_thumbNailPic != null)
                {
                    dataBase.ChangeProjectThumbnail((int)_curUserProjectID, _thumbNailPic);
                }

                dataBase.CloseConnection();

                formMain.curSelectedUserProjectID = _curUserProjectID;
                formMain.ChangeToPage(FormMain.Pages.ViewProjectPage);
            }
        }
示例#6
0
        private void btnJoin_click(object sender, EventArgs e)
        {
            foreach (bool item in _isInfoFilledOutCorrectly)
            {
                if (item == false)
                {
                    return;
                }
            }

            UsersAccounts.UserData userData = new UsersAccounts.UserData
            {
                userName     = _tempUsername,
                emailAddress = _tempEmail,
                fullName     = _tempName
            };
            userData.OneTimeSetUserID(5);
            userData.SetPassword(_tempPassword);
            formMain.UsersAccounts.AddUser(userData);
            formMain.ChangeToPage(FormMain.Pages.HomePage);
        }
        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();
        }
 private void btnEdit_Click(object sender, EventArgs e)
 {
     formMain.curSelectedAssetID = _userAsset.GetID();
     formMain.ChangeToPage(FormMain.Pages.EditAssetPage);
 }
示例#9
0
 private void btnViewMyAssets_Click(object sender, EventArgs e)
 {
     formMain.ChangeToPage(FormMain.Pages.MyAssetsPage, "asset");
 }
 private void btn_CreateAnAccount_click(object sender, EventArgs e)
 {
     formMain.ChangeToPage(FormMain.Pages.CreateAccountPage);
     this.Hide();
 }
        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);
            }
        }
 private void btnEdit_Click(object sender, EventArgs e)
 {
     formMain.curSelectedUserProjectID = _userProjectID;
     formMain.ChangeToPage(FormMain.Pages.EditProjectPage);
 }