Exemplo n.º 1
0
        public async Task <JObject> GetSearchMetadata(string searchName)
        {
            SearchObject search = await this._context.SearchObjects.
                                  Where(s => s.Name == searchName).
                                  FirstOrDefaultAsync();

            if (search == null)
            {
                throw new Exception("Could not find search");
            }

            if (!search.IsValid)
            {
                search = await new SearchCompiler(this._context).Compile(searchName);
                this._context.SearchObjects.Update(search);
                await this._context.SaveChangesAsync();
            }

            DataTable dt = evaluateSearch(search.CompiledCountQuery, -1, -1);

            int count = Int32.Parse(dt.Rows[0].ItemArray[0].ToString());

            return(JObject.FromObject(new {
                ResultSize = count,
                FieldList = search.CompiledFieldList
            }));
        }
Exemplo n.º 2
0
        public List <Series> SearchRecordsFromJson(string jsonContent)
        {
            var obj    = JObject.Parse(jsonContent);
            var search = new SearchObject
            {
                Skip         = obj.GetValueFromJObject("skip").ToObject <int>(),
                Take         = obj.GetValueFromJObject("take").ToObject <int>(),
                TotalRecords = obj.GetValueFromJObject("totalRecords").ToObject <int>()
            };
            var list = new List <iShow>();

            foreach (var show in obj["payload"])
            {
                var newShow = new Show(show);
                list.Add(newShow);
            }
            var retShows =
                from shows in
                (new SearchBusiness()).FilterShowsByDrmAndEpisodeCount(list)
                select new Series()
            {
                image = shows.Image.ShowImage,
                slug  = shows.Slug,
                title = shows.Title
            };

            return(retShows.Skip(search.Skip).Take(search.Take).ToList());
        }
Exemplo n.º 3
0
        public void CanRecordObjectWord()
        {
            string culture = "en-US";

            // Setup
            SearchObject s = new SearchObject();

            s.ObjectType = 0;
            s.ObjectId   = "1234";

            Lexicon lexicon = new Lexicon(new StaticLexicon());
            long    wordId  = lexicon.AddOrCreateWord("thi", culture);

            Assert.IsTrue(wordId > 0);

            Searcher searcher = new Searcher(lexicon, new StaticSearcher());
            long     id       = searcher.ObjectIndexAddOrUpdate(s);

            Assert.IsTrue(id > 0);

            // Test
            SearchObjectWord w = new SearchObjectWord();

            w.SearchObjectId = id;
            w.WordId         = wordId;
            w.Score          = 1;

            bool actual = searcher.ObjectWordIndexUpdate(w);

            Assert.IsTrue(actual);
        }
Exemplo n.º 4
0
        internal unsafe DirectoryVirtualListView RetrieveVLVResponse()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            // get the vlv response back
            AdsSearchColumn  column  = new AdsSearchColumn();
            AdsSearchColumn *pColumn = &column;

            SearchObject.GetColumn(Handle, _adsVLVResponseName, (INTPTR_INTPTRCAST)pColumn);
            try
            {
                AdsValue *pValue = column.pADsValues;
                DirectoryVirtualListView value = (DirectoryVirtualListView) new AdsValueHelper(*pValue).GetVlvValue();
                return(value);
            }
            finally
            {
                try
                {
                    SearchObject.FreeColumn((INTPTR_INTPTRCAST)pColumn);
                }
                catch (COMException)
                {
                }
            }
        }
        public QueryResponse <RoomQueryModel> GetAllOccuppyRoomsByNumberRoom(SearchObject search)
        {
            QueryResponse <RoomQueryModel> responseRooms = roomDAO.GetAllOccuppyRoomsByNumberRoom(search);
            List <RoomQueryModel>          temp          = responseRooms.Data;

            return(responseRooms);
        }
Exemplo n.º 6
0
 public override IEnumerable <Person> GetByExpression(SearchObject predicate)
 {
     return(Db.Person.AsNoTracking()
            .Skip(0)
            .Take(predicate.ItemQuantity)
            .ToList());
 }
Exemplo n.º 7
0
        public string SecondFormatSearch(SearchObject searchObject)
        {
            string result = string.Empty;

            foreach (KeyValuePair <string, string> prop in searchObject.SearchItems)
            {
                if (prop.Value != null)
                {
                    result += String.Format("{0}: {1}, ", prop.Key, prop.Value);
                }
            }
            foreach (KeyValuePair <object, KeyValuePair <object, object> > cond in searchObject.Conditions)
            {
                if (cond.Value.Key != null)
                {
                    result += String.Format("{0}: {1}, ", cond.Value.Key, cond.Key);
                }
            }

            result = result.Trim();

            if (searchObject.SearchItems.Count > 0 && result[result.Length - 1].Equals(','))
            {
                result = result.TrimEnd(',');
            }

            return(result.Length == 0 ? "all" : result);
        }
