Esempio n. 1
0
        void btnSave_Click(object sender, EventArgs e)
        {
            pnlError.Visible = false;
            Profile profile = _presenter.GetProfile();
            if (profile == null)
                profile = new Profile();

            Account account = _presenter.GetAccount();

            if (!string.IsNullOrEmpty(lblProfileID.Text))
                profile.ProfileID = Convert.ToInt32(lblProfileID.Text);

            profile.AccountID = account.AccountID;
            profile.IMAOL = txtIMAOL.Text;
            profile.IMGIM = txtIMGIM.Text;
            profile.IMICQ = txtIMICQ.Text;
            profile.IMMSN = txtIMMSN.Text;
            profile.IMSkype = txtIMSkype.Text;
            profile.IMYIM = txtIMYIM.Text;
            profile.LevelOfExperienceTypeID = Convert.ToInt32(ddlLevelOfExperience.SelectedValue);
            profile.Signature = txtSignature.Text;

            profile.Attributes = ExtractAttributes();

            if (!string.IsNullOrEmpty(txtNumberOfFishOwned.Text))
                profile.Enjoy = txtNumberOfFishOwned.Text;

            if (!string.IsNullOrEmpty(txtNumberOfTanksOwned.Text))
                profile.Address = txtNumberOfTanksOwned.Text;

            if (!string.IsNullOrEmpty(txtYearOfFirstTank.Text))
                profile.SchoolsName = txtYearOfFirstTank.Text;

            _presenter.SaveProfile(profile);
        }
 public ManagePrivacyPresenter()
 {
     _profileService = ObjectFactory.GetInstance<IProfileService>();
     _userSession = ObjectFactory.GetInstance<IUserSession>();
     account = _userSession.CurrentUser;
     profile = _profileService.LoadProfileByAccountID(account.AccountID);
 }
 public void Init(IUploadAvatar View)
 {
     _view = View;
     if (_userSession.LoggedIn && _userSession.CurrentUser != null)
         profile = Profile.GetProfileByAccountID(_userSession.CurrentUser.AccountID);
     if (profile == null)
         _redirector.GoToAccountLoginPage();
 }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _userSession = ObjectFactory.GetInstance<IUserSession>();
            _webContext = ObjectFactory.GetInstance<IWebContext>();

            if (_webContext.AccountID == -999 && _userSession.LoggedIn && _userSession.UploadImage != null)
            {
                Response.Clear();
                //Response.ContentType = profile.AvatarMimeType;
                Response.BinaryWrite(_userSession.UploadImage);
                return;
            }

            //load an image by passed in accountid
            if (_webContext.AccountID > 0)
            {
                accountID = _webContext.AccountID;
                profile = Profile.GetProfileByAccountID(accountID);
                account = Account.GetAccountByID(accountID);
            }
            //get an image for the current user
            else
            {
                if (_userSession.LoggedIn && _userSession.CurrentUser != null)
                {
                    account = _userSession.CurrentUser;
                    profile = Profile.GetProfileByAccountID(account.AccountID);
                }
            }

            //show the appropriate image
            if (_webContext.ShowGravatar || (profile != null && profile.UseGravatar == 1))
            {
                Response.Redirect(GetGravatarURL());
            }
            else if (profile != null && profile.Avatar != null)
            {
                Response.Clear();
                Response.ContentType = profile.AvatarMimeType;
                Response.BinaryWrite(profile.Avatar.ToArray());
            }
            else
            {
                Response.Redirect("~/images/ProfileAvatar/default.jpg");
            }
        }
Esempio n. 5
0
        public static int SaveProfile(Profile profile)
        {
            IAlertService _alertService = StructureMap.ObjectFactory.GetInstance<IAlertService>();

            int profileID;
            profile.LastUpdateDate = DateTime.Now;
            if (profile.ProfileID > 0)
            {
                Profile.Update(profile);
                _alertService.AddProfileModifiedAlert();
            }
            else
            {
                profile.CreateDate = DateTime.Now;
                Profile.Add(profile);
                _alertService.AddProfileCreatedAlert();
            }
            profileID = profile.ProfileID;
            return profileID;
        }
 public void SaveProfile(Profile profile)
 {
     _profileService.SaveProfile(profile);
     _redirector.GoToProfilesProfile();
 }
Esempio n. 7
0
        public void LoadProfile(Profile profile)
        {
            if (profile != null)
            {
                lblProfileID.Text = profile.ProfileID.ToString();
                txtIMAOL.Text = profile.IMAOL;
                txtIMGIM.Text = profile.IMGIM;
                txtIMICQ.Text = profile.IMICQ;
                txtIMMSN.Text = profile.IMMSN;
                txtIMSkype.Text = profile.IMSkype;
                txtIMYIM.Text = profile.IMYIM;
                txtNumberOfFishOwned.Text = profile.Enjoy.ToString();
                txtNumberOfTanksOwned.Text = profile.Address.ToString();
                txtSignature.Text = profile.Signature;
                txtYearOfFirstTank.Text = profile.SchoolsName.ToString();

                foreach (ListItem item in ddlLevelOfExperience.Items)
                {
                    if (item.Value == profile.LevelOfExperienceTypeID.ToString())
                        item.Selected = true;
                }

                if (profile.Attributes.Count > 0)
                {
                    foreach (ProfileAttribute attribute in profile.Attributes)
                    {
                        Label lblProfileAttributeID =
                            phAttributes.FindControl("lblProfileAttributeID" +
                                                     attribute.ProfileAttributeTypeID.ToString()) as Label;
                        //Label lblProfileAttributeTimestamp =
                        //    phAttributes.FindControl("lblProfileAttributeTimestamp" +
                        //                             attribute.ProfileAttributeTypeID.ToString()) as Label;

                        if (lblProfileAttributeID != null)
                        {
                            lblProfileAttributeID.Text = attribute.ProfileAttributeID.ToString();
                        }

                        //if (lblProfileAttributeTimestamp != null)
                        //{
                        //    lblProfileAttributeTimestamp.Text = attribute.TimeStamp.TimestampToString();
                        //}

                        TextBox txtProfileAttribute =
                            phAttributes.FindControl("txtProfileAttribute" + attribute.ProfileAttributeTypeID.ToString()) as
                            TextBox;
                        if (txtProfileAttribute != null)
                        {
                            txtProfileAttribute.Text = attribute.Response;
                        }
                    }
                }
            }
        }