public void DeleteProfile(Profile profile) { using (SPKTDataContext spktDC = conn.GetContext()) { spktDC.Profiles.Attach(profile, true); spktDC.Profiles.DeleteOnSubmit(profile); spktDC.SubmitChanges(); } }
public void GotoAccountProfile() { profile=_profileService.LoadProfileByAccountID(account.AccountID); if (profile != null) { _redirector.Redirect("~/Profiles/UserProfile.aspx"); } else _redirector.Redirect("~/Profiles/ManageProfile.aspx"); }
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; } }
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); } } }
// 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); }
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); } }
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(); }
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"); } }
private void detach_Profiles(Profile entity) { this.SendPropertyChanging(); entity.Account = null; }
partial void InsertProfile(Profile instance);
private void detach_Profiles(Profile entity) { this.SendPropertyChanging(); entity.LevelOfExperience = null; }
private void attach_Profiles(Profile entity) { this.SendPropertyChanging(); entity.Account = this; }
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(); }
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; }
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(); } }
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; }
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; } }
public ProfileAttribute GetProfileAttributesByProfileIDAndTypeID(Profile profile, ProfileAttributeType type) { return _profileAttributeRepository.GetProfileAttributesByProfileIDAndTypeID(profile.ProfileID, type.ProfileAttributeTypeID); }
public ProfileAttribute GetProfileAttributeByProfileIDAndType(Profile profile, ProfileAttributeType type) { return _profileAttributeService.GetProfileAttributesByProfileIDAndTypeID(profile, type); }
public List<ProfileAttribute> GetProfileAttributeByProfileID(Profile profile) { return _profileAttributeService.GetProfileAttributesByProfileID(profile.ProfileID); }
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); // } }
partial void UpdateProfile(Profile instance);
public ProfileAttributeControlFull(Profile profile,List<ProfileAttributeType> listProfileAttributeType) { _listProfileAttributeType = listProfileAttributeType; _profile = profile; _Repository = new ProfileAttributeRepository(); }
partial void DeleteProfile(Profile instance);
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; } }
public void SaveProfileTable(Profile profile) { _profileRepository.SaveProfile(profile); }
public void SaveProfile(Profile profile) { _profileService.SaveProfile(profile); }
public ProfileAttributeControl(Profile pro,ProfileAttributeType proAttrType, IProfileAttributeRepository repository) { _profile = pro; _ProfileAttributeType = proAttrType; _Repository = repository; }
public PrivacyFlag SavePrivacyFlag(ProfileAttributeType profileAttributeType, Profile profileID) { throw new NotImplementedException(); }