public async Task DeleteAsync(Guid id) { using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(AddressQuery.Delete(id)); } }
//我的常用地址 public PageModel <UsersAddress> MyAddress(AddressQuery queryInfo, ref Meta meta) { return(Try(context => { string sql = "SELECT * FROM UsersAddress WHERE 1=1 "; List <SqlParameter> paramList = new List <SqlParameter>(); //查询 if (!string.IsNullOrEmpty(queryInfo.UserID)) { sql += " AND UserID= @UserID"; paramList.Add(new SqlParameter("@UserID", queryInfo.UserID)); } if (!string.IsNullOrEmpty(queryInfo.Address)) { sql += " AND Address like @Address"; paramList.Add(new SqlParameter("@Address", "%" + queryInfo.Address + "%")); } if (!string.IsNullOrEmpty(queryInfo.Phone)) { sql += " AND Phone like @Phone"; paramList.Add(new SqlParameter("@Phone", "%" + queryInfo.Phone + "%")); } return context.QuerySql <UsersAddress>(sql, queryInfo, paramList.ToArray()); })); }
public async Task <IEnumerable <Address> > GetAllAsync() { using (var connection = context.CreateConnection()) { return(await connection.QueryAsync <Address>(AddressQuery.All())); } }
/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance Address mock = CreateMockInstance(tm); bool result = DataRepository.AddressProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); AddressQuery query = new AddressQuery(); query.AppendEquals(AddressColumn.AddressId, mock.AddressId.ToString()); query.AppendEquals(AddressColumn.AddressLine1, mock.AddressLine1.ToString()); if (mock.AddressLine2 != null) { query.AppendEquals(AddressColumn.AddressLine2, mock.AddressLine2.ToString()); } query.AppendEquals(AddressColumn.City, mock.City.ToString()); query.AppendEquals(AddressColumn.StateProvinceId, mock.StateProvinceId.ToString()); query.AppendEquals(AddressColumn.PostalCode, mock.PostalCode.ToString()); query.AppendEquals(AddressColumn.Rowguid, mock.Rowguid.ToString()); query.AppendEquals(AddressColumn.ModifiedDate, mock.ModifiedDate.ToString()); TList <Address> results = DataRepository.AddressProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }
public QueryResult <AddressDto> GetAddressByQuery(AddressQuery queryObj) { var result = new QueryResult <AddressDto>(); var query = GLNdbDiagramContainer.Addresses.AsQueryable(); query = query.ApplyAddressFiltering(queryObj); var columnsMap = new Dictionary <string, Expression <Func <Address, object> > >() { ["addressLineOne"] = a => a.AddressLineOne, ["addressLineTwo"] = a => a.AddressLineTwo, ["addressLineThree"] = a => a.AddressLineThree, ["addressLineFour"] = a => a.AddressLineFour, ["level"] = a => a.Level }; if (string.IsNullOrWhiteSpace(queryObj.SortBy)) { queryObj.SortBy = "addressLineOne"; } query = query.ApplyingOrdering(queryObj, columnsMap); result.TotalItems = query.Count(); result.TotalPages = Math.Ceiling((double)result.TotalItems / queryObj.PageSize); query = query.ApplyPaging(queryObj); result.Items = query.Select(DtoHelper.CreateAddressDto); result.CurrentPage = queryObj.Page; return(result); }
public ActionResult Addresses(string postcode) { AddressQuery addressQuery = new AddressQuery(); IEnumerable <AddressResult> addressResults = addressQuery.GetAddressesByPostCode(postcode); return(Json(addressResults)); }
public Base <object> Address(AddressQuery model) { Meta meta = new Meta(); PageModel <UsersAddress> list = new PageModel <UsersAddress>(); //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(model.Token); if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { model.UserID = token.UserId; list = UserService.MyAddress(model, ref meta); } Base <object> response = new Base <object> { Body = list, Meta = meta }; return(response); }
public NexplorerApiController(IMapper mapper, RedisCommand redis, ExchangeQuery exchangeQuery, StatQuery statQuery, AddressQuery addressQuery) { _mapper = mapper; _redis = redis; _exchangeQuery = exchangeQuery; _statQuery = statQuery; _addressQuery = addressQuery; }
public async Task <PersonAddress> Query(AddressQuery query) { var personAddress = await mainDbContext .PersonAddress .FirstOrDefaultAsync(p => p.PersonId == query.PersonId && p.Id == query.AddressId); return(personAddress); }
public AddressStatsJob(ILogger <AddressStatsJob> logger, RedisCommand redisCommand, AddressQuery addressQuery, BlockQuery blockQuery, NexusQuery nexusQuery) : base(30, logger) { _redisCommand = redisCommand; _addressQuery = addressQuery; _blockQuery = blockQuery; _nexusQuery = nexusQuery; }
public async Task <Address> GetByIdAsync(Guid id) { using (var connection = context.CreateConnection()) { var query = await connection.QueryAsync <Address>(AddressQuery.ById(id)); return(query.SingleOrDefault()); } }
public async Task <PersonAddressDto> Query(Guid personId, Guid addressId) { var query = new AddressQuery { PersonId = personId, AddressId = addressId }; var address = await dispatcher.Query <AddressQuery, PersonAddress>(query); return(Mapper.Map(address).ToANew <PersonAddressDto>()); }
public async Task <Address> UpdateAsync(Address Address) { using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(AddressQuery.Update(Address)); return(Address); } }
public TrustAddressCacheJob(ILogger <TrustAddressCacheJob> logger, NexusQuery nexusQuery, BlockQuery blockQuery, NexusDb nexusDb, AddressQuery addressQuery, RedisCommand redisCommand) : base(180, logger) { _nexusQuery = nexusQuery; _blockQuery = blockQuery; _nexusDb = nexusDb; _addressQuery = addressQuery; _redisCommand = redisCommand; }
public AddressesController(UserManager <ApplicationUser> userManager, AddressQuery addressQuery, CurrencyQuery currencyQuery, ExchangeQuery exchangeQuery, BlockQuery blockQuery, UserQuery userQuery, TransactionQuery transactionQuery) { _userManager = userManager; _addressQuery = addressQuery; _currencyQuery = currencyQuery; _exchangeQuery = exchangeQuery; _blockQuery = blockQuery; _userQuery = userQuery; _transactionQuery = transactionQuery; }
public async Task <Address> CreateAsync(Address Address) { if (Address.Id == Guid.Empty) { Address.Id = Guid.NewGuid(); } using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(AddressQuery.Insert(Address)); return(Address); } }
public async Task <IActionResult> Checkout() { var deliveryAddress = new AddressQuery(); var searchCities = new SearchCitys(); var searchCountries = new SearchCountrys(); Result resultCountry = await searchCountriesService.HandleAsync(searchCountries); Result resultCity = await searchCitiesService.HandleAsync(searchCities); ViewBag.Cities = new SelectList(resultCity.Value, "Id", "Name", deliveryAddress.CountryId); ViewBag.Countries = new SelectList(resultCountry.Value, "Id", "Name", deliveryAddress.CityId); return(View()); }
public BlockSyncFixture() { var sc = new ServiceCollection(); Settings.BuildConfig(sc); Settings.AttachConfig(sc.BuildServiceProvider(), true); var testDb = new NexusTestDesignTimeDbContextFactory().CreateDbContext(null); Client = new NxsClient(Settings.Connection.Nexus); InsertCommand = new BlockInsertCommand(); DeleteCommand = new BlockDeleteCommand(); AddressAggregator = new AddressAggregatorCommand(); Mapper = new AutoMapperConfig().GetMapper(); NexusQuery = new NexusQuery(Client, Mapper); BlockQuery = new BlockQuery(testDb, Mapper); AddressQuery = new AddressQuery(testDb, null); }
public Address Create(Address Address) { if (Address.Id == Guid.Empty) { Address.Id = Guid.NewGuid(); } if (Address.Line2 == null) { Address.Line2 = String.Empty; } using (var connection = context.CreateConnection()) { connection.Execute(AddressQuery.Insert(Address)); return(Address); } }
public ResponseMessageData <ListItemModel> FillNextListByName(AddressQuery addressQuery) { try { string sControlName; var response = new ResponseMessageData <ListItemModel> { IsSuccess = true, LstData = AppInit.Container.Resolve <IAddressService>().FillNextListByName(addressQuery.NextRegion, addressQuery.ItemSelId, out sControlName), Message = sControlName }; return(response); } catch (Exception ex) { SharedLogger.LogError(ex); return(ResponseMessageData <ListItemModel> .CreateCriticalMessage("No fue posible determinar la siguiente región")); } }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 20JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Default constructor. */ public GClientGeocoder() { _addressQuery = new AddressQuery(); }
public async Task <Address> GetById(Guid id) => await _context.Addresses.Where(AddressQuery.FindById(id)).AsNoTracking().FirstOrDefaultAsync();
public NexusAddressCacheJob(ILogger <NexusAddressCacheJob> logger, AddressQuery addressQuery, RedisCommand redisCommand) : base(180, logger) { _addressQuery = addressQuery; _redisCommand = redisCommand; }
public IHttpActionResult GetAddressByQuery([FromBody] AddressQuery filterResource) { var queryResult = _unitOfWork.Addresses.GetAddressByQuery(filterResource); return(Ok(queryResult)); }
public static IQueryable <Address> ApplyAddressFiltering(this IQueryable <Address> query, AddressQuery queryObj) { if (queryObj.Active) { query = query.Where(a => a.Active); } else { query = query.Where(a => a.Active == false); } if (!string.IsNullOrWhiteSpace(queryObj.SearchTerm)) { query.Where(a => a.AddressLineOne.Contains(queryObj.SearchTerm) || a.AddressLineTwo.Contains(queryObj.SearchTerm) || a.AddressLineThree.Contains(queryObj.SearchTerm) || a.AddressLineFour.Contains(queryObj.SearchTerm) || a.Postcode.Contains(queryObj.SearchTerm)); } if (queryObj.Level > 0) { query = query.Where(a => a.Level == queryObj.Level); } return(query); }
public UserQuery(NexplorerDb nexplorerDb, AddressQuery addressQuery, IMapper mapper) { _nexplorerDb = nexplorerDb; _addressQuery = addressQuery; _mapper = mapper; }
public IActionResult GetUnconfirmedBallance(string address) { ulong balance = AddressQuery.GetUnconfirmedBalance(address); return(Ok(balance)); }