Exemplo n.º 8
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchObject conditions = (criteriaPanel.DataContext as SearchObject);

            conditions.Search();
            WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo;

            String where = conditions.Condition;
            String dt = "1=1";

            if (StartDate.Text.Trim().Length != 0)
            {
                dt = " DEPARTURE_TIME>='" + StartDate.Text + "'";
            }
            if (EndDate.Text.Trim().Length != 0)
            {
                if (dt.Length > 3)
                {
                    dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'";
                }
                else
                {
                    dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'";
                }
            }
            checkerList.Path  = "sql";
            checkerList.Names = "save_people,days,papers,notifications,notins,defects,leakages";
            String sql = @"SELECT t0.save_people,days,papers,notifications,notins,defects,leakages FROM(SELECT save_people,SUM (ruhu) papers,COUNT (DISTINCT dt) days,SUM (notin) notins FROM(SELECT id,save_people,SUBSTRING (departure_time, 1, 10) dt,CAST (CASE condition WHEN '正常' THEN 1 ELSE 0 END AS INTEGER) ruhu,CAST (CASE condition WHEN '无人' THEN 1 ELSE 0 END AS INTEGER) notin FROM T_INSPECTION WHERE 1 = 1 AND {0} AND {1}) b GROUP BY save_people) t0 LEFT JOIN (SELECT save_people,COUNT (id) leakages FROM(SELECT id, save_people FROM T_INSPECTION WHERE (f_qblouqi = 1 OR f_jpglouqi = 1 OR f_lglouqi = 1 OR f_cooker_leakage = 1 OR f_heater_leakage = 1 OR f_furnace_leakage = 1 OR f_bhglouqi = 1 OR f_biaoqianfa = '漏气' OR f_zaoqianfa = '漏气' OR f_zibifa = '漏气' OR f_zjxianzhuang = '漏气' OR f_rshqxianzhuang = '漏气' OR f_bglxianzhuang = '漏气') AND {0} AND {1}) a GROUP BY	save_people) t1 ON t0.save_people = t1.save_people LEFT JOIN (SELECT save_people,COUNT (id) notifications FROM(SELECT id, save_people FROM T_INSPECTION WHERE f_renow_id IS NOT NULL AND f_renow_id <> '' AND {0} AND {1}) c GROUP BY save_people) t2 ON t0.save_people = t2.save_people LEFT JOIN (SELECT save_people,COUNT (id) defects FROM(SELECT id,save_people FROM T_INSPECTION WHERE (f_sibiao = 1 OR f_changtong = 1 OR f_fanzhuang = 1 OR f_qblouqi = 1 OR f_reading_mismatch = 1 OR (f_qibiao IS NOT NULL AND f_qibiao <> '')) AND {0} AND {1}) d GROUP BY save_people) t3 ON t0.save_people = t3.save_people";

            checkerList.HQL = String.Format(sql, new String[] { where, dt });
            checkerList.Load();
        }
        private Expression <Func <Produce, bool> > GetSearchCriteria(SearchObject searchObject)
        {
            Expression <Func <Produce, bool> > mainCriteria = c => c.IsActive == true;

            if (!string.IsNullOrEmpty(searchObject.ProduceNameOrCode))
            {
                mainCriteria =
                    mainCriteria.And(
                        c =>
                        c.ProduceCode.StartsWith(searchObject.ProduceNameOrCode) || c.ProduceName.StartsWith(searchObject.ProduceNameOrCode) ||
                        c.ProduceCode.EndsWith(searchObject.ProduceNameOrCode) || c.ProduceName.EndsWith(searchObject.ProduceNameOrCode));
            }
            else
            {
                if (!string.IsNullOrEmpty(searchObject.ProduceCode))
                {
                    mainCriteria =
                        mainCriteria.And(
                            c =>
                            c.ProduceCode.StartsWith(searchObject.ProduceCode));
                }
                else
                {
                    if (!string.IsNullOrEmpty(searchObject.ProduceName))
                    {
                        mainCriteria =
                            mainCriteria.And(
                                c =>
                                c.ProduceName.StartsWith(searchObject.ProduceName));
                    }
                }
            }
            return(mainCriteria);
        }
Exemplo n.º 10
0
        public async Task <bool> DeleteSearchAsync(String linkUrl, SearchObject searchObject)
        {
            var currentSerialized = JsonConvert.SerializeObject(searchObject);
            var search            = conn.Table <Search>().Where(x => x.SerializedSearch.Equals(currentSerialized)).ToListAsync().Result.First();

            if (search == null)
            {
                Console.WriteLine("----------------------------------------------------------------------------------------------");
            }

            try
            {
                var result = await conn.DeleteAsync(search).ConfigureAwait(false);

                StatusMessage = string.Format("{0} dropped from database [Link: {1}]", result, linkUrl);
                StatusCode    = codes.ok;
                return(true);
            }
            catch (Exception ex)
            {
                StatusMessage = string.Format("Failed to delete record: {0}, Error: {1}", linkUrl, ex.Message);
                StatusCode    = codes.bad;
                return(false);
            }
        }
