Exemplo n.º 1
0
 public void DeleteProfile(Profile profile)
 {
     using (SPKTDataContext spktDC = conn.GetContext())
     {
         spktDC.Profiles.Attach(profile, true);
         spktDC.Profiles.DeleteOnSubmit(profile);
         spktDC.SubmitChanges();
     }
 }
Exemplo n.º 2
0
        public void GotoAccountProfile()
        {
            profile=_profileService.LoadProfileByAccountID(account.AccountID);
            if (profile != null)
            {
                _redirector.Redirect("~/Profiles/UserProfile.aspx");

            }
            else
                _redirector.Redirect("~/Profiles/ManageProfile.aspx");
        }
Exemplo n.º 3
0
 public void LoadProfile(Profile profile)
 {
     if (profile != null)
     {
         txtProfileName.Text = profile.profileName;
         txtTenThat.Text = profile.FullName;
         txtNgaySinh.Text = profile.Birthday.ToString();
         txtChuKy.Text = profile.Signature;
         txtSex.Text = profile.Sex;
     }
 }
Exemplo n.º 4
0
        public void LoadProfile(Profile profile, List<VisibilityLevel> ListVisibilityLevel)
        {
            if (profile != null)
            {
                txtProfileName.Text = profile.profileName;
                txtTenThat.Text = profile.FullName;
                txtNgaySinh.Text = profile.Birthday.ToString();
                txtChuKy.Text = profile.Signature;
                txtSex.Text = profile.Sex;
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                    {
                        li.Selected = _presenter.IsFlagSelected(1, level.VisibilityLevelID, _presenter.GetPrivacyFlag());
                    }
                    ddlVisibility1.Items.Add(li);

                }
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                    {
                        li.Selected = _presenter.IsFlagSelected(2, level.VisibilityLevelID, _presenter.GetPrivacyFlag());

                    }

                    ddlVisibility2.Items.Add(li);

                }
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                    {
                         li.Selected = _presenter.IsFlagSelected(3, level.VisibilityLevelID, _presenter.GetPrivacyFlag());

                    }
                    ddlVisibility3.Items.Add(li);
                }
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                    {
                         li.Selected = _presenter.IsFlagSelected(4, level.VisibilityLevelID, _presenter.GetPrivacyFlag());
                    }
                    ddlVisibility4.Items.Add(li);
                }

            }
        }
Exemplo n.º 5
0
 // luu lai profile trong do bao gom luu Profile, luu cac thuoc tinh Profile và luu vao session
 public void SaveProfile(Profile profile)
 {
     Int32 profileID;
     profileID = _profileRepository.SaveProfile(profile);
     foreach (ProfileAttribute attribute in profile.Attributes)
     {
         attribute.ProfileID = profileID;
         _profileAttributeRepository.SaveProfileAttribute(attribute);
     }
     _userSession.CurrentProfile = LoadProfileByAccountID(_userSession.CurrentUser.AccountID);
     _userSession.CurrentUser.Profile = LoadProfileByAccountID(_userSession.CurrentUser.AccountID);
 }
Exemplo n.º 6
0
        public void AddProfileAttribute(List<ProfileAttributeType> _listProfileAttributeType, Profile profile)
        {
            ProfileAttribute profileAttribute;
            foreach (ProfileAttributeType proAttributeType in _listProfileAttributeType)
            {

                profileAttribute = new ProfileAttribute();
                profileAttribute.ProfileID = profile.ProfileID;
                profileAttribute.ProfileAttributeName = proAttributeType.Type;
                profileAttribute.ProfileAttributeTypeID = proAttributeType.ProfileAttributeTypeID;
                _profileAttributeService.SaveProfileAttribute(profileAttribute);
            }
        }
Exemplo n.º 7
0
 public ManageProfilePresenter()
 {
     _levelOfExperienceRepository = new LevelOfExperienceRepository();
     _profileAttributeRepository = new ProfileAttributeRepository();
     _profileRepository = new ProfileRepository();
     _userSession = new UserSession();
     _profileService = new ProfileService();
     _profileAttributeService = new ProfileAttributeService();
     _redirector = new Redirector();
     _listProfileAttributeType = new List<ProfileAttributeType>();
     _listPrivacyFlags = new List<PrivacyFlag>();
     _privacyRepository = new PrivacyRepository();
     _listVisibilityLevel = new List<VisibilityLevel>();
     profile = new Profile();
 }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _profileRepository = new ProfileRepository();
            _userSession =new UserSession();
            _accountRepository = new AccountRepository();
            _webContext = new WebContext();

            //load an image by passed in accountid
            //if (_webContext.AccoundIdToInvite> 0)
            //{
            //    accountID = _webContext.AccoundIdToInvite;
            //    profile = _profileRepository.GetProfileByAccountID(accountID);
            //    account = _accountRepository.GetAccountByID(accountID);
            //}

            if (_webContext.AccountID> 0)
            {
                accountID = _webContext.AccountID;
                profile = _profileRepository.GetProfileByAccountID(accountID);
                account = _accountRepository.GetAccountByID(accountID);
            }
            //get an image for the current user
            else
            {
                if (_userSession.LoggedIn && _userSession.CurrentUser != null)
                {
                    account = _userSession.CurrentUser;
                    profile = _profileRepository.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("~/Image/ALIEN_01_01.jpg");
            }
        }
