private MembershipUser ConvertFrom(UserAccountDataObject userObj) { if (userObj == null) { return(null); } MembershipUser user = new MembershipUser("TinyLibraryCQRSMembershipProvider", userObj.UserName, userObj.ID, userObj.Email, "", "", true, false, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.Now, DateTime.Now); return(user); }
private void ConvertFromReader(SqlDataReader reader, UserAccountDataObject obj) { obj.AddressCity = Convert.ToString(reader["Address_City"]); obj.AddressCountry = Convert.ToString(reader["Address_Country"]); obj.AddressState = Convert.ToString(reader["Address_State"]); obj.AddressStreet = Convert.ToString(reader["Address_Street"]); obj.AddressZip = Convert.ToString(reader["Address_Zip"]); obj.AggregateRootId = Convert.ToInt64(reader["AggregateRootId"]); obj.ContactPhone = Convert.ToString(reader["ContactPhone"]); obj.DisplayName = Convert.ToString(reader["DisplayName"]); obj.Email = Convert.ToString(reader["Email"]); obj.ID = Guid.Parse(Convert.ToString(reader["ID"])); obj.Password = Convert.ToString(reader["Password"]); obj.UserName = Convert.ToString(reader["UserName"]); }
public ActionResult Edit(UserAccountDataObject obj) { CommandServiceClient commandService = new CommandServiceClient(); commandService.UpdateUserAccount(obj.AggregateRootId, obj.DisplayName, obj.Email, obj.ContactPhone, new AddressDataObject { Country = obj.AddressCountry, State = obj.AddressState, City = obj.AddressCity, Street = obj.AddressStreet, Zip = obj.AddressZip }); commandService.Close(); return(RedirectToAction("MyAccount")); }
public UserAccountDataObject GetUserByGuid(Guid guid) { UserAccountDataObject userAccount = null; string sql = @"SELECT * FROM [UserAccounts] WHERE [ID]=@id"; using (SqlDataReader reader = SqlHelper.ExecuteReader(this.QueryDBConnectionString, CommandType.Text, sql, new SqlParameter("@id", guid))) { while (reader.Read()) { userAccount = new UserAccountDataObject(); this.ConvertFromReader(reader, userAccount); break; } reader.Close(); } if (userAccount != null) { userAccount.BorrowedBooks = this.PopulateBookTransferHistory(userAccount.ID); } return(userAccount); }
public UserAccountDataObject GetUserByEmail(string email) { UserAccountDataObject obj = null; string sql = @"SELECT * FROM [UserAccounts] WHERE [Email]=@email"; using (SqlDataReader reader = SqlHelper.ExecuteReader(this.QueryDBConnectionString, CommandType.Text, sql, new SqlParameter("@email", email))) { while (reader.Read()) { obj = new UserAccountDataObject(); this.ConvertFromReader(reader, obj); break; } reader.Close(); } if (obj != null) { obj.BorrowedBooks = this.PopulateBookTransferHistory(obj.ID); } return(obj); }