Exemplo n.º 11
0
        public IHttpActionResult SearchMovies(string Left, string Oper, string Right)
        {
            List <Movie> results = null;

            if ((Left == null) || (Oper == null) || (Right == null))
            {
                return(RedirectToRoute("MovieGet", new { controller = "Movie" }));
            }

            if (Oper.ToLower() == "gt")
            {
                Oper = ">";
            }
            if (Oper.ToLower() == "lt")
            {
                Oper = "<";
            }

            try {
                SearchObject so = new SearchObject(Left, Oper, Right);

                results = movieBLayer.SearchMovie(so);

                if ((results == null) || (results.Count == 0))
                {
                    NotFound();
                }
            }
            catch {
                throw;
            }

            return(Ok <List <Movie> >(results));
        }
        private Expression <Func <PurchaseInvoice, bool> > GetSearchCriteria(SearchObject searchObject)
        {
            //AK: Amending maon
            Expression <Func <PurchaseInvoice, bool> > mainCriteria = c => c.PurchaseInvoiceID.ToString() == c.PurchaseInvoiceID.ToString();

            if (!string.IsNullOrEmpty(searchObject.PurchaseInvoiceReference))
            {
                mainCriteria =
                    mainCriteria.And(c => c.PurchaseInvoiceReference.ToString().StartsWith(searchObject.PurchaseInvoiceReference));
            }
            if (!string.IsNullOrEmpty(searchObject.SupplierDepartmentId))
            {
                Guid supplierDepartmentId;
                if (!Guid.TryParse(searchObject.SupplierDepartmentId, out supplierDepartmentId))
                {
                    supplierDepartmentId = Guid.Empty;
                }
                mainCriteria =
                    mainCriteria.And(
                        c => c.SupplierDepartment.SupplierDepartmentID == supplierDepartmentId);
            }
            if (searchObject.FromDate.HasValue)
            {
                mainCriteria = mainCriteria.And(c => c.CreatedDate.Value >= searchObject.FromDate.Value);
            }
            if (searchObject.ToDate.HasValue)
            {
                mainCriteria = mainCriteria.And(c => c.CreatedDate.Value <= searchObject.ToDate.Value);
            }
            return(mainCriteria);
        }
        public string GetRedirectLink(SearchObject searchObject)
        {
            StoreSearchInformation(searchObject);

            var holidaysItem = Sitecore.Context.Database.GetItem(SearchResultsPage);
            return String.Concat(LinkManager.GetItemUrl(holidaysItem), GetPageLink(searchObject.Page));
        }
Exemplo n.º 14
0
        internal unsafe byte[] RetrieveDirectorySynchronizationCookie()
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            // get the dirsync cookie back
            AdsSearchColumn  column  = new AdsSearchColumn();
            AdsSearchColumn *pColumn = &column;

            SearchObject.GetColumn(Handle, _adsDirsynCookieName, (INTPTR_INTPTRCAST)pColumn);
            try
            {
                AdsValue *pValue = column.pADsValues;
                byte[]    value  = (byte[])new AdsValueHelper(*pValue).GetValue();

                return(value);
            }
            finally
            {
                try
                {
                    SearchObject.FreeColumn((INTPTR_INTPTRCAST)pColumn);
                }
                catch (COMException)
                {
                }
            }
        }
Exemplo n.º 15
0
        private Expression <Func <Supplier, bool> > GetSearchCriteria(SearchObject searchObject)
        {
            Expression <Func <Supplier, bool> > mainCriteria = null;

            if (searchObject.FromDate.HasValue)
            {
                mainCriteria = c => c.CreatedDate.Value >= searchObject.FromDate.Value;
            }
            else // this line should never be hit
            {
                mainCriteria = c => c.CreatedDate.Value >= DateTime.Today.AddDays(-30);
            }
            if (searchObject.ToDate.HasValue)
            {
                mainCriteria = mainCriteria.And(c => c.CreatedDate.Value <= searchObject.ToDate.Value);
            }

            if (!string.IsNullOrEmpty(searchObject.SupplierCode))
            {
                mainCriteria = mainCriteria.And(c =>
                                                c.SupplierCode == searchObject.SupplierCode);
            }
            else if (!string.IsNullOrEmpty(searchObject.SupplierCompanyName))
            {
                mainCriteria = mainCriteria.And(c =>
                                                c.SupplierCompanyName.StartsWith(searchObject.SupplierCompanyName) |
                                                c.SupplierCompanyName.StartsWith(searchObject.SupplierCompanyName));
            }
            return(mainCriteria);
        }
