public PagedResult <CustomerDTO> GetCustomers(Token token, CustomerSearchCriteria customerSearchCriteria, PartialRetrievingInfo pageInfo) { var securityInfo = SecurityManager.EnsureAuthentication(token); var service = new CustomerService(Session, securityInfo, Configuration); return(service.GetCustomers(customerSearchCriteria, pageInfo)); }
public IEnumerable <Customer> Get(CustomerSearchCriteria searchCriteria) { IQueryable <Customer> query = customers.AsQueryable(); if (searchCriteria.CustomerType.HasValue) { query = query.Where(c => c.Type == searchCriteria.CustomerType); } if (searchCriteria.IsRemoved.HasValue) { query = query.Where(c => c.IsRemoved == searchCriteria.IsRemoved); } if (searchCriteria.From.HasValue) { query = query.Where(c => c.Birthday >= searchCriteria.From); } if (searchCriteria.To.HasValue) { query = query.Where(c => c.Birthday <= searchCriteria.To); } return(query); }
public CustomerSearchResult Search(CustomerSearchCriteria criteria) { using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) { var filter = PredicateBuilder.True <CustomerSearchResultItem>(); filter = filter.And(item => item.TemplateId == Templates.Customer.ID); foreach (var term in criteria.Terms) { filter = filter.And(item => item[term.Key].Like(term.Value)); } foreach (var term in criteria.TermsWithExactMatch) { filter = filter.And(item => item[term.Key] == term.Value); } var result = context.GetQueryable <CustomerSearchResultItem>().Filter(filter); foreach (var facet in criteria.Facets) { result = result.FacetOn(item => item[facet]); } return(new CustomerSearchResult(result.GetResults().Select(x => x.Document).ToList(), result.GetFacets().Categories)); } }
public Customer[] FindCustomer(Customer exampleCustomer) { CustomerSearchCriteria criteria = Translator.Translate <CustomerSearchCriteria>(exampleCustomer); FindCustomerResponse response = _customerFinderProxy.FindCustomer(criteria); return(Translator.Translate <Customer[]>(response.Customers)); }
public List <Customer> SearchingCustomer(CustomerSearchCriteria search) { List <Customer> customers = OnGetItems <Customer>(); if (search != null) { if (search.Saler.HasValue) { customers = customers.Where(pr => pr.SalerId == search.Saler.Value).ToList(); } if (search.Code != "") { customers = customers.Where(pr => pr.CustCode.ToLower().Contains(search.Code)).ToList(); } if (search.Phone != "") { customers = customers.Where(pr => pr.Phone.ToLower().Contains(search.Phone)).ToList(); } if (search.Name != "") { customers = customers.Where(pr => pr.CustomerName.ToLower().Contains(search.Name)).ToList(); } if (search.FavorProduct != "") { customers = customers.Where(pr => pr.FavoriteProduct != null && pr.FavoriteProduct.ToLower().Contains(search.FavorProduct)).ToList(); } } return(customers.OrderBy(x => x.CustomerName).ToList()); }
private static CustomerSearchCriteria PrepareSearchCriteriaWithFacets() { var criteria = new CustomerSearchCriteria(); criteria.AddFacets("purchased_car_make", "purchased_car_model", "done_business_with"); return(criteria); }
public PagedResult <CustomerDTO> GetCustomers(CustomerSearchCriteria customerSearchCriteria, PartialRetrievingInfo pageInfo) { Log.WriteWarning("GetCustomers:Username={0}", SecurityInfo.SessionData.Profile.UserName); using (var transactionScope = Session.BeginGetTransaction()) { var dbProfile = Session.Load <Profile>(SecurityInfo.SessionData.Profile.GlobalId); var queryCustomer = Session.QueryOver <Customer>().Where(x => x.Profile == dbProfile). Fetch(x => x.ConnectedAccount).Eager. Fetch(x => x.Wymiary).Eager. Fetch(x => x.Settings).Eager. Fetch(x => x.Address).Eager; if (customerSearchCriteria.Gender.HasValue) { queryCustomer = queryCustomer.Where(x => x.Gender == (Gender)customerSearchCriteria.Gender.Value); } if (customerSearchCriteria.CustomerVirtualCriteria != CustomerVirtualCriteria.All) { queryCustomer = queryCustomer.Where(x => x.IsVirtual == (customerSearchCriteria.CustomerVirtualCriteria == CustomerVirtualCriteria.VirtualOnly)); } //queryCustomer = queryCustomer.TransformUsing(Transformers.DistinctRootEntity); var listPack = queryCustomer.ToPagedResults <CustomerDTO, Customer>(pageInfo); transactionScope.Commit(); return(listPack); } }
private SqlCommand CreateFindCustomerCommand(CustomerSearchCriteria criteria, SqlConnection conn) { SqlCommand cmd = new SqlCommand("sp_FindCustomer", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LastName", GetNullOrValue(criteria.LastName)); cmd.Parameters.AddWithValue("@FirstName", GetNullOrValue(criteria.FirstName)); cmd.Parameters.AddWithValue("@MiddleInitial", GetNullOrValue(criteria.MiddleInitial)); cmd.Parameters.AddWithValue("@SSNumber", GetNullOrValue(criteria.SSNumber)); if (criteria.Addresses != null && criteria.Addresses.Length > 0) { cmd.Parameters.AddWithValue("@Address1", GetNullOrValue(criteria.Addresses[0].Address1)); cmd.Parameters.AddWithValue("@Address2", GetNullOrValue(criteria.Addresses[0].Address2)); cmd.Parameters.AddWithValue("@City", GetNullOrValue(criteria.Addresses[0].City)); cmd.Parameters.AddWithValue("@StateProvince", GetNullOrValue(criteria.Addresses[0].StateProvince)); cmd.Parameters.AddWithValue("@PostalZipCode", GetNullOrValue(criteria.Addresses[0].PostalZipCode)); } if (criteria.PhoneNumbers != null && criteria.PhoneNumbers.Length > 0) { for (int i = 0; i < 3 && i < criteria.PhoneNumbers.Length; i++) { cmd.Parameters.AddWithValue("@PhoneNumber" + (i + 1).ToString(), GetNullOrValue(criteria.PhoneNumbers[i].Number)); } } if (criteria.EmailAddresses != null && criteria.EmailAddresses.Length > 0) { cmd.Parameters.AddWithValue("@EmailAddress", GetNullOrValue(criteria.EmailAddresses[0].Address)); } return(cmd); }
public List <Customer> Get(CustomerSearchCriteria criteria) { IEnumerable <Customer> results = customers; if (!string.IsNullOrEmpty(criteria.City)) { results = results.Where(c => c.HomeAddress.City == criteria.City); } if (!string.IsNullOrEmpty(criteria.FirstName)) { results = results.Where(c => c.FirstName.StartsWith(criteria.FirstName)); } if (!string.IsNullOrEmpty(criteria.LastName)) { results = results.Where(c => c.LastName.StartsWith(criteria.LastName)); } if (criteria.IsRemoved.HasValue) { results = results.Where(c => c.IsRemoved == criteria.IsRemoved); } return(results.ToList()); }
public IHttpActionResult Get([FromUri] CustomerSearchCriteria criteria) { if (!this.User.Identity.IsAuthenticated) { return(Unauthorized()); } if (this.User.IsInRole("Administrator")) { } var claim = ((ClaimsIdentity)this.User.Identity).FindFirst(ClaimTypes.Email); if (claim != null) { string email = claim.Value; // TODO: send email Trace.WriteLine(String.Format("Sending email to {0}", email)); } ICollection <Customer> customers; if (criteria != null) { customers = customerRepository.Get(criteria); } else { customers = customerRepository.Get(); } return(Ok(customers)); }
protected override void RetrieveObjects(BodyArchitectAccessServiceClient client1, PartialRetrievingInfo pageInfo, EventHandler <GetCustomersCompletedEventArgs> operationCompleted) { var param = new CustomerSearchCriteria(); pageInfo.PageSize = -1; client1.GetCustomersAsync(ApplicationState.Current.SessionData.Token, param, pageInfo); client1.GetCustomersCompleted -= operationCompleted; client1.GetCustomersCompleted += operationCompleted; }
public void Search() { DashboardScreen dashboardScreen = new DashboardScreen(window, application); SearchCustomerScreen searchCustomerScreen = dashboardScreen.LaunchSearchCustomer(); CustomerSearchCriteria customerSearchCriteria = new CustomerSearchCriteria("Suman", ""); List <Customer> customers = searchCustomerScreen.Search(customerSearchCriteria); Assert.AreEqual(1, customers.Count); }
public void Search_ExpressingEntityInAnotherWay() { DashboardScreen dashboardScreen = new DashboardScreen(window, application); SearchCustomerScreen searchCustomerScreen = dashboardScreen.LaunchSearchCustomer(); CustomerSearchCriteria searchCriteria = new CustomerSearchCriteria().OfName("Suman").OfAge("20"); List <Customer> customers = searchCustomerScreen.Search(searchCriteria); Assert.AreEqual(1, customers.Count); }
private void IssueMovie(CustomerSearchCriteria customerSearchCriteria) { SearchCustomerScreen searchCustomerScreen = dashboard.LaunchSearchCustomer(); searchCustomerScreen.Search(customerSearchCriteria); SearchMoviesScreen searchMoviesScreen = searchCustomerScreen.LaunchSearchMovies(); searchMoviesScreen.Search(new MovieSearchCriteria("Sholay", string.Empty)); searchMoviesScreen.Select(); }
public virtual void IssueMovie(CustomerSearchCriteria customerSearchCriteria, MovieSearchCriteria movieSearchCriteria) { SearchCustomerScreen searchCustomerScreen = dashboard.LaunchSearchCustomer(); searchCustomerScreen.Search(customerSearchCriteria); SearchMoviesScreen searchMoviesScreen = searchCustomerScreen.LaunchSearchMovies(); searchMoviesScreen.Search(movieSearchCriteria); searchMoviesScreen.Select(); }
public DataSet FindCustomer(CustomerSearchCriteria criteria) { using (SqlConnection conn = CreateConnection()) { conn.Open(); SqlDataAdapter adapter = new SqlDataAdapter(CreateFindCustomerCommand(criteria, conn)); DataSet data = new DataSet(); adapter.Fill(data); return(data); } }
public IActionResult Get([FromQuery] CustomerSearchCriteria searchCriteria) { //if (!this.User.Identity.IsAuthenticated) //{ // return Unauthorized(); //} var customers = customerRepository.Get(searchCriteria); return(Ok(customers)); }
public IHttpActionResult GetCustomerBySearch([FromBody] CustomerSearchCriteria customerSearchCriteriaObj) { try { return(Ok(_customeManager.GetCustomerBySearch(customerSearchCriteriaObj))); } catch (Exception ex) { //LoggerEx.HandleException(LoggingBoundaries.DomainLayer, ex, false); return(BadRequest()); } }
//[AllowAnonymous] public IActionResult Get([FromQuery] CustomerSearchCriteria criteria) { if (!this.User.Identity.IsAuthenticated) { return(Unauthorized()); } logger.LogInformation($"Search by {criteria.FirstName} {criteria.From} {criteria.To}"); var customers = customersService.Get(criteria); return(Ok(customers)); }
private GlobalCustomer GetCustomer(string emailAddress) { CustomerSearchCriteria criteria = new CustomerSearchCriteria { Keyword = emailAddress }; var searchCustomerRequest = new CustomersSearchServiceRequest(criteria, QueryResultSettings.AllRecords); var searchCustomerResponse = this.Context.Execute <CustomersSearchServiceResponse>(searchCustomerRequest); var matchedSearchResults = searchCustomerResponse.Customers.Results.Where(c => emailAddress.Equals(c.Email, System.StringComparison.OrdinalIgnoreCase)); GlobalCustomer foundCustomer = matchedSearchResults.FirstOrDefault(); return(foundCustomer); }
public IList <Customer> Get(CustomerSearchCriteria criteria) { if (criteria.From.HasValue) { customers = customers.Where(c => c.CreateDate > criteria.From).ToList(); } if (criteria.To.HasValue) { customers.Where(c => c.CreateDate <= criteria.To); } return(customers); }
private CustomerSearchCriteria CreateSearchCriteria(IEntityTranslatorService service, Infrastructure.Interface.BusinessEntities.Customer value) { CustomerSearchCriteria result = new CustomerSearchCriteria(); result.Addresses = service.Translate <AddressSearchCriteria[]>(value.Addresses); result.EmailAddresses = service.Translate <EmailAddressSearchCriteria[]>(value.EmailAddresses); result.FirstName = value.FirstName; result.LastName = value.LastName; result.MiddleInitial = value.MiddleInitial; result.PhoneNumbers = service.Translate <PhoneNumberSearchCriteria[]>(value.PhoneNumbers); result.SSNumber = value.SocialSecurityNumber; return(result); }
private void btnSearch_Click(object sender, EventArgs e) { CustomerSearchCriteria search = new CustomerSearchCriteria { Code = string.IsNullOrEmpty(txtCode.Text) ? "" : txtCode.Text.ToLower(), Phone = string.IsNullOrEmpty(txtPhone.Text) ? "" : txtPhone.Text.ToLower(), Name = string.IsNullOrEmpty(txtName.Text) ? "" : txtName.Text.ToLower(), Saler = (cmbSaler.SelectedValue != null && (int)cmbSaler.SelectedValue > 0) ? (int?)cmbSaler.SelectedValue : (int?)null, FavorProduct = string.IsNullOrEmpty(txtFavoriteProduct.Text) ? "" : txtFavoriteProduct.Text.ToLower() }; CustomerService service = new CustomerService(); customers = service.SearchingCustomer(search); setUpDataGrid(customers); }
public virtual List <Customer> Search(CustomerSearchCriteria criteria) { NameTextBox().Text = criteria.Name; window.Get <TextBox>("ageTextBox").Text = criteria.Age; window.Get <Button>("search").Click(); TableRows rows = window.Get <Table>("foundCustomers").Rows; List <Customer> foundCustomers = new List <Customer>(); rows.ForEach(delegate(TableRow obj) { TableCells cells = obj.Cells; Customer customer = new Customer(cells["Name"].Value.ToString(), cells["Age"].Value.ToString(), cells["PhoneNumber"].Value.ToString()); foundCustomers.Add(customer); }); return(foundCustomers); }
public List <Customer> Get(CustomerSearchCriteria criteria) { var customers = context.Customers.AsQueryable(); if (!string.IsNullOrEmpty(criteria.FirstName)) { customers = customers.Where(c => c.FirstName == criteria.FirstName); } if (!string.IsNullOrEmpty(criteria.LastName)) { customers = customers.Where(c => c.LastName == criteria.LastName); } return(customers.ToList()); }
public IEnumerable <Customer> Get(CustomerSearchCriteria searchCriteria) { IQueryable <Customer> query = entites.AsQueryable(); if (searchCriteria.From.HasValue) { query = query.Where(e => e.Birthday >= searchCriteria.From.Value); } if (searchCriteria.To.HasValue) { query = query.Where(e => e.Birthday <= searchCriteria.To.Value); } return(query.ToList()); }
public ICollection <Customer> Get(CustomerSearchCriteria criteria) { IQueryable <Customer> results = ActiveCustomers; if (!string.IsNullOrEmpty(criteria.City)) { results = results.Where(c => c.City == criteria.City); } if (!string.IsNullOrEmpty(criteria.Street)) { results = results.Where(c => c.Street == criteria.Street); } return(results.ToList()); }
public IEnumerable <ICustomer> Get(CustomerSearchCriteria criteria) { var results = customers.AsQueryable(); if (!string.IsNullOrEmpty(criteria.City)) { results = results.Where(c => c.HomeAddress.City == criteria.City); } if (!string.IsNullOrEmpty(criteria.Country)) { results = results.Where(c => c.HomeAddress.Country == criteria.Country); } return(results.ToList()); }
public ActionResult Index(CustomerSearchViewModel model) { CustomerSearchCriteria criteria = PrepareSearchCriteriaWithFacets(); criteria.AddTerm("name", model.Name); criteria.AddTerm("street", model.Street); criteria.AddTermWithExactMatch("purchased_car_make", model.PurchasedCarMake); criteria.AddTermWithExactMatch("purchased_car_model", model.PurchasedCarModel); criteria.AddTermWithExactMatch("done_business_with", model.DoneBusinessWith); var result = new CustomerSearchResultRepository().Search(criteria); PrepareResults(result, model); return(View(model)); }
public void All() { CustomerSearchCriteria param = new CustomerSearchCriteria(); var profile = (ProfileDTO)profiles[0].Tag; SessionData data = CreateNewSession(profile, ClientInformation); PartialRetrievingInfo pageInfo = new PartialRetrievingInfo(); pageInfo.PageSize = 50; PagedResult <CustomerDTO> result = null; RunServiceMethod(delegate(InternalBodyArchitectService Service) { result = Service.GetCustomers(data.Token, param, pageInfo); }); Assert.AreEqual(customers.Count, result.AllItemsCount); }
public void OnNavigatedTo(NavigationContext navigationContext) { IsBusy = true; _selectedCustomerId = navigationContext.Parameters["CustomerID"]; _seqPartyId = navigationContext.Parameters["SeqPartyId"]; CustomerNoSearchCriteria = new CustomerSearchCriteria(); IsCompany = Visibility.Collapsed; //Load master data LoadBillingCycles(); //Load invoice styles LoadInvoiceStyles(); //Load invoice deliveries LoadInvoiceDeliveries(); //Load credit check scores LoadCreditCheckScores(); LoadPaymentMethods(); LoadCardTypes(); LoadCreditControlStatuses(); LoadTreatmentTypes(); LoadCompanies(); LoadCustomerTypes(); LoadAddressTypes(); LoadTaxIndicators(); LoadBillingUnits(); LoadPriorities(); LoadIndustries(); LoadParties(); GetDataforCustomerNameDropdown(); GetCustomerDetails(_seqPartyId); }
private void ClearTopSearch() { CustomerNoSearchCriteria = new CustomerSearchCriteria(); CustomerNoSearchCriteria.ClientName = string.Empty; CustomerNoSearchCriteria.Contact = string.Empty; CustomerNoSearchCriteria.CustomerNo = string.Empty; CustomerNoSearchCriteria.FName = string.Empty; CustomerNoSearchCriteria.LName = string.Empty; CustomerNoSearchCriteria.MeterNo = string.Empty; CustomerNoSearchCriteria.Phone = string.Empty; CustomerNoSearchCriteria.PropertyName = string.Empty; CustomerNoSearchCriteria.SalesCode = string.Empty; CustomerNoSearchCriteria.StreetName = string.Empty; CustomerNoSearchCriteria.StreetNo = string.Empty; CustomerNoSearchCriteria.StaffId = _user.UserId; CustomerNoSearchCriteria.Premise = string.Empty; Customers = new ObservableCollection<Customer>(); }
public void SearchCustomer(CustomerSearchCriteria criteria, EventHandler<SearchCustomersCompletedEventArgs> callback) { _proxy.SearchCustomersCompleted -= callback; _proxy.SearchCustomersCompleted += callback; _proxy.SearchCustomersAsync(criteria); }