public ActionResult QueryAllClientList() { ClientFilter filter = BuildQueryFilterEntity <ClientFilter>(); var data = ClientService.QueryAllClientList(filter); return(AjaxGridJson(data)); }
public ActionResult Detail(string code) { //WebsocketService.SendMessage(); var model = new SmokeDetailModel(); model.DetectorInfo = SmokeDetectorServices.LoadSmokeDetail(code); if (model.DetectorInfo == null || (CurrUser.CompanySysNo > 0 && CurrUser.CompanySysNo != model.DetectorInfo.CompanySysNo)) { model.HasError = true; model.ErrorMessage = "设备信息不存在"; } else { ClientFilter cFilter = new ClientFilter { SmokeDetectorCode = code, PageIndex = 0, PageSize = int.MaxValue }; if (CurrUser != null && CurrUser.CompanySysNo > 0) { cFilter.CompanySysNo = CurrUser.CompanySysNo; } model.ClientList = ClientService.QueryClientList(cFilter).data; //model.LogList = SmokeDetectorServices.QueryDeviceNoticeList(code); } return(View(model)); }
public async Task <IEnumerable <Client> > Get(ClientFilter filter) { using (var ctx = GetContext()) { var clients = await Filter(ctx, filter).ToListAsync(); return(clients.ToModel()); } }
public JsonResult GetDanhSachCustomer(ClientFilter filter = null) { var list = new List <Customer>(); var batDau = 0; var ketThuc = 0; DateTime now = new DateTime(2019, 12, 28); if (filter.orderByDirection == "ASC") { batDau = filter.activePage * filter.itemsCountPerPage - (filter.itemsCountPerPage - 1); ketThuc = filter.activePage * filter.itemsCountPerPage; for (int i = batDau; i <= ketThuc; i++) { var cus = new Customer(); cus.id = i; cus.firstName = "First Name " + (i); cus.lastName = "Last Name " + (i); cus.birthDay = string.Format("{0:MM/dd/yyyy}", now); //cus.birthDay = string.Format("{0:s}", now); //new DateTime(2019, 12, 28); //String.Format("{0:dd/MM/yyyy}", cus.birthDay); //String.Format("{0:d}", cus.birthDay); list.Add(cus); } } else { ketThuc = filter.activePage * filter.itemsCountPerPage - (filter.itemsCountPerPage - 1); batDau = filter.activePage * filter.itemsCountPerPage; for (int i = batDau; i >= ketThuc; i--) { var cus = new Customer(); cus.id = i; cus.firstName = "First Name " + (i); cus.lastName = "Last Name " + (i); cus.birthDay = string.Format("{0:MM/dd/yyyy}", now); list.Add(cus); } } var result = new XPagination <Customer>(); result.danhSach = list; result.activePage = filter.activePage; result.itemsCountPerPage = filter.itemsCountPerPage; result.totalItemsCount = 100; result.pageRangeDisplayed = 5; result.offsetFrom = batDau; result.offsetTo = ketThuc; result.orderByColumn = filter.orderByColumn; result.orderByDirection = filter.orderByDirection; return(Json(result)); }
public async Task <IActionResult> Get([FromQuery] ClientFilter filter, [FromQuery] EntityOrder order, [FromQuery] PagingParams pagination) { var list = await repository.Browse() .AplyFilter(filter) .AplyOrder(order) .ToEntityPaginated(pagination); return(Ok(list)); }
public async Task <JsonList <ClientModel> > GetUserClients(ClientFilter filter, Int32 limit = 9999) { return(HandleResponse(await RestClient.Process <JsonList <ClientModel> >( RestUtility.FormatUrl("/users/{userId}/clients", new { userId = UserId }), new { filter = filter.ToString(), limit = limit, sessionId = SessionId, countryCode = CountryCode }, null, "GET"))); }
public ActionResult Index(int?page) { ClientFilter filter = (ClientFilter)Session["clientFilter"]; ViewBag.CurrentPage = page ?? 1; if (filter != null) { return(View(filter)); } return(View(new ClientFilter())); }
public static void Output() { var filterManager = new FilterManager(new Target()); filterManager.SetFilter(new AuthenticationFilter()); filterManager.SetFilter(new DebugFilter()); var client = new ClientFilter(); client.SetFilterManager(filterManager); client.SendRequest("HOME"); }
public IEnumerable <object> Get() { ClientFilter filter = GetFilter(); var result = DB.Client.Where(c => (String.IsNullOrEmpty(filter.Name) || c.Name.Contains(filter.Name)) && (String.IsNullOrEmpty(filter.Address) || c.Address.Contains(filter.Address)) && (!filter.Married.HasValue || c.Married == filter.Married) && (!filter.Country.HasValue || c.Country == filter.Country) ); return(result.ToArray()); }
public ActionResult Home(ClientFilter filter, int page = 1) { var model = _clientService.FilterPage(filter, page); if (Request.IsAjaxRequest()) { return(PartialView("~/Views/Client/Partial/ClientList.cshtml", model)); } return(View(new ClientViewModel { Filter = filter, List = model, })); }
/// <summary> /// 分页查询Client信息 /// </summary> public static QueryResult <Client> QueryClientList(ClientFilter filter) { DataCommand cmd = new DataCommand("QueryClientList"); cmd.QuerySetCondition("d.CompanySysNo", ConditionOperation.Equal, DbType.Int32, filter.CompanySysNo); cmd.QuerySetCondition("cd.SmokeDetectorCode", ConditionOperation.Equal, DbType.AnsiString, cmd.SetSafeParameter(filter.SmokeDetectorCode)); if (!string.IsNullOrWhiteSpace(filter.Keyword)) { cmd.QuerySetCondition(string.Format(" AND (c.Name like '%{0}%' or c.Cellphone like '%{0}%' or c.Cellphone2 like '%{0}%' or c.Cellphone3 like '%{0}%')", cmd.SetSafeParameter(filter.Keyword))); } cmd.SetParameter("@Cellphone", DbType.Int32, filter.ExactCellphone); QueryResult <Client> result = cmd.Query <Client>(filter, " c.Name ASC"); return(result); }
public void Sample() { // Create query and add event handler query = new ClientQuery(null); query.QueryResponse += query_QueryResponse; query.MaxCount = 10; // Create filter and add criterion to filter by client code ClientFilter filter = new ClientFilter(); //filter.AddFilterCriteria(ClientFilter.FilterBy.OriginCountry, originCountry); // Start query to start receiving data query.Start(filter); }
public IActionResult Index(ClientFilter clientFilter) { ClientViewModel viewModel = new ClientViewModel(); var sessionSortState = HttpContext.Session.Get(Constants.ClientSort); if (sessionSortState != null && sessionSortState.Count > 0) { ClientSort.State currSortState = (ClientSort.State)Enum.Parse(typeof(ClientSort.State), sessionSortState["sortState"]); viewModel.ClientSort = new ClientSort(currSortState); } viewModel.ClientFIlter = clientFilter; SetClients(viewModel); return(View(viewModel)); }
/// <summary> /// 分页查询Client信息 /// </summary> public static QueryResult <Client> QueryAllClientList(ClientFilter filter) { DataCommand cmd = new DataCommand("QueryAllClientList"); string joinString = ""; if (!string.IsNullOrWhiteSpace(filter.SmokeDetectorCode)) { joinString = string.Format("INNER JOIN (select distinct ClientSysNo from smoke.clientsmokedetector where (SmokeDetectorCode like '%{0}%')) cd on cd.ClientSysNo = c.SysNo", cmd.SetSafeParameter(filter.SmokeDetectorCode)); } if (!string.IsNullOrWhiteSpace(filter.Keyword)) { cmd.QuerySetCondition(string.Format(" AND (c.Name like '%{0}%' or c.Cellphone like '%{0}%' or c.Cellphone2 like '%{0}%' or c.Cellphone3 like '%{0}%')", cmd.SetSafeParameter(filter.Keyword))); } cmd.CommandText = cmd.CommandText.Replace("#JOINSQL#", joinString); QueryResult <Client> result = cmd.Query <Client>(filter, " c.Name ASC"); return(result); }
public ActionResult Clients(int?page) { try { var clients = _mapper.Map <IEnumerable <ClientDTO>, IEnumerable <ClientViewModel> >(_clientService.GetClients()); ClientFilter filter = (ClientFilter)Session["clientFilter"]; if (filter != null) { clients = GetFilteredClients(clients, filter); } ViewBag.CurrentPage = page; return(PartialView(clients.ToPagedList(page ?? 1, 4))); } catch (Exception ex) { _logger.Warn(ex.Message); return(View("Error")); } }
public ActionResult ClientSearch(ClientFilter filterModel) { _logger.Info("Метод ClientSearch, ClientController, POST"); var clientModel = MapperHelper.Mapper.Map <IEnumerable <ClientDTO>, IEnumerable <ClientViewModel> >(clientService.Get()); var clients = from s in clientModel select s; if (filterModel.Name != null) { clients = clients.Where(x => x.Name.ToLower().Contains(filterModel.Name.ToLower())); } if (clients.ToList().Count <= 0) { return(HttpNotFound()); } return(PartialView("List", clients.ToPagedList(1, clients.Count() == 0 ? 1 : clients.Count()))); }
private IMongoQueryable <DbClient> Filter(RsMongoContext ctx, ClientFilter filter) { var query = ctx.Clients.AsQueryable(); if (filter.Code.NotEmpty()) { query = query.Where(x => x.Code.CaseInsensitiveEquals(filter.Code)); } if (filter.Name.NotEmpty()) { query = query.Where(x => x.Name.CaseInsensitiveEquals(filter.Name)); } if (filter.IsParent.HasValue) { query = query.Where(x => x.ParentId.NotEmpty()); } return(query); }
// operations async Task Populate() { CurrentInvoice = null; Invoices.Clear(); RefreshInvoiceCount(); var currentFilterState = ClientFilter.Trim(); IQueryable <Invoice> invoices = context.Invoices; bool haveFilter = !string.IsNullOrWhiteSpace(currentFilterState); IsUsingFilter = haveFilter; if (haveFilter) { invoices = invoices.Where( invoice => invoice.Client.Contains(currentFilterState)); } await foreach (var invoice in invoices.AsAsyncEnumerable()) { Invoices.Add(new InvoiceVM(invoice)); RefreshInvoiceCount(); } }
public override async Task <IList <Reservation> > ReadModel(IFilter filter) { var result = new List <Reservation>(); var bsons = await Read(collectionName, filter).ConfigureAwait(false); foreach (var bson in bsons) { var reservationDTO = BsonSerializer.Deserialize <Domains.DTO.Reservation>(bson); Console.WriteLine(reservationDTO.Day); var clientFilter = new ClientFilter { Id = reservationDTO.ClientId, Amount = 1 }; var clientBsons = await Read("clients", clientFilter).ConfigureAwait(false); var clientBson = clientBsons.First(); var clientDTO = BsonSerializer.Deserialize <Domains.DTO.Client>(clientBson); result.Add(new Reservation(reservationDTO, clientDTO)); } return(result); }
public IActionResult Filter(ClientFilter clientFilter) { ClientViewModel viewModel = new ClientViewModel(); var sessionSortState = HttpContext.Session.Get(Constants.ClientSort); if (sessionSortState != null && sessionSortState.Count > 0) { ClientSort.State currSortState = (ClientSort.State)Enum.Parse(typeof(ClientSort.State), sessionSortState["sortState"]); viewModel.ClientSort = new ClientSort(currSortState); } viewModel.ClientFIlter = clientFilter; int pageNumber = HttpContext.Session.Get <int>(Constants.ClientPageNumber); if (pageNumber < 1) { pageNumber = 1; } SetClients(viewModel, pageNumber); return(View("Index", viewModel)); }
public JsonList <ClientModel> GetUserClients(ClientFilter filter, Int32?limit, Int32?timeout) { return(HelperExtensions.Sync(() => this.GetUserClients(filter, limit ?? 9999), timeout)); }
private void UpdateClientFilter(ClientRequestInfo requestInfo) { const int HighPriority = 2; if (requestInfo.Request.Arguments.ContainsHelpRequest) { StringBuilder helpMessage = new StringBuilder(); helpMessage.Append("Filters status messages coming from the service."); helpMessage.AppendLine(); helpMessage.AppendLine(); helpMessage.Append(" Usage:"); helpMessage.AppendLine(); helpMessage.Append(" Filter [ { -List |"); helpMessage.AppendLine(); helpMessage.Append(" -Include <FilterDefinition> |"); helpMessage.AppendLine(); helpMessage.Append(" -Exclude <FilterDefinition> |"); helpMessage.AppendLine(); helpMessage.Append(" -Remove <ID> } ... ]"); helpMessage.AppendLine(); helpMessage.AppendLine(); helpMessage.Append(" Filter -?"); helpMessage.AppendLine(); helpMessage.AppendLine(); helpMessage.Append(" FilterDefinition ::= Type { Alarm | Warning | Information } |"); helpMessage.AppendLine(); helpMessage.Append(" Message <FilterSpec> |"); helpMessage.AppendLine(); helpMessage.Append(" Regex <FilterSpec>"); helpMessage.AppendLine(); helpMessage.AppendLine(); helpMessage.Append(" Options:"); helpMessage.AppendLine(); helpMessage.Append(" -List".PadRight(20)); helpMessage.Append("Displays a list of the client's active filters"); helpMessage.AppendLine(); helpMessage.Append(" -Include".PadRight(20)); helpMessage.Append("Defines a filter matching messages to be displayed"); helpMessage.AppendLine(); helpMessage.Append(" -Exclude".PadRight(20)); helpMessage.Append("Defines a filter matching messages to be suppressed"); helpMessage.AppendLine(); helpMessage.Append(" -Remove".PadRight(20)); helpMessage.Append("Removes a filter"); helpMessage.AppendLine(); helpMessage.Append(" -?".PadRight(20)); helpMessage.Append("Displays this help message"); helpMessage.AppendLine(); helpMessage.AppendLine(); UpdateStatus(requestInfo.Sender.ClientID, UpdateType.Information, "{0}", helpMessage.ToString()); return; } string[] args = Arguments.ToArgs(requestInfo.Request.Arguments.ToString()); ClientFilter mergeFilter = new ClientFilter(); List<int> removalIDs = new List<int>(); bool argsContainsList = !args.Any(); int i = 0; while (i < args.Length) { if (args[i].Equals("-List", StringComparison.OrdinalIgnoreCase)) { // Set the boolean flag indicating that // the client requested a list of filters argsContainsList = true; i++; } else if (args[i].Equals("-Remove", StringComparison.OrdinalIgnoreCase)) { int filterID; // Check for parsing errors with the number of arguments if (i + 1 >= args.Length) throw new FormatException("Malformed expression - Missing ID argument in 'Filter -Remove <ID>' command. Type 'Filter -?' to get help with this command."); // Check for parsing errors in the filter ID if (!int.TryParse(args[i + 1], out filterID)) throw new FormatException("Malformed expression - ID argument supplied to 'Filter -Remove <ID>' must be an integer. Type 'Filter -?' to get help with this command."); // Add the ID to the list of filter IDs to be removed from the client's filter if (i + 1 < args.Length && int.TryParse(args[i + 1], out filterID)) removalIDs.Add(filterID); i += 2; } else if (args[i].Equals("-Include", StringComparison.OrdinalIgnoreCase)) { string filterType; string filterSpec; UpdateType updateType; // Validate the number of arguments // associated with the filter if (i + 2 >= args.Length) throw new FormatException("Malformed expression - Missing arguments in 'Filter -Include <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); filterType = args[i + 1]; filterSpec = args[i + 2]; if (filterType.Equals("Message", StringComparison.OrdinalIgnoreCase)) { // Add message filters to the merge filter mergeFilter.PatternInclusionFilters.Add(Regex.Escape(filterSpec)); } else if (args[i + 1].Equals("Type", StringComparison.OrdinalIgnoreCase)) { // Add type filters to the merge filter if (!Enum.TryParse(filterSpec, true, out updateType)) throw new FormatException($"Malformed expression - Unrecognized message type '{filterSpec}' in 'Filter -Include <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); mergeFilter.TypeInclusionFilters.Add(updateType); } else if (args[i + 1].Equals("Regex", StringComparison.OrdinalIgnoreCase)) { // Add pattern filters to the merge filter mergeFilter.PatternInclusionFilters.Add(filterSpec); } else { throw new FormatException($"Malformed expression - Unrecognized filter type '{filterType}' in 'Filter -Include <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); } i += 3; } else if (args[i].Equals("-Exclude", StringComparison.OrdinalIgnoreCase)) { string filterType; string filterSpec; UpdateType updateType; // Validate the number of arguments // associated with the filter if (i + 2 >= args.Length) throw new FormatException("Malformed expression - Missing arguments in 'Filter -Exclude <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); filterType = args[i + 1]; filterSpec = args[i + 2]; if (filterType.Equals("Message", StringComparison.OrdinalIgnoreCase)) { // Add message filters to the merge filter mergeFilter.PatternExclusionFilters.Add(Regex.Escape(filterSpec)); } else if (filterType.Equals("Type", StringComparison.OrdinalIgnoreCase)) { // Add type filters to the merge filter if (!Enum.TryParse(filterSpec, true, out updateType)) throw new FormatException($"Malformed expression - Unrecognized message type '{filterSpec}' in 'Filter -Exclude <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); mergeFilter.TypeExclusionFilters.Add(updateType); } else if (filterType.Equals("Regex", StringComparison.OrdinalIgnoreCase)) { // Add pattern filters to the merge filter mergeFilter.PatternExclusionFilters.Add(filterSpec); } else { throw new FormatException($"Malformed expression - Unrecognized filter type '{filterType}' in 'Filter -Exclude <FilterDefinition>' command. Type 'Filter -?' to get help with this command."); } i += 3; } else { throw new FormatException($"Malformed expression - Unrecognized argument '{args[i]}'. Type 'Filter -?' to get help with this command."); } } // Determine whether the filter was actually updated bool filterUpdated = mergeFilter.TypeInclusionFilters.Any() || mergeFilter.TypeExclusionFilters.Any() || mergeFilter.PatternInclusionFilters.Any() || mergeFilter.PatternExclusionFilters.Any() || removalIDs.Any(); if (!filterUpdated && !argsContainsList) return; // Use the status update thread to get the // client's config, then update the filters m_statusUpdateThread.Push(HighPriority, () => { ClientStatusUpdateConfiguration clientConfig = m_clientStatusUpdateLookup.GetOrAdd(requestInfo.Sender.ClientID, id => new ClientStatusUpdateConfiguration(id, this)); if (filterUpdated) clientConfig.UpdateFilters(mergeFilter, removalIDs); if (argsContainsList) clientConfig.ListFilters(requestInfo); }); }
public void UpdateFilters(ClientFilter mergeFilter, List<int> removalIDs) { m_thread.Push(HighPriority, () => { foreach (int filterID in removalIDs.OrderByDescending(id => id)) RemoveFilter(filterID); m_filter.TypeInclusionFilters.AddRange(mergeFilter.TypeInclusionFilters); m_filter.TypeExclusionFilters.AddRange(mergeFilter.TypeExclusionFilters); m_filter.PatternInclusionFilters.AddRange(mergeFilter.PatternInclusionFilters); m_filter.PatternExclusionFilters.AddRange(mergeFilter.PatternExclusionFilters); }); }
public ClientStatusUpdateConfiguration(Guid clientID, ServiceHelper serviceHelper) { m_clientID = clientID; m_filter = new ClientFilter(); m_thread = serviceHelper.m_threadScheduler.CreateThread(2); m_messageCounts = new List<Tuple<DateTime, int>>(); m_serviceHelper = serviceHelper; }
public ActionResult ApplyFilter(ClientFilter model) { Session["clientFilter"] = model; return(RedirectToAction("Clients")); }
public ClientListViewDTO GetClientListByFilter([FromBody] ClientFilter filter) { return(_logic.GetClientListView(filter)); }
private IEnumerable <ClientViewModel> GetFilteredClients(IEnumerable <ClientViewModel> clients, ClientFilter filter) { var expression = filter.ToExpression(); var predicate = expression.Compile(); if (filter.Name != null) { clients = clients.Where(x => predicate(x.Name, filter.Name)); } if (filter.PhoneNumber != null) { clients = clients.Where(x => predicate(x.PhoneNumber, filter.PhoneNumber)); } return(clients); }
public static QueryResult <Client> QueryAllClientList(ClientFilter filter) { return(ClientDA.QueryAllClientList(filter)); }
public async Task <Message <PagedList <ClientDomain> > > List(ClientFilter filter) { var clients = await DatabaseContext.Clients.ToMappedPagedListAsync <Client, ClientDomain, ClientFilter>(filter); return(new Message <PagedList <ClientDomain> >(clients)); }
public async Task <IEnumerable <Client> > Get(ClientFilter filter) { throw new NotImplementedException(); }
public void FilterValues() { if (DataSource == null) { return; } IList <T> readonlyDataSourceContext; if (DataSource is IModelMultiContainer <T> ) { readonlyDataSourceContext = ((IModelMultiContainer <T>)DataSource).Values; } else if (DataSource is IModelSingleContainer <T> ) { readonlyDataSourceContext = new List <T>(1); T value = ((IModelSingleContainer <T>)DataSource).Value; if (value != null) { readonlyDataSourceContext.Add(value); } } else { throw new NotSupportedException(typeof(IModelContainer).Name + " of type '" + DataSource.GetType() + "' not supported"); } SetBusy(); if (GuiThreadHelper.IsInGuiThread()) { // Create a 'safe copy' of the datasource from within gui thread IList <T> clonedDataSourceContext = new List <T>(readonlyDataSourceContext); ThreadPool.Queue(delegate() { try { IList <T> values = ClientFilter.Filter(clonedDataSourceContext); // This will not set the Values-IList<T> Pointer but will clear and reinit its content // This assumption is important because our unmodifiableValues-Property depends on it SyncContext.Send((object state) => { base.Values = values; }, null); } finally { SetUnbusy(); } }); } else { try { IList <T> clonedDataSourceContext = null; SyncContext.Send((object state) => { // Create a 'safe copy' of the datasource from within gui thread clonedDataSourceContext = new List <T>(readonlyDataSourceContext); }, null); IList <T> values = ClientFilter.Filter(clonedDataSourceContext); // This will not set the Values-IList<T> Pointer but will clear and reinit its content // This assumption is important because our unmodifiableValues-Property depends on it SyncContext.Send((object state) => { base.Values = values; }, null); } finally { SetUnbusy(); } } }
public CrayonApiClientResult <ApiCollection <Client> > Get(string token, ClientFilter filter = null) { var uri = "/api/v1/clients/".Append(filter); return(_client.Get <ApiCollection <Client> >(token, uri)); }
public JsonList<ClientModel> GetUserClients(ClientFilter filter, Int32? limit, Int32? timeout) { return HelperExtensions.Sync(() => this.GetUserClients(filter, limit ?? 9999), timeout); }