Exemplo n.º 16
0
        public static SearchObject createSearchObject(String sDomain = "", String sUser = "", String sPass = "", Boolean ActOnBehalf = false)
        {
            DirectoryEntry    de           = null;
            DirectorySearcher ds           = null;
            SearchObject      resultObject = new SearchObject();

            try
            {
                de = new DirectoryEntry();
                resultObject.sDC = de.Options.GetCurrentServerName();
                Console.WriteLine("\n[?] Using DC : " + de.Options.GetCurrentServerName());
                if (!String.IsNullOrEmpty(sDomain) && !String.IsNullOrEmpty(sUser) && !String.IsNullOrEmpty(sPass))
                {
                    String sUserDomain = String.Format("{0}\\{1}", sDomain, sUser);
                    de.Username = sUserDomain;
                    de.Password = sPass;
                }

                ds = new DirectorySearcher(de);
                if (ActOnBehalf)
                {
                    ds.PropertiesToLoad.Add("msDS-AllowedToActOnBehalfOfOtherIdentity");
                }
                ds.PageSize = 1000;

                resultObject.success  = true;
                resultObject.searcher = ds;
            }
            catch
            {
                resultObject.success = false;
            }

            return(resultObject);
        }
Exemplo n.º 17
0
        public ActionResult <string> Post(string orgID, string id, SearchObject searchObject)
        {
            searchObject.Id = id.Replace("\"", "");
            List <string> employees = null;

            try
            {
                Console.WriteLine(searchObject.Date);
                if (searchObject.Category.Equals("Floor"))
                {
                    int floor = int.Parse(searchObject.Input);
                    employees = searchObject.GetEmployeeByFloor(floor, orgID);
                    return(new OkObjectResult(employees));
                }
                else if (searchObject.Category.Equals("Department"))
                {
                    employees = searchObject.GetEmployeeByDeparment(searchObject.Input, orgID);
                    return(new OkObjectResult(employees));
                }
                else if (searchObject.Category.Equals("EmployeeName"))
                {
                    employees = searchObject.GetEmployeeByName(searchObject.Input, orgID);
                    return(new OkObjectResult(employees));
                }
                else
                {
                    return(new OkResult());
                }
            }
            catch (Exception e)
            {
                return(new BadRequestObjectResult("Fail to search on these values " + e.Message));
            }
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchObject conditions = (criteriaPanel.DataContext as SearchObject);

            conditions.Search();
            WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo;
            String        dt  = " 1=1";

            if (StartDate.Text.Trim().Length != 0)
            {
                dt = " DEPARTURE_TIME>='" + StartDate.Text + "'";
            }
            if (EndDate.Text.Trim().Length != 0)
            {
                if (dt.Length > 3)
                {
                    dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'";
                }
                else
                {
                    dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' ";
                }
            }
            dt = " and " + dt;
            checkerList.Path  = "sql";
            checkerList.Names = "precaution,road,unit_name,cus_dom,cus_dy,cus_floor,cus_room,user_name,telphone,departure_time,precaution_notified";
            String sql = @"SELECT CAST (CASE f_heater_trapped WHEN 1 THEN '热水器直排或烟道未排出室外' ELSE	'' END AS VARCHAR (50)) + CAST (CASE f_furnace_trapped WHEN 1 THEN '壁挂锅炉直排或烟道未排出室外' ELSE '' END AS VARCHAR (50)) + CAST (	CASE f_precaution_kitchen WHEN 1 THEN '开放式或密闭式厨房' ELSE	'' END AS VARCHAR (50)) + CAST (CASE f_precaution_multisource WHEN 1 THEN '多种火源' ELSE '' END AS VARCHAR (50)) + CAST (CASE f_precaution_otheruse WHEN '卧室' THEN '更改用途(卧室)' WHEN '客厅' THEN	'更改用途(客厅)' WHEN '浴室' THEN '更改用途(浴室)' ELSE	'' END AS VARCHAR (50)) precaution,	road,unit_name,	cus_dom,cus_dy,cus_floor,cus_room,f_consumername user_name,f_consumerphone telphone,SUBSTRING (DEPARTURE_TIME, 1, 10) departure_time,CAST (	CASE ISNULL(f_renow_id, '')	WHEN '' THEN '否' ELSE '是'	END AS VARCHAR (50)) precaution_notified FROM T_INSPECTION WHERE 1=1 and {0}";

            checkerList.HQL = String.Format(sql, new string[] { conditions.Condition + dt }).Replace("\t", " ").Replace("\n", " ").Replace("\r", " ");
            checkerList.Load();
        }
        private Expression <Func <BankAccount, bool> > GetSearchCriteria(SearchObject searchObject)
        {
            Expression <Func <BankAccount, bool> > mainCriteria = x => true; // = c;//.IsActive == true;

            if (!string.IsNullOrEmpty(searchObject.AccountName))
            {
                mainCriteria =
                    mainCriteria.And(c => c.AccountName.ToString().StartsWith(searchObject.AccountName));
            }
            if (!string.IsNullOrEmpty(searchObject.SupplierDepartmentId))
            {
                Guid supplierDepartmentId;
                if (!Guid.TryParse(searchObject.SupplierDepartmentId, out supplierDepartmentId))
                {
                    supplierDepartmentId = Guid.Empty;
                }

                mainCriteria =
                    mainCriteria.And(
                        c => c.SupplierBankAccounts.Any(a => a.SupplierDepartmentID == supplierDepartmentId));
            }
            //if (searchObject.FromDate.HasValue)
            //    mainCriteria = mainCriteria.And(c => c.CreatedDate.Value >= searchObject.FromDate.Value);
            //if (searchObject.ToDate.HasValue)
            //    mainCriteria = mainCriteria.And(c => c.CreatedDate.Value <= searchObject.ToDate.Value);
            return(mainCriteria);
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchObject conditions = (criteriaPanel.DataContext as SearchObject);

            conditions.Search();
            WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo;
            String        dt  = "1=1";

            if (StartDate.Text.Trim().Length != 0)
            {
                dt = " DEPARTURE_TIME>='" + StartDate.Text + "'";
            }
            if (EndDate.Text.Trim().Length != 0)
            {
                if (dt.Length > 3)
                {
                    dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'";
                }
                else
                {
                    dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' ";
                }
            }

            checkerList.LoadOnPathChanged = false;
            checkerList.Path  = "sql";
            checkerList.Names = "id,CONDITION,UNIT_NAME,CUS_DOM,CUS_DY,CUS_FLOOR,CUS_ROOM,USER_NAME,TELPHONE,RQB_AROUND,CONTENT,SAVE_PEOPLE,DEPARTURE_TIME,REPAIRMAN";
            String sql = @"SELECT id, CONDITION, UNIT_NAME, CUS_DOM, CUS_DY, CUS_FLOOR, CUS_ROOM, f_consumername USER_NAME, f_consumerphone TELPHONE, f_rqbiaoxing RQB_AROUND, CAST(CASE f_sibiao WHEN 1 THEN '死表' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_changtong WHEN 1 THEN '常通' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_fanzhuang WHEN 1 THEN '反装' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_qblouqi WHEN 1 THEN '漏气' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_reading_mismatch WHEN 1 THEN '气量不符' ELSE '' END AS VARCHAR (50)) + CAST(CASE f_qbqita WHEN 1 THEN f_qibiao ELSE '' END AS VARCHAR (50)) CONTENT, SAVE_PEOPLE, DEPARTURE_TIME, REPAIRMAN FROM T_INSPECTION WHERE 1=1 AND (f_sibiao = 1 OR f_changtong = 1 OR f_fanzhuang = 1 OR f_qblouqi = 1 OR f_reading_mismatch = 1 OR f_qbqita = 1) AND {0} AND {1}";

            checkerList.HQL = String.Format(sql, new String[] { conditions.Condition, dt }).Replace("\r", " ").Replace("\t", " ").Replace("\n", " ");
            checkerList.Load();
        }
