Beispiel #1
0
        public static long GetOrderCount(string search_params, string hip_name, Guid practice_id, string elastic_index_name, DateTime orders_from_date, DateTime orders_to_date)
        {
            var connection = Elastic_Utils.ElsaticConnection();
            var serializer = new JsonNetSerializer();

            var command = Commands.Count(elastic_index_name, elasticType).Pretty();

            var query = QueryBuilderOrders.BuildGetPracticeOrdersQuery(0, 0, practice_id.ToString(), search_params, !String.IsNullOrEmpty(hip_name) ? hip_name.ToLower() : null, orders_from_date, orders_to_date);

            var result = connection.Post(command, query);
            var count  = serializer.ToCountResult(result).count;

            return(count);
        }
Beispiel #2
0
        public static IEnumerable <Order_Model> GetPracticeOrders(int start_row_index, int page_size, string practice_id, string index_name, string search_params, string hip_name, DateTime orders_from_date, DateTime orders_to_date, IEnumerable <string> deslected_ids = null)
        {
            var    serializer = new JsonNetSerializer();
            var    connection = Elastic_Utils.ElsaticConnection();
            string query      = string.Empty;

            if (Elastic_Utils.IfIndexOrTypeExists(index_name, connection) && Elastic_Utils.IfIndexOrTypeExists(index_name + "/" + elasticType, connection))
            {
                query = QueryBuilderOrders.BuildGetPracticeOrdersQuery(start_row_index, page_size, practice_id, search_params, hip_name, orders_from_date, orders_to_date, deslected_ids);

                string search_command = Commands.Search(index_name, elasticType).Pretty();
                string result         = connection.Post(search_command, query);

                return(serializer.ToSearchResult <Order_Model>(result).Documents);
            }

            return(Enumerable.Empty <Order_Model>());
        }