private static void ConvertProfile(IUserProfile profile, SqlCeConnection conn) { Console.Write("profile [{0}]...", profile.Name); using (SqlCeCommand cmd = conn.CreateCommand()) { cmd.CommandText = "INSERT INTO Profiles (Name, Description, DefaultVocabularyPath, Sleep, Beep) VALUES (@Name, @Description, @DefaultVocabularyPath, @Sleep, @Beep)"; cmd.Parameters.Add(new SqlCeParameter("Name", profile.Name)); cmd.Parameters.Add(new SqlCeParameter("Description", String.Empty)); cmd.Parameters.Add(new SqlCeParameter("DefaultVocabularyPath", profile.DefaultVocabulary)); cmd.Parameters.Add(new SqlCeParameter("Sleep", profile.SleepInterval)); cmd.Parameters.Add(new SqlCeParameter("Beep", profile.Beep)); cmd.Prepare(); cmd.ExecuteNonQuery(); } Console.WriteLine("ok"); ConvertActions(profile, conn); foreach (IStatistics statistics in profile as IEnumerable) { ConvertStatistics(statistics, conn); } }
public static iOSUser ConvertToUser (IUserProfile _user) { if (_user == null) return null; return new iOSUser(_user); }
public void Update(IUserProfile Profile) { UserProfile profile = context.UserProfiles.Where(p => p.UserId == Profile.UserId).FirstOrDefault(); profile.FirstName = Profile.FirstName; profile.LastName = Profile.LastName; profile.Gender = Profile.Gender; profile.Phone = Profile.Phone; profile.Mobile = Profile.Mobile; profile.Email = Profile.Email; profile.Image = Profile.Image; profile.Street = Profile.Street; profile.City = Profile.City; profile.Location = Profile.Location; profile.LocationLatitude = Profile.LocationLatitude; profile.LocationLongitude = Profile.LocationLongitude; profile.ContactMethod = Profile.ContactMethod; profile.NotificationFrequencyMinutes = Profile.NotificationFrequencyMinutes; profile.BankId = Profile.BankId == 0 ? null : Profile.BankId; profile.BankBranch = Profile.BankBranch; profile.AccountNo = Profile.AccountNo; profile.AccountName = Profile.AccountName; context.SaveChanges(); }
public SampleDataContext(DbContextOptions <SampleDataContext> options, IUserProfile userProfile) : base(options) { _UserProfile = userProfile; CanUseSessionContext = true; }
/// <summary> /// Saves the <paramref name="userProfile" /> to session. /// </summary> /// <param name="userProfile">The user profile.</param> /// <remarks>The built-in serializer used by ASP.NET for storing objects in session is unable to save an /// instance of <see cref="IUserProfile" />, so we first use JSON.NET to serialize it to a string, then /// persist *that* to session.</remarks> private static void SaveProfileToSession(IUserProfile userProfile) { if (HttpContext.Current.Session != null) { HttpContext.Current.Session["_Profile"] = Newtonsoft.Json.JsonConvert.SerializeObject(userProfile); } }
public IndexModel(ILogger <IndexModel> logger, IConfiguration _configuration, IToken _token, IUserProfile _userProfile) //add userprofile here so that you can null it and token { _logger = logger; configuration = _configuration; token = _token; userProfile = _userProfile; }
public bool SendSignupMail(IUserProfile user, string email, string password) { const string templateName = "Signup.txt"; // const string mailTemplatePath = "~/MailTemplates/Signup.txt"; bool IsHTML = templateName.Contains(".htm"); MailAddress FromEMAILADDRESS = new MailAddress("*****@*****.**", "Inscription sur CoVoyage"); string ToEMAILADDRESS = email; string SUBJECT = "Activation de votre compte CoVoyage"; string MAILBODY = this.LoadMailTemplate(templateName); string activationUrl = this.RefController.Url.CovCakeRouteUrl(CovCake.Routes.ACTIVATEACCOUNT, new { ac = user.ActivationKey.Value.Shrink() }); MAILBODY = MAILBODY.Replace("#SITENAME#", CovCakeConfiguration.SiteName); MAILBODY = MAILBODY.Replace("#DISPLAYNAME#", user.Prenom); MAILBODY = MAILBODY.Replace("#EMAIL#", email); MAILBODY = MAILBODY.Replace("#PASSWORD#", password); MAILBODY = MAILBODY.Replace("#ACTIVATIONURL#", activationUrl); MAILBODY = MAILBODY.Replace("#TITLE#", SUBJECT); try { this.SendMail(FromEMAILADDRESS, ToEMAILADDRESS, SUBJECT, MAILBODY, IsHTML); } catch (Exception ex) { CovCake.Log.Exception.cError("SendSignupMail userId=" + CovCake.GetCurrentUserId().ToString(), ex); return(false); } return(true); }
public long Add(IUserProfile Profile) { UserProfile profile = new UserProfile { UserId = Profile.UserId, Phone = Profile.Phone, Mobile = Profile.Mobile, FirstName = Profile.FirstName, LastName = Profile.LastName, Gender = Profile.Gender, Email = Profile.Email, Image = Profile.Image, Street = Profile.Street, City = Profile.City, Location = Profile.Location, LocationLatitude = Profile.LocationLatitude, LocationLongitude = Profile.LocationLongitude, ContactMethod = Profile.ContactMethod, NotificationFrequencyMinutes = Profile.NotificationFrequencyMinutes, BankId = Profile.BankId, BankBranch = Profile.BankBranch, AccountName = Profile.AccountName, AccountNo = Profile.AccountNo }; context.UserProfiles.Add(profile); context.SaveChanges(); return(profile.Id); }
public UserProfileDetailsForm(IUserProfile <DataTable> getUserAccessList, IUserProfile <DataTable> getActualUserAccessList, IUserProfile <DataTable> getActualUserBranchList, IUserProfile <int> deleteUserProfile) { this.getUserAccessList = getUserAccessList; this.getActualUserAccessList = getActualUserAccessList; this.getActualUserBranchList = getActualUserBranchList; this.deleteUserProfile = deleteUserProfile; }
/// <summary> /// Gets the current user's profile from session. Returns null if no object is found. /// </summary> /// <returns>Returns an instance of <see cref="IUserProfile" /> or null if no profile /// is found in session.</returns> /// <remarks>See the remarks for <see cref="SaveProfileToSession" /> for information about why we use /// JSON.NET during the deserialization process.</remarks> private static IUserProfile GetProfileFromSession() { IUserProfile pc = null; if (HttpContext.Current.Session != null) { // First see if we already deserialized it earlier in this HTTP call. var profile = HttpContext.Current.Items["Profile"]; if (profile != null) { return((IUserProfile)profile); } // Must be first call to this function in this page life cycle or no profile has yet been saved. Look in session. var pcString = HttpContext.Current.Session["_Profile"] as string; if (!string.IsNullOrWhiteSpace(pcString)) { pc = Newtonsoft.Json.JsonConvert.DeserializeObject <IUserProfile>(pcString, new UserProfileConverter(), new UserGalleryProfileConverter(), new AlbumProfileConverter(), new MediaObjectProfileConverter()); HttpContext.Current.Items["Profile"] = pc; } } return(pc); }
public void Send(IUserProfile userProfile, string baseUrl, Guid?websiteId) { int num; baseUrl = baseUrl.TrimEnd(new char[] { '/' }); SiteContext.AllowForAdmin(); bool flag = userProfile is AdminUserProfile; string str = (flag ? AdminUserNameHelper.AddPrefix(userProfile.UserName) : userProfile.UserName); dynamic expandoObjects = new ExpandoObject(); expandoObjects.UserName = userProfile.GetDisplayName(); expandoObjects.UserEmail = userProfile.UserName; expandoObjects.ActivationUrl = string.Concat(baseUrl, this.AuthenticationService.GeneratePasswordResetUrl(str, false)); dynamic obj = expandoObjects; num = (flag ? this.ConsoleSecuritySettings.EmailedPasswordLinkValidForDays : this.StorefrontSecuritySettings.EmailedPasswordLinkValidForDays); obj.ActivationUrlExpirationInDays = num; expandoObjects.ContentBaseUrl = baseUrl; string str1 = string.Concat((flag ? "Admin" : "Website"), "_AccountActivation"); EmailList orCreateByName = this.UnitOfWork.GetTypedRepository <IEmailListRepository>().GetOrCreateByName(str1, "Insite Commerce Account Activation", ""); this.EmailService.SendEmailList(orCreateByName.Id, userProfile.Email, expandoObjects, string.Empty, this.UnitOfWork, websiteId); if (userProfile.ActivationStatus == UserActivationStatus.EmailNotSent.ToString()) { userProfile.ActivationStatus = UserActivationStatus.EmailSent.ToString(); } userProfile.LastActivationEmailSentOn = new DateTimeOffset?(DateTimeProvider.Current.Now); this.UnitOfWork.Save(); }
public LoginController(IMemoryCache cache, ILoginService loginService, IHeaderViewModel headerViewModel, IADUserViewModel aDUserViewModel, IActionViewModel actionViewModel, IUserUtil userUtil, IUserProfile userProfile, IBitacora bitacora) : base(cache, headerViewModel, aDUserViewModel, actionViewModel, userUtil, bitacora) { LoginService = loginService; UserProfile = userProfile; }
public IUserProfile FetchParticularProfile(IUserProfile UserProfileObj) { try { string Token = UserProfileObj.GetToken(); DATALAYER.UserTemplate <IUserProfile> UserDataLayerTemplate = new DATALAYER.NormalUserTemplate(UserProfileObj); DataSet output = UserDataLayerTemplate.FetchProfile(UserProfileObj); if (output.Tables[0].Rows.Count > 0) { UserProfile profile = new UserProfile(); profile.SetFirstName(output.Tables[0].Rows[0]["firstname"].ToString()); profile.SetLastName(output.Tables[0].Rows[0]["lastname"].ToString()); profile.SetEmail(output.Tables[0].Rows[0]["email"].ToString()); profile.SetIsAdmin(output.Tables[0].Rows[0]["roleName"].ToString() == "ADMIN" ? true : false); profile.SetAmountOwe(0); profile.SetAmountPaid(0); profile.SetToken(Token); return(profile); } else { return(null); } } catch (Exception ex) { // log the exception Logger.Instance().Log(Fatal.Instance(), ex); throw ex; } }
public RecruitingSessionImpl(IUserProfile currentRecruitProfile, IPlayerProfile playerProfile, IMessagingPlatform platform, IGameManager manager) { this.currentRecruitProfile = currentRecruitProfile; this.playerProfile = playerProfile; this.platform = platform; this.gameManager = manager; }
public void PlatformProfileUpdated(PlatformConnectType connectType, IUserProfile profile) { if (this.OnPlatformProfileUpdated != null) { this.OnPlatformProfileUpdated(connectType, profile); } }
public void ChangeEmptyToEmpty() { // Creates empty configuration files. { int userChanged = 0; IContext ctx = CreateContext(); Host.CustomSystemConfigPath = GetTestFilePath("SystemConfiguration"); ctx.ConfigManager.UserChanged += (o, e) => userChanged++; File.Delete(Host.DefaultUserConfigPath); Assert.That(!File.Exists(Host.DefaultUserConfigPath)); Assert.That(ctx.ConfigManager.UserConfiguration != null); Assert.That(userChanged == 0); // there is no system configuration, so no user configuration. ctx.ConfigManager.SystemConfiguration.UserProfiles.AddOrSet("TestProfile", GetTestFilePath("UserConfiguration"), ConfigSupportType.File, true); Host.SaveUserConfig(); Host.SaveSystemConfig(); } // Creates second user configuration file { int userChanged = 0; IContext ctx = CreateContext(); Host.CustomSystemConfigPath = GetTestFilePath("SystemConfiguration"); ctx.ConfigManager.UserChanged += (o, e) => userChanged++; Assert.That(ctx.ConfigManager.UserConfiguration != null); Assert.That(userChanged == 1); ctx.ConfigManager.SystemConfiguration.UserProfiles.AddOrSet("SecondTestProfile", GetTestFilePath("UserConfiguration2"), ConfigSupportType.File, true); Host.SaveUserConfig(); Host.SaveSystemConfig(); } // Reload last user profile (userConfiguration2), and change the user to userconfiguration normal { int userChanged = 0; IContext ctx = CreateContext(); Host.CustomSystemConfigPath = GetTestFilePath("SystemConfiguration"); ctx.ConfigManager.UserChanged += (o, e) => userChanged++; Assert.That(ctx.ConfigManager.UserConfiguration != null); Assert.That(userChanged == 1); Assert.That(ctx.ConfigManager.SystemConfiguration.UserProfiles.LastProfile.Name == "SecondTestProfile"); int userConfigHashCode = ctx.ConfigManager.UserConfiguration.GetHashCode(); int pluginStatusCollectionHashCode = ctx.ConfigManager.UserConfiguration.PluginsStatus.GetHashCode(); IUserProfile profile1 = ctx.ConfigManager.SystemConfiguration.UserProfiles.Find(GetTestFilePath("UserConfiguration")); Assert.That(Host.LoadUserConfigFromFile(profile1)); Assert.That(userChanged == 2); Assert.That(ctx.ConfigManager.UserConfiguration.GetHashCode() == userConfigHashCode); Assert.That(ctx.ConfigManager.UserConfiguration.PluginsStatus.GetHashCode() == pluginStatusCollectionHashCode); } }
private IUserProfile GetCurrentUserInCache() { if (base.User.Identity.IsAuthenticated) { IUserProfile user = this.Session[USER_SESSION_KEY] as IUserProfile; if (user == null) { _currentUser = Data.UserDataAccess.GetUser(this.CurrentUserId); if (_currentUser == null) { //Authentifié mais le l'ID retourné n'existe plus dans la base des UserProfiles //Remove les cookies this.ForceUserLogOut(); } else { this.Session[USER_SESSION_KEY] = _currentUser; } } else { this._currentUser = user; } } else { _currentUser = null; } return(_currentUser); }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <param name="currUser"></param> /// <returns></returns> private string SaveUserImage(HttpPostedFileBase file, IUserProfile currUser) { //TODO: génération d'un thumb ? string fullImageFolder = CovCakeConfiguration.UserPhotoStorageFolder; string newFilename = currUser.UserId.ToString() + Path.GetExtension(file.FileName); string clientSideFilename = fullImageFolder + "/" + newFilename; string serverSideFileName = this.GetFullServerPath(fullImageFolder + "/" + newFilename); //Path.Combine(fullImageFolder,newFilename); int fullWidth = int.Parse(CovCakeConfiguration.AppSetting("userPhotoFullWidth")); int fullHeight = int.Parse(CovCakeConfiguration.AppSetting("userPhotoFullHeight")); //int tinyWidth =int.Parse(Configuration.AppSetting("userPhotoTinyWidth")); //int tinyHeight = int.Parse(Configuration.AppSetting("userPhotoTinyHeight"));; try { BitmapServices.ResizeAndSave(file.InputStream, fullWidth, fullHeight, true, serverSideFileName); } catch (Exception ex) { clientSideFilename = ""; CovCake.Log.Error("Save user image Error", ex); } return(clientSideFilename); }
private ActionResult GetUserPage(string UserNameOrId) { ErrorRedirectViewData UserError = new ErrorRedirectViewData { DelaySeconds = 5, RedirectUrl = Url.Action("Index", "Home"),// "/Projets/Liste", ErrorMsg = "Cet utilisateur n'existe pas." }; try { IUserProfile user = Data.UserDataAccess.GetUser(new Guid(UserNameOrId)); if (user == null) { user = Data.UserDataAccess.GetUser(UserNameOrId); } if (user == null) { return(View("ErrorRedirect", UserError)); } SetPageTitle("Profil de " + user.UserName); return(View(user)); } catch (Exception ex) { return(View("ErrorRedirect", UserError)); } }
/// <summary> /// Загрузка информации по игрокам /// </summary> /// <param name="scores">массив лучших результатов</param> private void LoadUsersLeaderboard(IScore[] scores) { // Список из id пользователей List <string> userIds = new List <string>(); // Перебираем результаты, заполняем список идентификаторами foreach (IScore score in scores) { userIds.Add(score.userID); } Social.LoadUsers(userIds.ToArray(), (users) => { // Скрываем значок загрузки _loading.SetActive(false); // Перебираем результаты в массиве foreach (IScore score in scores) { // Создаем пользователя и ищем его id массиве IUserProfile user = FindUser(users, score.userID); // Выводим в текстовое поле ранг, имя и счет игрока _leaderboard.text = score.rank + " - " + ((user != null) ? user.userName : "******") + " (" + score.value + ")\n\n"; } // Перемещаем скролл вверх _scrollRect.verticalNormalizedPosition = 1; // Сохраняем полученные данные PlayerPrefs.SetString("gp-leaderboard", _leaderboard.text); }); }
public ModelingSession CreateSession(IUserProfile profile) { if (db == null) throw new Exception("ModelerProxy has not been initialized."); return new ModelingSession(context, db, profile); }
public DonationsConfirmationModel(IToken _token, IConfiguration _configuration, IUserProfile _userProfile) { token = _token; configuration = _configuration; userProfile = _userProfile; amount = token.amount.ToString(); }
/// <summary> /// Persist the specified <paramref name="profile" /> to the data store. /// </summary> /// <param name="profile">The profile to persist to the data store.</param> internal static void Save(IUserProfile profile) { using (SqlConnection cn = SqlDataProvider.GetDbConnection()) { using (SqlCommand cmd = GetCommandUserGalleryProfileSave(cn)) { cmd.Parameters["@UserName"].Value = profile.UserName; cn.Open(); foreach (IUserGalleryProfile userGalleryProfile in profile.GalleryProfiles) { cmd.Parameters["@GalleryId"].Value = userGalleryProfile.GalleryId; cmd.Parameters["@SettingName"].Value = ProfileNameShowMediaObjectMetadata; cmd.Parameters["@SettingValue"].Value = userGalleryProfile.ShowMediaObjectMetadata; cmd.ExecuteNonQuery(); cmd.Parameters["@SettingName"].Value = ProfileNameEnableUserAlbum; cmd.Parameters["@SettingValue"].Value = userGalleryProfile.EnableUserAlbum; cmd.ExecuteNonQuery(); cmd.Parameters["@SettingName"].Value = ProfileNameUserAlbumId; cmd.Parameters["@SettingValue"].Value = userGalleryProfile.UserAlbumId; cmd.ExecuteNonQuery(); } } } }
public void InitializeComponent(IPageBrowser browser) { m_browser = browser; m_browser.NavigateCompleted += new EventHandler(m_browser_Navigated); m_browser.TabClosing += new EventHandler(m_browser_TabClosing); m_browser = browser; m_profile = ComponentFactory.GetComponent <IUserProfile>() as IUserProfile; if (m_profile == null) { throw new Exception("can not find IUserProfile component!"); } try { m_PageRecordList = FilterPage(m_profile.Get <List <PageRecordInfo> >(m_PageRecord_FileName)); m_ClosedTabList = FilterPage(m_profile.Get <List <ClosedTabInfo> >(m_ClosedTab_FileName)); } catch { //don't do anything } if (m_PageRecordList == null) { m_PageRecordList = new List <PageRecordInfo>(); } if (m_ClosedTabList == null) { m_ClosedTabList = new List <ClosedTabInfo>(); } Application.Current.Exit += new EventHandler(Current_Exit); }
void Start() { IUserProfile currentRecruitProfile = UserProfile.UserProfileGenerator(r); IPlayerProfile playerProfile = new TestPlayerProfile(); session = new RecruitingSessionImpl(currentRecruitProfile, playerProfile, platform, gameManager); }
public bool SendChangeEmailConfirmation(IUserProfile user, string newEmail) { const string templateName = "ChangeMailConfirmation.txt"; try { bool IsHTML = templateName.Contains(".htm"); string fromEmail = CovCakeConfiguration.SiteAdminEmail; string fromEmailName = "CoVoyage.net"; string subject = "Changement d'adresse email"; string toEmail = newEmail; string body = this.LoadMailTemplate(templateName); body = body.Replace("#DISPLAYNAME#", user.Prenom); body = body.Replace("#NEWEMAIL#", newEmail); var from = new MailAddress(fromEmail, fromEmailName); this.SendMailAsync(from, toEmail, subject, body, IsHTML); } catch (Exception ex) { CovCake.Log.Exception.cError(ex.Message, ex); return(false); } return(true); }
public bool SendForgotPasswordMail(IUserProfile user, string email, string newPassword) { const string templateName = "Forgot.txt"; try { string siteName = CovCakeConfiguration.SiteName; string siteUrl = CovCakeConfiguration.SiteUrl; string fromEmail = CovCakeConfiguration.SiteAdminEmail; string fromEmailName = "CoVoyage.net"; string subject = "Réinitialisation de votre mot de passe Covoyage"; bool IsHTML = templateName.Contains(".htm"); string body = this.LoadMailTemplate(templateName); body = body.Replace("#SITENAME#", siteName); body = body.Replace("#DISPLAYNAME#", user.Prenom); body = body.Replace("#EMAIL#", email); body = body.Replace("#PASSWORD#", newPassword); body = body.Replace("#TITLE#", subject); body = body.Replace("#WEBSITEURL#", siteUrl); var from = new MailAddress(fromEmail, fromEmailName); this.SendMail(from, email, subject, body, IsHTML); } catch (Exception ex) { CovCake.Log.Exception.cError("SendForgotPasswordMail", ex); return(false); } return(true); }
public IUserProfile TryGetUser(int userId) { IUserProfile userProfile = null; _userCache.TryGetValue(userId, out userProfile); return(userProfile); }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager) { UserManager = userManager; SignInManager = signInManager; _UserAccountProfile = new UserProfileManager(userManager); // _UserProfile = userProfile; }
public bool SendSignupConfirmation(IUserProfile user, string email, string password) { const string templateName = "SignupConfirm.txt"; // const string mailTemplatePath = "~/MailTemplates/Signup.txt"; bool IsHTML = templateName.Contains(".htm"); MailAddress FromEMAILADDRESS = new MailAddress("*****@*****.**", "Inscription sur CoVoyage"); string ToEMAILADDRESS = email; string SUBJECT = "Bienvenue sur CoVoyage.net"; string MAILBODY = this.LoadMailTemplate(templateName); // MAILBODY = MAILBODY.Replace("#SITENAME#", CovCakeConfiguration.SiteName); MAILBODY = MAILBODY.Replace("#DISPLAYNAME#", user.Prenom); MAILBODY = MAILBODY.Replace("#EMAIL#", email); MAILBODY = MAILBODY.Replace("#PASSWORD#", password); // MAILBODY = MAILBODY.Replace("#TITLE#", SUBJECT); try { // this.To.Add(new MailAddress(email)); this.SendMail(FromEMAILADDRESS, ToEMAILADDRESS, SUBJECT, MAILBODY, IsHTML); } catch (Exception ex) { CovCake.Log.Exception.cError("SendSignupConfirmation userId=" + CovCake.GetCurrentUserId().ToString(), ex); return(false); } return(true); }
private void OnLocalUserInitialized(IUserProfile profile = null) { PlayerProfile = PrepareProfile(UnityEngine.Social.localUser); Initialized = true; if (mOnInitializationSucceededCallbacks != null) { for (int i = 0; i < mOnInitializationSucceededCallbacks.Count; i++) { Action callback = mOnInitializationSucceededCallbacks[i]; if (callback != null) { callback.Invoke(); } } mOnInitializationSucceededCallbacks.Clear(); mOnInitializationSucceededCallbacks = null; } if (mOnInitializationFailedCallbacks != null) { mOnInitializationFailedCallbacks.Clear(); mOnInitializationFailedCallbacks = null; } // Dispatch event DispatchEventInitializationComplete(); }
private static void SaveProfileToSession(IUserProfile userProfile) { if (HttpContext.Current.Session != null) { HttpContext.Current.Session[GetSessionKeyNameForProfile(userProfile.UserName)] = userProfile; } }
public UserProfileController(IUserProfile userProfile, IConfiguration config, IHttpContextAccessor accessor, IDocs docs) { _userprofile = userProfile; _config = config; _accessor = accessor; _docs = docs; }
void HandleUsersLoaded (IUserProfile[] users) { Debug.Log ("*** HandleUsersLoaded"); foreach (IUserProfile user in users) { Debug.Log ("* user = "******";id:" + user.id); } }
public ModelingSession CreateSession(IUserProfile profile) { if (this.dateBaseSnapshot == null) { throw new Exception("ModelerProxy has not been initialized."); } return new ModelingSession(this.context, this.dateBaseSnapshot, profile); }
public ModelingSession CreateSession(IUserProfile profile) { if (this.dataBase == null) { throw new Exception("ModelerProxy has not been initialized."); } var session = new ModelingSession(this.context, this.dataBase, profile); return session; }
public void Init(IUserProfile view, bool IsPostBack) { if ((_userSession.LoggedIn == false) && (_webContext.AccountID <= 0)) _redirector.GoToAccountLoginPage(); else { _view = view; int accountID = _webContext.AccountID; bool IsUser = false; List<Alert> listAlert = new List<Alert>(); List<VisibilityLevel> _listVisibilityLevel = new List<VisibilityLevel>(); _listVisibilityLevel = _privacyService.GetListVisibilityLevel(); if (!IsPostBack) { int viewerID = -1; if (_userSession.LoggedIn) { viewerID = _userSession.CurrentUser.AccountID; if (accountID == viewerID) { _view.DisplayAccountInfo(viewerID, accountID); IsUser = true; } } if (accountID > 0) { if (_userSession.LoggedIn) { _view.LoadStatusControl(_listVisibilityLevel, IsUser); _view.DisplayAccountInfo(viewerID, accountID); listAlert = _alertService.GetAlerts(_userSession.CurrentUser.AccountID, accountID); _view.LoadAlert(listAlert, GetStatusToShow(_userSession.CurrentUser, _accountService.GetAccountByAccountID(accountID))); } else _view.LoadAlert(_alertService.GetAlertsByAccountID(accountID), GetStatusToShow(_userSession.CurrentUser, _accountService.GetAccountByAccountID(accountID))); } if (accountID == 0) { if (viewerID != -1) { _view.DisplayAccountInfo(viewerID, viewerID); IsUser = true; _view.LoadStatusControl(_listVisibilityLevel, IsUser); _view.LoadAlert(_alertService.GetAlerts(viewerID, viewerID), GetStatusToShow(_userSession.CurrentUser, _accountService.GetAccountByAccountID(viewerID))); } } } } }
public static iOSUser[] ConvertToUserList (IUserProfile[] _userList) { if (_userList == null) return null; int _count = _userList.Length; iOSUser[] _iosUsersList = new iOSUser[_count]; for (int _iter = 0; _iter < _count; _iter++) _iosUsersList[_iter] = new iOSUser(_userList[_iter]); return _iosUsersList; }
void loadFriendInfos(IUserProfile[] userProfiles) { avartarLoadQueue.Clear(); foreach (IUserProfile profile in userProfiles) { if (!userIdToProfileCache.ContainsKey(profile.id)) userIdToProfileCache.Add(profile.id, profile); if (!userIdToAvatarCache.ContainsKey(profile.id)) { if (profile.image == null) { avartarLoadQueue.Enqueue(profile); } } } myProfile = userIdToProfileCache[Social.localUser.id]; Debug.Log("Friends loaded count: " + userProfiles.Length); friendDataLoaded = true; }
private static void ConvertActions(IUserProfile profile, SqlCeConnection conn) { using (SqlCeCommand cmd = conn.CreateCommand()) { cmd.CommandText = "INSERT INTO Actions (ActionId, Action, Weight) VALUES (@ActionId, @Action, @Weight)"; cmd.Parameters.Add(new SqlCeParameter("ActionId", SqlDbType.NVarChar, 1)); cmd.Parameters.Add(new SqlCeParameter("Action", SqlDbType.NVarChar, 100)); cmd.Parameters.Add(new SqlCeParameter("Weight", SqlDbType.Int)); cmd.Prepare(); ConvertAction("M", "Modification", 10, cmd); ConvertAction("R", "Right Answer", -1, cmd); ConvertAction("W", "Wrong Answer", 3, cmd); ConvertAction("P", "No Answer", 5, cmd); } }
public AttorneyProfileViewModel(IUserProfile profile) { FirstName = profile.FirstName; LastName = profile.LastName; MiddleInitial = profile.MiddleInitial; DisciplinaryBoardNumber = profile.DisciplinaryBoardNumber; LawFirm = profile.LawFirm; Phone = profile.Phone; AddressLine1 = profile.AddressLine1; AddressLine2 = profile.AddressLine2; City = profile.City; State = profile.State; Zip = profile.Zip; County = profile.County; RegistrationDate = profile.RegistrationDate; UserName = profile.UserName; FullName = profile.FullName; }
public void Init(IUserProfile view,bool IsPostBack) { _view = view; if (!IsPostBack) { string profileID=_webContext.GetQueryStringValue("ProfileID"); List<Alert> listAlert = new List<Alert>(); if (_userSession.LoggedIn) { if (profileID != null) { int proID = int.Parse(profileID); Profile profile = _profileService.GetProfileByProfileID(proID); if (profile != null) { if (_userSession.CurrentUser.AccountID == profile.AccountID) { LoadAlertUserProfile(listAlert, _userSession.CurrentUser.AccountID); } else LoadAlert(listAlert, profile.AccountID); } else _view.Message("Không có Profile này"); } else { LoadAlertUserProfile(listAlert,_userSession.CurrentUser.AccountID); } } else { _view.Message("chua dang nhap"); } } }
/// <summary> /// Persist the specified <paramref name="profile"/> to the data store. /// </summary> /// <param name="profile">The profile to persist to the data store.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="profile" /> is null.</exception> public override void Profile_Save(IUserProfile profile) { if (profile == null) throw new ArgumentNullException("profile"); ProfileData.Save(profile); }
/// <summary> /// This method copy's each database field which is in the <paramref name="includedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_TakeOnly(IUserProfile source, params string[] includedColumns) { if (includedColumns.Contains(UserProfilesTable.UserIdCol)) this.UserId = source.UserId; if (includedColumns.Contains(UserProfilesTable.UserNameCol)) this.UserName = source.UserName; }
public new bool LoadUserConfigFromFile( IUserProfile profile ) { return base.LoadUserConfigFromFile( profile ); }
/// <summary> This method copy's each database field from the <paramref name="source"/> interface to this data row.</summary> public void Copy_From(IUserProfile source, bool includePrimaryKey = false) { if (includePrimaryKey) this.UserId = source.UserId; this.UserName = source.UserName; }
/// <summary> /// This method copy's each database field which is not in the <paramref name="excludedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_Ignore(IUserProfile source, params string[] excludedColumns) { if (!excludedColumns.Contains(UserProfilesTable.UserIdCol)) this.UserId = source.UserId; if (!excludedColumns.Contains(UserProfilesTable.UserNameCol)) this.UserName = source.UserName; }
/// <summary> This method copy's each database field into the <paramref name="target"/> interface. </summary> public void Copy_To(IUserProfile target, bool includePrimaryKey = false) { if (includePrimaryKey) target.UserId = this.UserId; target.UserName = this.UserName; }
public ModelingSessionAction WithProfile(IUserProfile profile) { return new ModelingSessionAction(context, profile); }
/// <summary> /// Parses the friends list. /// </summary> /// <param name="friends">Friend usernames to grab.</param> /// <returns>Array of user profiles.</returns> IUserProfile[] ParseFriends (IList friends) { IUserProfile[] friendList; if (friends == null) { friendList = new IUserProfile[0]; } else { friendList = new IUserProfile[friends.Count]; for (int i = 0; i < friends.Count; i++) { var friend = friends[i] as Dictionary<string, object>; var id = friend["user_id"] as string; string name = null; if (friend.ContainsKey("name")) { name = friend["name"].ToString(); } friendList[i] = new UserProfile(name, id, true); } } return friendList; }
public ModelingSession CreateModelingSession(IUserProfile profile) { return ModelerProxy.CreateSession(profile); }
public ValidationDecorator(IUserProfile profile) : base(profile) { }
public void SetFriends(IUserProfile[] friends){}
/// <summary> /// Saves the specified <paramref name="userProfile" />. Anonymous profiles (those with an /// empty string in <see cref="IUserProfile.UserName" />) are saved to session; profiles for /// users with accounts are persisted to the data store. The profile cache is automatically /// cleared. /// </summary> /// <param name="userProfile">The user profile to save.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="userProfile" /> is null.</exception> public static void SaveProfile(IUserProfile userProfile) { if (userProfile == null) throw new ArgumentNullException("userProfile"); if (String.IsNullOrEmpty(userProfile.UserName)) SaveProfileToSession(userProfile); else { Factory.SaveUserProfile(userProfile); } }
/// <summary> /// Creates a new recipe modeling session. Recipe modeling allows the user to generate optimal sets of recipes based on given ingredient usage and criteria. /// </summary> /// <param name="profile">A profile for the current user. Pass in UserProfile.Anonymous to indicate a generic user.</param> /// <returns>A modeling session able to generate and compile recipe sets based on the given profile.</returns> public virtual ModelingSession CreateModelingSession(IUserProfile profile) { return this.ModelerProxy.CreateSession(profile); }
private void SaveProfile(IUserProfile userProfile) { // Get reference to user's album. We need to do this *before* saving the profile, because if the user disabled their user album, // this method will return null after saving the profile. IAlbum album = UserController.GetUserAlbum(GalleryId); IUserGalleryProfile profile = userProfile.GetGalleryProfile(GalleryId); if (!profile.EnableUserAlbum) { AlbumController.DeleteAlbum(album); } if (!profile.EnableUserAlbum) { profile.UserAlbumId = 0; } ProfileController.SaveProfile(userProfile); }
public void SetFriends(IUserProfile[] friends) { this.m_Friends = friends; }
public ModelingSessionAction(IKPCContext context, IUserProfile profile) { session = context.CreateModelingSession(profile); }
/// <summary> /// Persist the specified <paramref name="profile"/> to the data store. /// </summary> /// <param name="profile">The profile to persist to the data store.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="profile" /> is null.</exception> public override void Profile_Save(IUserProfile profile) { if (profile == null) throw new ArgumentNullException("profile"); using (GspContext ctx = new GspContext()) { foreach (IUserGalleryProfile userGalleryProfile in profile.GalleryProfiles) { IUserGalleryProfile ugp = userGalleryProfile; // ShowMediaObjectMetadata UserGalleryProfileDto pDto = (from p in ctx.UserGalleryProfiles where p.UserName == ugp.UserName && p.FKGalleryId == ugp.GalleryId && p.SettingName == "ShowMediaObjectMetadata" select p).FirstOrDefault(); if (pDto == null) { pDto = new UserGalleryProfileDto { UserName = ugp.UserName, FKGalleryId = ugp.GalleryId, SettingName = "ShowMediaObjectMetadata", SettingValue = ugp.ShowMediaObjectMetadata.ToString(CultureInfo.InvariantCulture) }; ctx.UserGalleryProfiles.Add(pDto); } else { pDto.SettingValue = ugp.ShowMediaObjectMetadata.ToString(CultureInfo.InvariantCulture); } // EnableUserAlbum pDto = (from p in ctx.UserGalleryProfiles where p.UserName == ugp.UserName && p.FKGalleryId == ugp.GalleryId && p.SettingName == "EnableUserAlbum" select p).FirstOrDefault(); if (pDto == null) { pDto = new UserGalleryProfileDto { UserName = ugp.UserName, FKGalleryId = ugp.GalleryId, SettingName = "EnableUserAlbum", SettingValue = ugp.EnableUserAlbum.ToString(CultureInfo.InvariantCulture) }; ctx.UserGalleryProfiles.Add(pDto); } else { pDto.SettingValue = ugp.EnableUserAlbum.ToString(CultureInfo.InvariantCulture); } // UserAlbumId pDto = (from p in ctx.UserGalleryProfiles where p.UserName == ugp.UserName && p.FKGalleryId == ugp.GalleryId && p.SettingName == "UserAlbumId" select p).FirstOrDefault(); if (pDto == null) { pDto = new UserGalleryProfileDto { UserName = ugp.UserName, FKGalleryId = ugp.GalleryId, SettingName = "UserAlbumId", SettingValue = ugp.UserAlbumId.ToString(CultureInfo.InvariantCulture) }; ctx.UserGalleryProfiles.Add(pDto); } else { pDto.SettingValue = ugp.UserAlbumId.ToString(CultureInfo.InvariantCulture); } } ctx.SaveChanges(); } }