Exemplo n.º 21
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchObject conditions = (criteriaPanel.DataContext as SearchObject);

            conditions.Search();
            WebClientInfo wci = App.Current.Resources["dbclient"] as WebClientInfo;
            String        dt  = "1=1";

            if (StartDate.Text.Trim().Length != 0)
            {
                dt = " DEPARTURE_TIME>='" + StartDate.Text + "'";
            }
            if (EndDate.Text.Trim().Length != 0)
            {
                if (dt.Length > 3)
                {
                    dt += " and DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59'";
                }
                else
                {
                    dt = " DEPARTURE_TIME<='" + EndDate.Text + " 23:59:59' ";
                }
            }

            checkerList.LoadOnPathChanged = false;
            checkerList.Path  = "sql";
            checkerList.Names = "id,CONDITION,UNIT_NAME,CUS_DOM,CUS_DY,CUS_FLOOR,CUS_ROOM,USER_NAME,CARD_ID,TELPHONE,SAVE_PEOPLE,DEPARTURE_TIME,ARRIVAL_TIME,RQB_AROUND,REPAIRMAN,CONTENT,sn";
            String sql = @"select t.id,t.CONDITION,t.UNIT_NAME,t.CUS_DOM,t.CUS_DY,t.CUS_FLOOR,t.CUS_ROOM,t.USER_NAME,t.CARD_ID,t.TELPHONE,t.SAVE_PEOPLE,t.DEPARTURE_TIME,t.ARRIVAL_TIME,t.RQB_AROUND,t.REPAIRMAN,tt.CONTENT from T_INSPECTION t , T_INSPECTION_LINE tt where t.id=tt.inspection_id  
 and (t.DELETED is null or t.DELETED <> '是') and tt.EQUIPMENT='燃气表' and tt.CONTENT in ('表不过气', '长通表', '死表') and {0} and {1}";

            checkerList.HQL = String.Format(sql, new String[] { conditions.Condition, dt }).Replace("\r\n", " ");
            checkerList.Load();
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;
            const int N = 200;

            int[]        arr             = new int[N];
            Random       rnd             = new Random();
            Stopwatch    time            = new Stopwatch();
            SearchObject searchCondition = MoreNumber;

            while (true)
            {
                Console.Clear();
                Console.Write("Массив: ");
                for (int i = 0; i < arr.Length; i++)
                {
                    arr[i] = rnd.Next(-10, 10);
                    Console.Write("{0,4}", arr[i]);
                }
                Console.WriteLine();
                //1
                time.Reset();
                time.Start();
                FirstMetod(arr);
                time.Stop();
                Console.WriteLine("Время метода: {0}", time.ElapsedTicks);
                //2
                time.Reset();
                time.Start();
                SecondMetod(arr, MoreNumber);
                time.Stop();
                Console.WriteLine("Время метода: {0}", time.ElapsedTicks);
                //3
                time.Reset();
                time.Start();
                ThirdMetod(arr, delegate(int a, int b) { return(a > b); });
                time.Stop();
                Console.WriteLine("Время метода: {0}", time.ElapsedTicks);
                //4
                time.Reset();
                time.Start();
                FourthMetod(arr, (int a, int b) => a > b);
                time.Stop();
                Console.WriteLine("Время метода: {0}", time.ElapsedTicks);
                //5
                time.Reset();
                time.Start();
                FifthMetod(arr);
                time.Stop();
                Console.WriteLine("Время метода: {0}", time.ElapsedTicks);
                //
                Console.WriteLine();
                Console.WriteLine("Для выхода нажмите \'Enter\'...");
                if (Console.ReadKey().Key == ConsoleKey.Enter)
                {
                    break;
                }
            }
        }