Exemplo n.º 9
0
		private void detach_Profiles(Profile entity)
		{
			this.SendPropertyChanging();
			entity.Account = null;
		}
Exemplo n.º 10
0
 partial void InsertProfile(Profile instance);
Exemplo n.º 11
0
		private void detach_Profiles(Profile entity)
		{
			this.SendPropertyChanging();
			entity.LevelOfExperience = null;
		}
Exemplo n.º 12
0
		private void attach_Profiles(Profile entity)
		{
			this.SendPropertyChanging();
			entity.Account = this;
		}
Exemplo n.º 13
0
 public void Init(IUploadAvatar View)
 {
     _view = View;
     if (_userSession.LoggedIn)
     {
         profile = _profileRepository.GetProfileByAccountID(_userSession.CurrentUser.AccountID);
         if (profile == null || profile.ProfileID < 1)
             _redirector.GoToAccountLoginPage();
     }
     else
         _redirector.GoToAccountLoginPage();
 }
Exemplo n.º 14
0
 public int SaveProfile(Profile profile)
 {
     Int32 profileID;
     profile.LastUpdateDate = DateTime.Now;
     using (SPKTDataContext spktDC = conn.GetContext())
     {
         if (profile.ProfileID > 0)
         {
             spktDC.Profiles.Attach(profile, true);
             _alertService.AddProfileModifiedAlert();
         }
         else
         {
             profile.CreateDate = DateTime.Now;
             spktDC.Profiles.InsertOnSubmit(profile);
            _alertService.AddProfileCreatedAlert();
         }
         spktDC.SubmitChanges();
         profileID = profile.ProfileID;
     }
     return profileID;
 }
Exemplo n.º 15
0
        public void Init(IManageProfile view, bool IsPostback)
        {
            _view = view;
            if (_userSession.LoggedIn == true)
            {
                Profile profile = _profileService.LoadProfileByUserName(_userSession.Username);
                _listProfileAttributeType = _profileAttributeService.GetProfileAttributeType();
                if (profile != null)
                {
                    _view.loadProfileAttribute(_listProfileAttributeType, profile);

                }
                else
                {
                    profile = new Profile();
                    profile.AccountID = _userSession.CurrentUser.AccountID;
                    profile.profileName = _userSession.CurrentUser.UserName;
                    _profileService.SaveProfileTable(profile);
                    AddProfileAttribute(_listProfileAttributeType, profile);

                }
                //_view.LoadProfile(profile);
                _view.ShowProfileName(profile.profileName);
                LoadProfile(IsPostback);
            }
            else
            {
                _redirector.GoToAccountLoginPage();
            }
        }
Exemplo n.º 16
0
        private List<ProfileAttribute> ExtractAttributes(Profile profile)
        {
            List<ProfileAttribute> Attributes = new List<ProfileAttribute>();
            foreach (ProfileAttribute attribute in _presenter.GetProfileAttributeByProfileID(profile))
            {
                TextBox txtProfileAttribute = divProfileAttribute.FindControl("txt" + attribute.ProfileAttributeID.ToString()) as TextBox;
                if (txtProfileAttribute != null)
                {
                    txtProfileAttribute.ID = "txt" + attribute.ProfileAttributeID.ToString();
                    attribute.Response = txtProfileAttribute.Text;
                    Attributes.Add(attribute);
                }

            }
            return Attributes;
        }
