internal static async Task GetUserByPhoneNumberAsync(string phoneNumber) { // [START get_user_by_phone] UserRecord userRecord = await FirebaseAuth.DefaultInstance.GetUserByPhoneNumberAsync(phoneNumber); // See the UserRecord reference doc for the contents of userRecord. Console.WriteLine($"Successfully fetched user data: {userRecord.Uid}"); // [END get_user_by_phone] }
private void lstUsers_SelectedIndexChanged(object sender, EventArgs e) { UserRecord u = lstUsers.SelectedItem as UserRecord; if (u != null) { txtUserID.Text = Profile.DirNametoID64(u.DirName).ToString(); } }
private static AccountRecord CreateAccount(this ModelBuilder builder, UserRecord user, string name, int id) { var account = new AccountRecord { Id = id, Name = name, UserId = user.Id }; builder.Entity <AccountRecord>().HasData(account); return(account); }
private static void CreateUserCommission(this ModelBuilder builder, UserRecord user, CommissionRecord commissionPattern, CurrencyRecord currency, OperationType type, int mul) { var commission = commissionPattern.CreateSameCommission(type, mul * commissionPattern.Id + 1); commission.CurrencyId = currency.Id; commission.UserId = user.Id; builder.Entity <CommissionRecord>().HasData(commission); }
/// <summary> /// Remove the email verification code for a specified user in the data store. /// </summary> /// <param name="username">Username that the email verification code is removed from.</param> /// <returns>Returns true if the operation is successfull and false if it failed.</returns> public static bool RemoveEmailCode(string username) { // Everything related to the email code has no value. UserRecord record = new UserRecord(username, emailCode: Constants.NoValueString, emailCodeTimestamp: Constants.NoValueLong, emailCodeFailures: Constants.NoValueInt); return(_userDAO.Update(record)); }
public ActionResult SearchUsers(UserRecord userRecord) { userRecord.page = int.Parse(Request["page"]); userRecord.rows = int.Parse(Request["rows"]); UserRecordBLL bll = new UserRecordBLL(); UserRecordList userRecordList = bll.getUserList(userRecord); return(Json(userRecordList, JsonRequestBehavior.AllowGet)); }
private void DoWork(object sender, DoWorkEventArgs e) { MatchingResults = null; MatchedRecord = null; MatchedResult = null; MatchedRecordId = string.Empty; List <DbTemplateRecord> usergDbTemplates = new List <DbTemplateRecord> { }; try { MatchingResults = new List <MatchingResult>(); //Search Through only user's BaseDataId During Verification Mode bool verifyMode = _AppSettings.AppMode.Equals("Verify", StringComparison.InvariantCulture); if (verifyMode && SearchUserId != null) { usergDbTemplates = DbTemplates.Where(x => x.UserPrimaryCode == SearchUserId.Trim()).ToList(); } //User a filtered Down DB Templete if the System is in Verify Mode //Otherwise, use the Full Pre-loaded DbTemplates foreach (var n in (verifyMode ? usergDbTemplates : DbTemplates)) { if (n.template != null) { //int score = Matcher.IdentifyNext(n.template); //if (score > 0) //{ // MatchingResult result = new MatchingResult // { // UserPrimaryCode = n.UserPrimaryCode, // BaseDataId = n.baseDataId, // TemplateId = n.templateId, // Score = score // }; // MatchingResults.Add(result); //} } } if (MatchingResults.Count > 0) { e.Result = MatchingResults.OrderByDescending(x => x.Score).FirstOrDefault(); } } catch (Exception ex) { Logger.logToFile(ex, AppSettings.ErrorLogPath); } finally { //Matcher.IdentifyEnd(); } }
public UserInfoControl(ApplicationController applicationState, UserRecord UserRecord) { this._UserRecord = UserRecord; this.applicationState = applicationState; InitializeComponent(); DisplayUserInfo(); DisplayTimer.Interval = Convert.ToInt32(new AppSettings().MessageDuration); DisplayTimer.Start(); }
public static User ToDomainModel(UserRecord userData) { User user = new User(userData.Id, userData.Username, userData.FirstName, userData.LastName, userData.Email); return(user); }
public static UserRecord CreateUserRecord(string username, string firstname, string lastname, string password) { var user = new UserRecord(); user.Username = username; user.FirstName = firstname; user.LastName = lastname; user.Password = password; return(user); }
public UserRecordVM(UserRecord userRecord) { Id = userRecord.Id; FirstName = userRecord.FirstName; LastName = userRecord.LastName; hobbyDBUserName = userRecord.HDBUserName; Notes = userRecord.Notes; Payouts = userRecord.Payouts; Carts = db.Carts.Where(c => c.Transactions.Any(t => t.SellerId == Id)).ToList(); }
public Task UpdateUserAsync(UserRecord record, CancellationToken cancellationToken = default) => PutItemsAsync( record, pk: USER_PREFIX + record.UserId, sk: INFO, gs1pk: USERS, gs1sk: USER_PREFIX + record.UserId, UpdateItemConfig, cancellationToken );
public async Task <List <LibraryRecordId> > GetLibraryRecordsByUserAsync(UserRecord user) { var query = allLibraryRecordsQuery; query.Filter = (a => a.User == user); var records = await query.GetResultsAsync(); return(records.Select(a => (LibraryRecordId)a.Id).ToList()); }
public void Can_create_account_when_salary_exeeds_expenses_by_specific_amount( float salary, float expenses, bool canCreate) { var record = new UserRecord { Salary = salary, Expenses = expenses }; Assert.That(record.CanCreateAccount, Is.EqualTo(canCreate)); }
public void DeleteUser(int id) { using (VendingMachineContext dbContext = VendingMachineContext.InstanceFactory()) { UserRecord userRecord = dbContext.UserRecords.Select(x => x).Where(x => x.Id == id).First(); dbContext.UserRecords.Remove(userRecord); dbContext.SaveChanges(); } }
public void TestAddFavouriteToUser() { testRecord = testBase.GetUserByCredentials("email", "pass"); int beforeCount = testRecord.FavouriteADS.Count; testRecord.AddFavouriteADS(new ADS()); int afterCount = testRecord.FavouriteADS.Count; Assert.IsTrue(afterCount == beforeCount + 1); }
public void UpdateUser(UserRecord user) { using (VendingMachineContext dbContext = VendingMachineContext.InstanceFactory()) { UserRecord userRecord = dbContext.UserRecords.Select(x => x).Where(x => x.Id == user.Id).First(); user.CopyTo(ref userRecord); dbContext.SaveChanges(); } }
//构造函数 public UserRecordMediator(UserRecord viewComponent) : base(NAME, viewComponent) { Debug.Log("进入Mediator()的构造函数"); // others View.StartRecoder += Listener_StartRecoder; View.StopRecoder += Listener_StopRecoder; View.PlayRecoderNomal += Listener_PlayRecoderNomal; View.PlayRecoderHight += Listener_PlayRecoderHight; }
public User UserRecordToUser(UserRecord userRecord) { return(new User { Name = userRecord.Name, IsAdmin = userRecord.UserClaims.FirstOrDefault(uc => uc.Claim.ClaimName == "admin") != null, Messages = userRecord.Messages?.Select(MessageRecordToMessage).ToList() ?? new List <Message>(), UserId = userRecord.UserId }); }
public static void Login(string user, string password, Action <string> onSuccess, Action <string, string> onFailure, string client) { if (IsLoggingIn) { return; } IsLoggingIn = true; Thread loginThread = new Thread(() => { int result; result = FacePlus.Login(user, password, client); string login_message = FacePlus.LoginString(); if (!Enum.IsDefined(typeof(LoginCode), result)) { onFailure("Login Failed (Server Code: " + result + ").", login_message); } else { switch ((LoginCode)result) { case LoginCode.Success: User = new UserRecord() { Email = user }; onSuccess(login_message); break; case LoginCode.Forbidden: onFailure("Incorrect username or password.", login_message); break; case LoginCode.InternalError: onFailure("Login Failed, Internal Error (" + result + ").", login_message); break; case LoginCode.ServerError: onFailure("Server Error (500). Try again later.", login_message); break; default: onFailure("Login Failed (Server Code: " + result + ").", login_message); break; } } IsLoggingIn = false; }); loginThread.Start(); while (!loginThread.IsAlive) { } }
/// <summary> /// Check if an administrator alive exists into the database /// </summary> /// <returns></returns> public bool ExistAdministrator() { try { if (Database == null) { return(false); } // Look for an enabled user within an enabled module in administrator mode ! foreach (ModuleRecord currentModule in (from module in Database.Module where module.Profile == UserProfile.EUserProfile.Administrator && module.Enable && module.Module == ModuleRecord.EModule.Administration select module).ToList()) { InformationRecord information = Database._Information.Find("Module", currentModule.Id); if (information != null && information.IsDeleted) { continue; } foreach (UserModuleRecord currentUserModule in (from userModule in Database.UserModule where userModule.ModuleId == currentModule.Id select userModule).ToList()) { information = Database._Information.Find("UserModule", currentUserModule.Id); if (information != null && information.IsDeleted) { continue; } UserRecord currentUser = Database.User.Find(currentUserModule.UserId); if (currentUser == null || !currentUser.IsEnable()) { continue; } information = Database._Information.Find("User", currentUser.Id); if (information == null || !information.IsDeleted) { return(true); } } } return(false); } catch (System.Exception ex) { Exception($"Unable to check if an administrator is defined into the database", ex); return(false); } }
internal static UserRecord FindSampleUserRecord() { DataTable result = new DataTable(); MySqlDataAdapter Adapter; string query = " SELECT DISTINCT " + " eid_base_data.BASEDATAID," + " eid_base_data.PROJECTPRIMARYCODE," + " eid_base_data.TITLEPREFIX," + " eid_base_data.SURNAME," + " eid_base_data.FIRSTNAME," + " eid_base_data.MIDDLENAME," + " eid_base_data.MOBILENUMBER," + " eid_photographs.PHOTOGRAPH" + " FROM" + " eid_base_data" + " LEFT JOIN eid_photographs on eid_base_data.BASEDATAID = eid_photographs.BASEDATAID LIMIT 1"; MySqlCommand command = new MySqlCommand(); command.Connection = myConn; command.CommandText = query; Adapter = new MySqlDataAdapter(command); MySqlCommandBuilder cb = new MySqlCommandBuilder(Adapter); Adapter.Fill(result); if (result.Rows.Count > 0) { DataRow row = result.Rows[0]; UserRecord res = new UserRecord(); res.Id = Convert.ToInt32(row[0]); res.ProjectPrimaryCode = row[1].ToString(); res.Title = row[2].ToString(); res.Surname = row[3].ToString(); res.FirstName = row[4].ToString(); res.MiddleName = row[5].ToString(); res.PhoneNumber = row[6].ToString(); res.Photo = FetchPhotoFromResultSet(row[7]); //Load User Custom Data AddCustomDataToUserRecords(res, out res); return(res); } else { return(null); } }
public User FindById(int id) { UsersModelMapper map = new UsersModelMapper(); using (VendingMachineContext dbContext = VendingMachineContext.InstanceFactory()) { UserRecord userRecord = dbContext.UserRecords.Select(x => x).Where(x => x.Id == id).First(); return(map.MapFromTable(userRecord)); } }
public void ToUserRecord_GoodUserEntity_UserRecord() { var entity = new UserEntity { Id = Guid.NewGuid(), Name = "user" }; UserRecord result = NotifierConverter.ToUserRecord(entity); Assert.Equal(entity.Id, result.Id); Assert.Equal(entity.Name, result.Name); }
public bool CredentialsCheck(UserRecord record) { UserRecord dbRecord = _databaseContext.UserRecords.FirstOrDefault(user => user.UserName == record.UserName); if (dbRecord == null) { return(false); } return(record.PasswordHash.SequenceEqual(dbRecord.PasswordHash)); }
/// <summary> /// Creates a new instance of the <see cref="User"/> class based on the <paramref name="userRecord"/>. /// </summary> public User(UserRecord userRecord) { if (userRecord == null) { throw new ArgumentNullException(nameof(userRecord)); } _userName = userRecord.UserName; _email = userRecord.Email; _lastLogin = userRecord.LastLogin; }
public void Init(UserRecord record) { this.userRecord = record; InitializeUI(); SetUserImage(); if (User.GetInstance.UserID == record.userID) { ChangeTextColorToRed(); } }
public async Task <long> PostUserRecord([FromBody] UserRecord userRecord) { var xx = _db.UserRecord.ToList(); _db.UserRecord.Add(userRecord); await _db.SaveChangesAsync(); return(userRecord.Id);; }
public EntityEntry <UserRecord> AddUser(UserRecord record) { if (GetUserByName(record.UserName) == null) { var result = _databaseContext.UserRecords.Add(record); _databaseContext.SaveChanges(); return(result); } return(null); }
private BotReplyType EnterSymbolToAdd(UserRecord userRecord, List <string> symbols) { foreach (var symbol in symbols) { userRecord.Subscriptions.Add(symbol); } userRecord.ChatStatus = ChatStatus.None; database.UpdateUser(userRecord); logger.MakeLog($"InputDataParse: {userRecord.Id} successfully add symbol"); return(BotReplyType.SuccessfullyAddSymbol); }
public static void Login(string user, string password, Action<string> onSuccess, Action<string,string> onFailure, string client ) { if(IsLoggingIn){ return; } IsLoggingIn = true; Thread loginThread = new Thread(() =>{ int result; result = FacePlus.Login (user, password, client); string login_message = FacePlus.LoginString(); if(!Enum.IsDefined(typeof(LoginCode), result)) { onFailure("Login Failed (Server Code: "+result+").",login_message); } else { switch((LoginCode)result) { case LoginCode.Success: User = new UserRecord() { Email = user }; onSuccess(login_message); break; case LoginCode.Forbidden: onFailure("Incorrect username or password.",login_message); break; case LoginCode.InternalError: onFailure("Login Failed, Internal Error (" + result +").",login_message); break; case LoginCode.ServerError: onFailure("Server Error (500). Try again later.",login_message); break; default: onFailure("Login Failed (Server Code: "+result+").",login_message); break; } } IsLoggingIn = false; }); loginThread.Start (); while(!loginThread.IsAlive) {} }
public static void Logout() { User = null; FacePlus.Logout (); }
public static void Logout() { User = null; }
public SearchResults(int numOfUsers) { searchResultsData = new UserRecord[numOfUsers]; for(int i=0;i<numOfUsers;i++) { searchResultsData[i] = new UserRecord(); } }