Exemplo n.º 23
0
        async void OnOptionItemSelected(object sender, OptionItemEventArgs e)
        {
            if (e.Item.TitleFormatted.ToString() == "Save")
            {
                SearchObject searchObject = new SearchObject();
                searchObject.SearchLocation = location;
                searchObject.Category       = SubCategory.Value != null ? new KeyValuePair <object, object>(SubCategory.Value, SubCategory.Key) : new KeyValuePair <object, object>(category.Key, category.Value);
                searchObject.SearchItems    = this.SearchItems;
                searchObject.Conditions     = this.Conditions;
                searchObject.MaxListings    = this.MaxListings;
                searchObject.PostedDate     = this.WeeksOld;

                string serialized = JsonConvert.SerializeObject(searchObject);
                await MainActivity.databaseConnection.AddNewSearchAsync(location.Url, serialized);

                Console.WriteLine(MainActivity.databaseConnection.StatusMessage);

                if (MainActivity.databaseConnection.StatusCode == Models.codes.ok)
                {
                    Toast.MakeText(context, "Search Saved!", ToastLength.Short).Show();
                }
                else
                {
                    var message = string.Format("Oops, something went wrong{0}Please try again...", System.Environment.NewLine);
                    Toast.MakeText(context, message, ToastLength.Short).Show();
                }
            }
        }
        private Expression <Func <vwCashTicket, bool> > GetSearchCriteria(SearchObject searchObject)
        {
            Expression <Func <vwCashTicket, bool> > mainCriteria = null;

            if (searchObject.FromDate.HasValue)
            {
                mainCriteria = c => c.CreatedDate >= searchObject.FromDate.Value;
            }
            else
            {
                // this line should never be hit
                var temp = DateTime.Today.AddDays(-1).AddHours(22);
                mainCriteria = c => c.CreatedDate >= temp;
            }

            if (searchObject.ToDate.HasValue)
            {
                mainCriteria = mainCriteria.And(c => c.CreatedDate <= searchObject.ToDate.Value);
            }

            // if paid == null then we want all paid and unpaid tickets
            if (searchObject.Paid != null)
            {
                mainCriteria = (bool)searchObject.Paid ? mainCriteria.And(c => c.BalanceOwed == 0) : mainCriteria.And(c => c.BalanceOwed != 0);
            }

            return(mainCriteria);
        }
Exemplo n.º 25
0
        private void dansearchbutton_Click(object sender, RoutedEventArgs e)
        {
            SearchObject so = daninfosearch.DataContext as SearchObject;

            if (null == so.GetPropertyValue("SecondStair"))
            {
                so.SetPropertyValue("org", so.GetPropertyValue("FirstStair"), false);
            }
            else
            {
                if (null == so.GetPropertyValue("ThirdStair"))
                {
                    so.SetPropertyValue("org", so.GetPropertyValue("FirstStair") + "." + so.GetPropertyValue("SecondStair"), false);
                }
                else
                {
                    if (null == so.GetPropertyValue("FourthStair"))
                    {
                        so.SetPropertyValue("org", so.GetPropertyValue("FirstStair") + "." + so.GetPropertyValue("SecondStair") + "." + so.GetPropertyValue("ThirdStair"), false);
                    }
                    else
                    {
                        if (null == so.GetPropertyValue("f_sgoperator"))
                        {
                            so.SetPropertyValue("org", so.GetPropertyValue("FirstStair") + "." + so.GetPropertyValue("SecondStair") + "." + so.GetPropertyValue("ThirdStair") + "." + so.GetPropertyValue("FourthStair"), false);
                        }
                    }
                }
            }
            so.Search();
        }