Exemplo n.º 17
0
        public void loadProfileAttribute(List<ProfileAttributeType> profileAttributeType, Profile profile)
        {
            #region MyRegion
            //foreach (ProfileAttributeType pt in profileAttributeType)
            //{
            //    ProfileAttributeControl ctr = new ProfileAttributeControl(profile, pt, _presenter._profileAttributeRepository);
            //    ProfileAttribute.Controls.Add(ctr);
            //}
            /* ProfileAttributeControlFull ctr = new ProfileAttributeControlFull(profile, profileAttributeType);
             ProfileAttribute.Controls.Add(ctr);*/
            //SPKTCore.Core.DataAccess.IProfileAttributeRepository _Repository = new SPKTCore.Core.DataAccess.Impl.ProfileAttributeRepository();
            // List<ProfileAttribute> listAttribute = new List<ProfileAttribute>();
            // listAttribute = _Repository.GetProfileAttributesByProfileID(profile.ProfileID);
            // if (listAttribute.Count != profileAttributeType.Count)
            // {
            //     _presenter.AddProfileAttribute(profileAttributeType, profile);
            // }
            // System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            // ProfileAttribute.Controls.Add(br);
            // foreach (ProfileAttribute proAttribute in listAttribute)
            // {
            //     System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            //     Label lbl = new Label();
            //     lbl.Width = 150;
            //     lbl.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.Blue;
            //     lbl.ID = "lbl" + proAttribute.ProfileAttributeID.ToString();
            //     lbl.Text = proAttribute.ProfileAttributeName;
            //     TextBox txt = new TextBox();
            //     txt.Width = 150;
            //     txt.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
            //     txt.ID = "txt" + proAttribute.ProfileAttributeID.ToString();
            //     txt.Text = proAttribute.Response;
            //     ProfileAttribute.Controls.Add(lbl);
            //     ProfileAttribute.Controls.Add(txt);
            //     ProfileAttribute.Controls.Add(brTab);
            #endregion

            System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            divProfileAttribute.Controls.Add(br);
            foreach(ProfileAttributeType type in profileAttributeType)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
                Label lbl = new Label();
                lbl.Width = 150;
                lbl.Height = 15;
                lbl.ForeColor = System.Drawing.Color.Blue;
                lbl.ID = "lbl" + type.ProfileAttributeTypeID.ToString();
                lbl.Text = type.Type;
                TextBox txt = new TextBox();
                txt.Width = 150;
                txt.Height = 15;
                lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
                ProfileAttribute attribute = _presenter.GetProfileAttributeByProfileIDAndType(profile,type);
                if(attribute==null)
                 {
                    attribute = new ProfileAttribute();
                    attribute.ProfileID = profile.ProfileID;
                    attribute.ProfileAttributeName = type.Type;
                    attribute.ProfileAttributeTypeID = type.ProfileAttributeTypeID;
                    _presenter.SaveAttribute(attribute);
                 };
                divProfileAttribute.Controls.Add(lbl);
                divProfileAttribute.Controls.Add(txt);
                divProfileAttribute.Controls.Add(brTab);
                txt.ID = "txt" + attribute.ProfileAttributeID.ToString();
                txt.Text = attribute.Response;
            }
        }
Exemplo n.º 18
0
 public ProfileAttribute GetProfileAttributesByProfileIDAndTypeID(Profile profile, ProfileAttributeType type)
 {
     return _profileAttributeRepository.GetProfileAttributesByProfileIDAndTypeID(profile.ProfileID, type.ProfileAttributeTypeID);
 }
Exemplo n.º 19
0
 public ProfileAttribute GetProfileAttributeByProfileIDAndType(Profile profile, ProfileAttributeType type)
 {
     return _profileAttributeService.GetProfileAttributesByProfileIDAndTypeID(profile, type);
 }
Exemplo n.º 20
0
 public List<ProfileAttribute> GetProfileAttributeByProfileID(Profile profile)
 {
     return _profileAttributeService.GetProfileAttributesByProfileID(profile.ProfileID);
 }
Exemplo n.º 21
0
        public void Init(IViewProfile view, bool IsPostback)
        {
            _view = view;
            accountID = _webContext.AccountID;
                if (_userSession.LoggedIn)
                {
                    viewerID = _userSession.CurrentUser.AccountID;

                }
                if (accountID == 0)
                {
                    _view.DisplayAccountInfo(viewerID, viewerID);
                    accountID = viewerID;
                }
                else
                {
                    _view.DisplayAccountInfo(viewerID, accountID);

                    //_view.loadProfileAttribute(_listProfileAttributeType, profile);
                }

                LoadProfile(IsPostback,accountID);
                profile = _profileService.LoadProfileByAccountID(accountID);
                _listPrivacyFlags = _privacyService.GetListPrivacyFlag(profile.ProfileID);
                _listProfileAttributeType = _profileAttributeService.GetProfileAttributeType();
                _view.loadProfileAttribute(_listProfileAttributeType, profile);
               // }
        }
Exemplo n.º 22
0
 partial void UpdateProfile(Profile instance);
 public ProfileAttributeControlFull(Profile profile,List<ProfileAttributeType> listProfileAttributeType)
 {
     _listProfileAttributeType = listProfileAttributeType;
     _profile = profile;
     _Repository = new ProfileAttributeRepository();
 }