Exemplo n.º 26
0
        public void CanDeleteFromIndex()
        {
            SearchObject s = new SearchObject();

            s.ObjectType = 0;
            s.ObjectId   = "1234";

            Lexicon  lexicon  = new Lexicon(new StaticLexicon());
            Searcher searcher = new Searcher(lexicon, new StaticSearcher());

            long id = searcher.ObjectIndexAddOrUpdate(s);

            Assert.IsTrue(id > 0);

            SearchObject actual = searcher.ObjectIndexFind(id);

            Assert.IsNotNull(actual);
            Assert.AreEqual(id, actual.Id);
            Assert.AreEqual(s.ObjectType, actual.ObjectType);
            Assert.AreEqual(s.ObjectId, actual.ObjectId);

            bool         actual2             = searcher.ObjectIndexDelete(id);
            SearchObject existingAfterDelete = searcher.ObjectIndexFind(id);

            Assert.IsNull(existingAfterDelete);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Funzione per il reperimento dell'indice del documento di cui si sta visualizzando il dettaglio
        /// </summary>
        /// <param name="elementList">Lista dei documenti restituiti dalla ricerca</param>
        /// <returns>Indice del documento di cui si sta vedendo il dettaglio</returns>
        public static int GetIndexOfSelectedDocument(ObjScrollElementsList elementList)
        {
            // Indice da restituire
            int index = -1;

            string tipo = string.Empty;

            foreach (object obj in elementList.objList)
            {
                if (obj.GetType() == typeof(SearchObject))
                {
                    tipo = "SearchObject";
                    break;
                }
                else
                {
                    tipo = "InfoDocumento";
                    break;
                }
            }

            if (tipo.Equals("SearchObject"))
            {
                // Recupero della lista dei documenti restituiti dalla ricerca
                SearchObject[] result = (SearchObject[])elementList.objList.ToArray(typeof(SearchObject));

                // Ricerca dell'oggetto InfoDocumento con id profile uguale a quello selezionato
                SearchObject document = result.Where(e => e.SearchObjectID ==
                                                     DocumentManager.getRisultatoRicerca(null).idProfile).FirstOrDefault();

                // Se il documento è stato trovato, viene calcolato l'indice occupato
                // dal documento nell'array
                if (document != null)
                {
                    index = Array.IndexOf(result, document);
                }
            }
            else
            {
                // Recupero della lista dei documenti restituiti dalla ricerca
                InfoDocumento[] result = (InfoDocumento[])elementList.objList.ToArray(typeof(InfoDocumento));

                // Ricerca dell'oggetto InfoDocumento con id profile uguale a quello selezionato
                InfoDocumento document = result.Where(e => e.idProfile ==
                                                      DocumentManager.getRisultatoRicerca(null).idProfile).FirstOrDefault();

                // Se il documento è stato trovato, viene calcolato l'indice occupato
                // dal documento nell'array
                if (document != null)
                {
                    index = Array.IndexOf(result, document);
                }
            }



            // Restituzione dell'indice
            return(index);
        }
        public SingleResponse <Supplier> GetIDSuppliersByCompanyName(SearchObject search)
        {
            SingleResponse <Supplier> responseSuppliers = supplierDAO.GetIDSuppliersByCompanyName(search);

            //List<Supplier> temp = responseSuppliers.Data;

            return(responseSuppliers);
        }
Exemplo n.º 29
0
        private List <string> compileFieldList(SearchObject search)
        {
            List <Selection> selections = search.Selections;

            return(selections.Select(s => {
                return $"{s.ObjectFieldName}";
            }).ToList());
        }
Exemplo n.º 30
0
 void Awake()
 {
     TF     = GameObject.FindGameObjectWithTag("Player").GetComponent <ToggleFlashlight>();
     EODS   = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <EnableOrDisableScripts>();
     SO     = GameObject.FindGameObjectWithTag("Interact").GetComponent <SearchObject>();
     inv    = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
     player = GameObject.FindGameObjectWithTag("Player");
 }
Exemplo n.º 31
0
        public void ReturnsNullWhenCantFindObject()
        {
            Lexicon      lexicon  = new Lexicon(new StaticLexicon());
            Searcher     searcher = new Searcher(lexicon, new StaticSearcher());
            SearchObject actual   = searcher.ObjectIndexFind(99);

            Assert.IsNull(actual);
        }
        public void StoreSearchInformation(SearchObject searchObject)
        {
            var session = System.Web.HttpContext.Current.Session;

            // Clear existing holiday search session
            session.Remove(Keys.HolidaySearchSession);

            session.Add(Keys.HolidaySearchSession, searchObject);
        }
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            SearchLinkManager searchLinkManager = new SearchLinkManager();
            SearchObject searchObject = new SearchObject()
            {
                Text = SearchBox.Text,
            };

            Response.Redirect(searchLinkManager.GetRedirectLink(searchObject), false);
        }
Exemplo n.º 34
0
        /// <summary>
        /// 分类视图
        /// </summary>
        public ActionResult GetCategoryView(int classid = (int)CategoryClass.None, int sort = (int)CategorySort.New, int index = 0, int size = 10)
        {
            try
            {
                ViewBag.IsShow = false;
                var obj = new SearchObject();
                switch (classid)
                {
                    case (int)CategoryClass.None: ViewBag.IsShow = true; break;
                    case (int)CategoryClass.Monthly: ViewBag.IsShow = true; classid = (int)CategoryClass.None; obj.IsMonthly = true; break;
                }
                switch (sort)
                {
                    case (int)CategorySort.Free: sort = (int)CategorySort.Hot; obj.IsClientFree = true; break;
                    case (int)CategorySort.SpecialOffer: sort = (int)CategorySort.Hot; obj.IsSpecialoffer = true; break;
                    case (int)CategorySort.Finished: sort = (int)CategorySort.Hot; obj.Status = SearchBookStatus.Finished; break;
                }

                obj.Class = (SearchClass)classid;
                obj.Sort = (SearchSort)sort;
                obj.Index = index;
                obj.Size = size;

                var total = 0;
                var booksearchlist = _bookservice.Search(obj, out total);
                if (total == 0 || booksearchlist.Count == 0)
                    return new EmptyResult();
                ViewBag.total = total;
                ViewBag.size = size;
                return PartialView("_PartCategoryList", booksearchlist);
            }
            catch (Exception e)
            {
                return new EmptyResult();
            }
        }
Exemplo n.º 35
0
        //todo:分页读取及分页查询

        //查询方法
        public static async Task<List<RememberItem>> Query(SearchObject searchObject)
        {
            SQLiteAsyncConnection dbConn = await CheckOrCreateStorage();
            return await dbConn.QueryAsync<RememberItem>(
                "Select * from RememberItem where "+ searchObject.FieldName +" like '%" + searchObject.FieldValue + "%'");
        }
Exemplo n.º 36
0
        /// <summary>
        /// 出版部分视图
        /// </summary>
        /// <param name="type"></param>
        /// <param name="sort"></param>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ActionResult GetPublishView(int type = (int)RecommendClass.Fine, int sort = (int)SearchSort.VipSameDay_Desc, int index = 0, int size = 10)
        {
            try
            {
                var obj = new SearchObject();
                switch ((RecommendClass)type)
                {
                    case RecommendClass.Finished: obj.Status = SearchBookStatus.Finished; break;
                    case RecommendClass.Ancient: obj.Class = SearchClass.Aerial | SearchClass.History | SearchClass.PassThrough; break;
                    case RecommendClass.Modern: obj.Class = SearchClass.Urban | SearchClass.Youth | SearchClass.PowerfulFamily; break;
                    case RecommendClass.Occult: obj.Class = SearchClass.Ability | SearchClass.Magical | SearchClass.Occult; break;
                    case RecommendClass.Free: obj.IsClientFree = true; break;
                }

                obj.Sort = (SearchSort)sort;
                obj.Index = index;
                obj.Size = size;

                var total = 0;
                var booksearchlist = _bookservice.Search(obj, out total);
                if (total == 0 || booksearchlist.Count == 0)
                    return new EmptyResult();
                ViewBag.total = total;
                ViewBag.size = size;
                return PartialView("_PartMoreJingPinList", booksearchlist);
            }
            catch (Exception e)
            {
                return new EmptyResult();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Search_Click(object sender, EventArgs e)
        {
            // Clear existing holiday search session
            Session.Remove(Keys.HolidaySearchSession);

            SearchObject searchObject = new SearchObject()
            {
                Text = txtSearchText.Text,
                HolidayType = !String.IsNullOrEmpty(ddlHolidayType.SelectedValue) ? new Guid(ddlHolidayType.SelectedValue) : Guid.Empty,
                Terrain = !String.IsNullOrEmpty(ddlTerrain.SelectedValue) ? new Guid(ddlTerrain.SelectedValue) : Guid.Empty,
                Page = 1
            };
            var searchLinkManager = new SearchLinkManager();
            Response.Redirect(searchLinkManager.GetRedirectLink(searchObject), false);
        }