Exemplo n.º 24
0
 partial void DeleteProfile(Profile instance);
Exemplo n.º 25
0
        public void loadProfileAttribute(List<ProfileAttributeType> profileAttributeType,List<VisibilityLevel> ListVisibilityLevel,List<PrivacyFlag> PrivacyFlags, Profile profile)
        {
            #region MyRegion
            //foreach (ProfileAttributeType pt in profileAttributeType)
            //{
            //    ProfileAttributeControl ctr = new ProfileAttributeControl(profile, pt, _presenter._profileAttributeRepository);
            //    ProfileAttribute.Controls.Add(ctr);
            //}
            /* ProfileAttributeControlFull ctr = new ProfileAttributeControlFull(profile, profileAttributeType);
             ProfileAttribute.Controls.Add(ctr);*/
            //SPKTCore.Core.DataAccess.IProfileAttributeRepository _Repository = new SPKTCore.Core.DataAccess.Impl.ProfileAttributeRepository();
            // List<ProfileAttribute> listAttribute = new List<ProfileAttribute>();
            // listAttribute = _Repository.GetProfileAttributesByProfileID(profile.ProfileID);
            // if (listAttribute.Count != profileAttributeType.Count)
            // {
            //     _presenter.AddProfileAttribute(profileAttributeType, profile);
            // }
            // System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            // ProfileAttribute.Controls.Add(br);
            // foreach (ProfileAttribute proAttribute in listAttribute)
            // {
            //     System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            //     Label lbl = new Label();
            //     lbl.Width = 150;
            //     lbl.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.Blue;
            //     lbl.ID = "lbl" + proAttribute.ProfileAttributeID.ToString();
            //     lbl.Text = proAttribute.ProfileAttributeName;
            //     TextBox txt = new TextBox();
            //     txt.Width = 150;
            //     txt.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
            //     txt.ID = "txt" + proAttribute.ProfileAttributeID.ToString();
            //     txt.Text = proAttribute.Response;
            //     ProfileAttribute.Controls.Add(lbl);
            //     ProfileAttribute.Controls.Add(txt);
            //     ProfileAttribute.Controls.Add(brTab);
            #endregion

            System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            divProfileAttribute.Controls.Add(br);
            foreach(ProfileAttributeType type in profileAttributeType)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
                Label lbl = new Label();
                lbl.Width = 150;
                lbl.ForeColor = System.Drawing.Color.Blue;
                lbl.ID = "lbl" + type.ProfileAttributeTypeID.ToString();
                lbl.Text = type.Type;
                TextBox txt = new TextBox();
                txt.Width = 150;
                lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
                DropDownList ddlVisibility = new DropDownList();
                ddlVisibility.ID = "ddlVisibility" + type.PrivacyFlagTypeID.ToString();
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                        li.Selected = _presenter.IsFlagSelected((int)type.PrivacyFlagTypeID, level.VisibilityLevelID, PrivacyFlags);
                    ddlVisibility.Items.Add(li);
                }
                ProfileAttribute attribute = _presenter.GetProfileAttributeByProfileIDAndType(profile,type);
                if(attribute==null)
                 {
                    attribute = new ProfileAttribute();
                    attribute.ProfileID = profile.ProfileID;
                    attribute.ProfileAttributeName = type.Type;
                    attribute.ProfileAttributeTypeID = type.ProfileAttributeTypeID;
                    _presenter.SaveAttribute(attribute);
                 };
                divProfileAttribute.Controls.Add(lbl);
                divProfileAttribute.Controls.Add(txt);
                divProfileAttribute.Controls.Add(ddlVisibility);
                divProfileAttribute.Controls.Add(brTab);
                txt.ID = "txt" + attribute.ProfileAttributeID.ToString();
                txt.Text = attribute.Response;
            }
        }
Exemplo n.º 26
0
 public void SaveProfileTable(Profile profile)
 {
     _profileRepository.SaveProfile(profile);
 }
Exemplo n.º 27
0
 public void SaveProfile(Profile profile)
 {
     _profileService.SaveProfile(profile);
 }
Exemplo n.º 28
0
 public ProfileAttributeControl(Profile pro,ProfileAttributeType proAttrType, IProfileAttributeRepository repository)
 {
     _profile = pro;
     _ProfileAttributeType = proAttrType;
     _Repository = repository;
 }
Exemplo n.º 29
0
 public PrivacyFlag SavePrivacyFlag(ProfileAttributeType profileAttributeType, Profile profileID)
 {
     throw new NotImplementedException();
 }