Example #1
0
        public IHttpActionResult DummyTableForFileSelectBySingleFile(SearchParam param)
        {
            param = param ?? new SearchParam();
            var returnVal = _dummyFileUploadService.DummyTableForFileSelectBySingleFile(param);

            return(Ok(returnVal.SuccessResponse()));
        }
        public ActionResult Search(SearchParam param)
        {
            var list = dc.Set <V_Resource>().Where(a => a.ResourceKindID == 4 && ParkList.Contains(a.Loc1));

            if (!string.IsNullOrEmpty(param.Park))
            {
                list = list.Where(a => a.Loc1 == param.Park);
            }
            if (!string.IsNullOrEmpty(param.ID))
            {
                list = list.Where(a => a.ID.Contains(param.ID));
            }
            if (!string.IsNullOrEmpty(param.Name))
            {
                list = list.Where(a => a.Name.Contains(param.Name));
            }
            if (!string.IsNullOrEmpty(param.Cust))
            {
                list = list.Where(a => a.CustLongName.Contains(param.Cust));
            }
            if (!string.IsNullOrEmpty(param.Group))
            {
                list = list.Where(a => a.GroupName.Contains(param.Group));
            }
            int count = list.Count();

            list = list.OrderBy(a => a.ID).Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize);
            return(Json(new { count = count, data = list.ToList() }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public async Task <ICollection <News> > Search(string item, SearchParam param)
        {
            try
            {
                string itemLower = item.ToLower();
                if (param == SearchParam.all)
                {
                    var news = await _context.News
                               .Where(x =>
                                      x.title.ToLower().Contains(itemLower) ||
                                      x.content.ToLower().Contains(itemLower) ||
                                      x.created_at.ToString().Contains(itemLower) ||
                                      x.expired_at.ToString().Contains(itemLower)
                                      ).ToListAsync();

                    return(news);
                }
                else if (param == SearchParam.title)
                {
                    var news = await _context.News
                               .Where(x =>
                                      x.title.ToLower().Contains(itemLower)
                                      ).ToListAsync();

                    return(news);
                }
                else if (param == SearchParam.content)
                {
                    var news = await _context.News
                               .Where(x =>
                                      x.content.ToLower().Contains(itemLower)
                                      ).ToListAsync();

                    return(news);
                }
                else if (param == SearchParam.created_at)
                {
                    var news = await _context.News
                               .Where(x =>
                                      x.created_at.ToString().Contains(itemLower)
                                      ).ToListAsync();

                    return(news);
                }
                else if (param == SearchParam.expired_at)
                {
                    var news = await _context.News
                               .Where(x =>
                                      x.expired_at.ToString().Contains(itemLower)
                                      ).ToListAsync();

                    return(news);
                }
                throw new Exception();
            }
            catch (System.Exception)
            {
                throw new Exception("Search Failed.");
            }
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="param"></param>
        /// <param name="paramList"></param>
        /// <returns></returns>
        private static string BuilderWhere(List <SearchParam> param, List <SqlParameter> paramList)
        {
            StringBuilder builder = new StringBuilder(" 1 = 1");

            if ((param != null) && (param.Count > 0))
            {
                for (int i = 0; i < param.Count; i++)
                {
                    SqlParameter parameter;
                    SearchParam  iparam = param[i];
                    switch (iparam.ParamKey.Trim().ToLower())
                    {
                    case "msg_to":
                        builder.Append(" AND [msg_to] = @msg_to");
                        parameter       = new SqlParameter("@msg_to", SqlDbType.Int);
                        parameter.Value = (int)iparam.ParamValue;
                        paramList.Add(parameter);
                        break;

                    case "msg_from":
                        builder.Append(" AND [msg_from] = @msg_from");
                        parameter       = new SqlParameter("@msg_from", SqlDbType.Int);
                        parameter.Value = (int)iparam.ParamValue;
                        paramList.Add(parameter);
                        break;
                    }
                }
            }
            return(builder.ToString());
        }
        public JsonResult Search(SearchParam param)
        {
            var list = from a in dc.Set <T_Region>()
                       join b in dc.Set <T_City>() on a.CityID equals b.ID into t1
                       from city in t1.DefaultIfEmpty()
                       select new
            {
                a.ID,
                a.CityID,
                a.Name,
                a.Enable,
                CityName = city.Name
            };

            if (!string.IsNullOrEmpty(param.City))
            {
                list = list.Where(a => a.CityID == param.City);
            }
            if (!string.IsNullOrEmpty(param.ID))
            {
                list = list.Where(a => a.ID.Contains(param.ID));
            }
            if (!string.IsNullOrEmpty(param.Name))
            {
                list = list.Where(a => a.Name.Contains(param.Name));
            }
            if (param.Enable != null)
            {
                list = list.Where(a => a.Enable == param.Enable);
            }
            int count = list.Count();

            list = list.OrderBy(a => a.ID).Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize);
            return(Json(new { count = count, data = list.ToList() }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public static Toy FindToy(IJsfTree tree, SearchParam param, double paramValue)
        {
            foreach (var toy in tree)
            {
                if (param == SearchParam.PRICE)
                {
                    if (paramValue == toy.GetPrice())
                    {
                        return(toy);
                    }
                }
                else if (param == SearchParam.SIZE)
                {
                    if (paramValue == toy.GetSize())
                    {
                        return(toy);
                    }
                }
                else
                {
                    if (paramValue == toy.GetWeight())
                    {
                        return(toy);
                    }
                }
            }

            return(null);
        }
Example #7
0
 private bool SearchQuery(Manga m, SearchParam param)
 {
     return((param.Price == 0 || param.Price == m.Price) &&
            (param.Year == 0 || param.Year == m.Year) &&
            (string.IsNullOrEmpty(param.Title) || param.Title == m.Title) &&
            (string.IsNullOrEmpty(param.Genre) || param.Genre == m.Genre));
 }
        public static List <SkinnyItem> GetItems(string indexName,
                                                 string language,
                                                 string templateFilter,
                                                 string locationFilter,
                                                 string fullTextQuery,
                                                 bool performSort     = false,
                                                 string sortFieldName = "",
                                                 bool reverse         = false)
        {
            var searchParam = new SearchParam
            {
                Database      = "web",
                Language      = language,
                TemplateIds   = templateFilter,
                LocationIds   = locationFilter,
                FullTextQuery = fullTextQuery
            };

            using (var runner = new QueryRunner(indexName))
            {
                if (performSort)
                {
                    return(runner.GetItems(searchParam, sortField: sortFieldName, reverse: reverse));
                }
                else
                {
                    return(runner.GetItems(searchParam));
                }
            }
        }
        public RedirectToRouteResult RedirectPage(int userid)
        {
            UserDetail userdetail = new UserDetail();

            userdetail = dbmeals.UserDetails.Where(x => x.UserId.Equals(userid)).FirstOrDefault();
            if (userdetail != null)
            {
                {
                    //   searchparam.UserLoc.Latitude = Convert.ToDouble(userdetail.AddressList.Latitude);
                    //  searchparam.UserLoc.Longitude = Convert.ToDouble(userdetail.AddressList.Longitude);
                    //  searchparam.UserID = userdetail.UserId;
                    Session["UserLoc"]     = Common.GetFullAddress(userdetail.AddressList);
                    Session["UserLocLat"]  = Convert.ToDouble(userdetail.AddressList.Latitude);
                    Session["UserLocLong"] = Convert.ToDouble(userdetail.AddressList.Longitude);


                    if (Session["UserLocLat"] == null)
                    {
                        return(RedirectToAction("LocationToSearch", "Home", null));
                    }

                    else
                    {
                        SearchParam searchparam = new SearchParam();
                        return(RedirectToAction("Index", "Home", new RouteValueDictionary(searchparam)));
                    }
                }
            }
            else
            {
                return(RedirectToAction("Create", "User", new { userID = userid }));
            }
        }
Example #10
0
        public IHttpActionResult HolidaysSelect([FromUri] SearchParam param)
        {
            param = param ?? new SearchParam();
            var holidaysList = _publicHolidayService.PublicHolidaysSelect(param).Select(x => x.ToViewModel());

            return(Ok(holidaysList.SuccessResponse()));
        }
Example #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cnn = new SqlConnection(connectionString);
     this.InitSeatLayoutData();
     this.GetAllEmpNameData();
     SearchParam.Focus();
 }
        public DummyTableForFileModel DummyTableForFileSelectById(SearchParam param)
        {
            var DummyTableForFile = _dummyFileUploadDBService.DummyTableForFileSelect(param).FirstOrDefault();

            DummyTableForFile.FileGroupItem = _xmlService.GetFileGroupItemsByXml(DummyTableForFile.FileGroupItemsXml).FirstOrDefault();
            return(DummyTableForFile);
        }
        public ContentResult Search3(SearchParam param)
        {
            string BeginTime = DateTime.Now.ToString("yyyy-MM-dd");
            string EndTime   = DateTime.Now.ToString("yyyy-MM-dd");
            string PackNo    = "01";

            if (param.Stime != null)
            {
                BeginTime = Convert.ToDateTime(param.Stime).ToString("yyyy-MM-dd");
            }
            if (param.Etime != null)
            {
                EndTime = Convert.ToDateTime(param.Etime).ToString("yyyy-MM-dd");
            }
            if (param.Park != null)
            {
                PackNo = param.Park;
            }

            butlerservice.AppService service1 = new butlerservice.AppService();
            service1.Url = "http://wx.dorlly.com/api/AppService.asmx";
            DataTable dt = service1.GetStatisticsList_Resourse_List(PackNo, BeginTime, EndTime, "5218E3ED752A49D4");

            return(Content(JsonConvert.SerializeObject(new { data = dt })));
        }
        public ActionResult Index()
        {
            // commit ngày 18/06/2019

            var searchParm = new SearchParam().BindData(DATA);

            searchParm.Parent = Utils.GetInt(DATA, "ID");
            var categories      = CategoryRepository.Search(searchParm, Paging);
            var categoryType    = CategoryTypeRepository.UseInstance.GetByIdOrDefault(searchParm.Type);
            var categoryParent  = CategoryRepository.UseInstance.GetByIdOrDefault(searchParm.Parent);
            var idAncestors     = Utils.GetLongParents(categoryParent.Parents, categoryParent.ID);
            var categoryParents = CategoryRepository.UseInstance.GetByIdsOrDefault(idAncestors.ToArray());

            SetTitle("Danh sách danh mục");
            return(GetCustResultOrView(new ViewParam
            {
                Data = new AdminModel
                {
                    Category = new Category {
                        IDCategoryType = categoryType.ID, Parent = searchParm.Parent
                    },
                    Categories = categories,
                    CategoryType = categoryType,
                    Ancestors = categoryParents,
                    Parent = categoryParent,
                    SearchParam = searchParm,
                },
                ViewName = "Index",
                ViewNameAjax = "Categories"
            }));
        }
Example #15
0
        public IList <Flight> GetFlightsBySearch(SearchParam search)
        {
            IList <Flight> searchlist = new List <Flight>();

            if (search != null)
            {
                if (!string.IsNullOrEmpty(search.AirlineName))
                {
                    return(_flightDAO.GetAllFlightByAirlineName(search.AirlineName, search.FlightType));
                }
                if (!string.IsNullOrEmpty(search.DesCountry))
                {
                    return(_flightDAO.GetAllFlightByDestinationCountry(search.DesCountry, search.FlightType));
                }
                if (!string.IsNullOrEmpty(search.OriCountry))
                {
                    return(_flightDAO.GetAllFlightByOriginCountry(search.OriCountry, search.FlightType));
                }
                if (!string.IsNullOrEmpty(search.ID))
                {
                    return(_flightDAO.GetAllFlightById(search.ID, search.FlightType));
                }
            }

            return(searchlist);
        }
Example #16
0
        public ExeResEdm GetListByPage(string tableName, PageSerach <T> para)
        {
            var orderByStr = LambdaToSqlHelper <T> .GetSqlFromLambda(para.OrderBy).OrderbySql;

            string whereSql = !string.IsNullOrEmpty(para.StrWhere) ? para.StrWhere : LambdaToSqlHelper <T> .GetWhereFromLambda(para.Filter, DataBaseType.NoSelect);

            SearchParam searchParam = new SearchParam()
            {
                Orderby = orderByStr, PageIndex = para.PageIndex, PageSize = para.PageSize, TableName = tableName, StrWhere = whereSql,
            };
            ExeResEdm res = GetDTByPage(searchParam);

            para.StrWhere = whereSql;
            if (res.ErrCode == 0)
            {
                List <T> list = DtModelConvert <T> .DatatableToList((res.ExeModel as DataTable));

                res.ExeModel = list.AsQueryable();
                return(res);
            }
            else
            {
                return(res);
            }
        }
Example #17
0
        public DailyReportDTO GetDailyReport(DateTime date)
        {
            _date = date;
            DailyReportDTO dR = new DailyReportDTO();

            dR.Date = date;

            SearchParam p = new SearchParam();

            p.SearchWithDate = true;
            p.From           = date;
            p.To             = date.AddDays(1);

            List <Item> items = _itemService.AllActiveItems();

            _histories         = _historyService.SearchHistories(p);
            _previousHistories = _historyService.GetItemsHistoryFromOtherPreviousDays(_date);
            _nextHistories     = _historyService.GetItemsHistoryAfterThisDate(_date);

            foreach (var i in items)
            {
                DailyItem d = CreateRow(i);
                _perDays.Add(d);
            }

            dR.Records = _perDays;

            return(dR);
        }
Example #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="param"></param>
        /// <param name="paramList"></param>
        /// <returns></returns>
        private static string BuilderWhere(List <SearchParam> param, List <SqlParameter> paramList)
        {
            StringBuilder builder = new StringBuilder(" 1 = 1");

            if ((param != null) && (param.Count > 0))
            {
                for (int i = 0; i < param.Count; i++)
                {
                    SqlParameter parameter;
                    SearchParam  iparam = param[i];
                    switch (iparam.ParamKey.Trim().ToLower())
                    {
                    case "newstype":
                        builder.Append(" AND [newstype] = @newstype");
                        parameter       = new SqlParameter("@newstype", SqlDbType.Int);
                        parameter.Value = (int)iparam.ParamValue;
                        paramList.Add(parameter);
                        break;

                    case "newstitle":
                        builder.Append(" AND [newstitle] like @newstitle");
                        parameter       = new SqlParameter("@newstitle", SqlDbType.VarChar, 100);
                        parameter.Value = "%" + SqlHelper.CleanString((string)iparam.ParamValue, 100) + "%";
                        paramList.Add(parameter);
                        break;
                    }
                }
            }
            return(builder.ToString());
        }
Example #19
0
 public List <LeaveModel> LeaveSelect(SearchParam param)
 {
     using (var dbctx = DbContext)
     {
         return(dbctx.LeaveSelect(param.Id, param.UserId, param.AppointmentDate, param.Next, param.Offset).Select(x => new LeaveModel
         {
             Id = x.Id,
             CreatedBy = x.CreatedBy,
             UpdatedBy = x.UpdatedBy,
             CreatedOn = x.CreatedOn,
             UpdatedOn = x.UpdatedOn,
             IsDeleted = x.IsDeleted,
             IsActive = x.IsActive,
             StartDate = x.StartDate,
             EndDate = x.EndDate,
             StartTime = x.StartTime,
             EndTime = x.EndTime,
             Type = x.Type,
             Description = x.Description,
             UserId = x.UserId,
             TotalCount = x.overall_count.GetValueOrDefault(),
             FullName = x.FirstName + " " + x.LastName
         }).ToList());
     }
 }
        public JsonResult Search(SearchParam param)
        {
            var list = dc.Set <V_Stage>().Where(a => ParkList.Contains(a.ParkID));

            if (!string.IsNullOrEmpty(param.Park))
            {
                list = list.Where(a => a.ParkID == param.Park);
            }
            if (!string.IsNullOrEmpty(param.ID))
            {
                list = list.Where(a => a.ID.Contains(param.ID));
            }
            if (!string.IsNullOrEmpty(param.Name))
            {
                list = list.Where(a => a.Name.Contains(param.Name));
            }
            if (param.Enable != null)
            {
                list = list.Where(a => a.Enable == param.Enable);
            }
            int count = list.Count();

            list = list.OrderBy(a => a.ID).Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize);
            return(Json(new { count = count, data = list.ToList() }, JsonRequestBehavior.AllowGet));
        }
Example #21
0
 public List <DummyTableForFileModel> DummyTableForFileSelect(SearchParam param)
 {
     using (var dbctx = DbContext)
     {
         return(dbctx.DummyTableForFileSelect(param.Id, param.Type, param.Next, param.Offset).Select(x => new DummyTableForFileModel
         {
             Id = x.Id,
             Name = x.Name,
             IsActive = x.IsActive,
             CreatedUser = new Domain.CreatedUserModel
             {
                 UserId = x.CreatedBy,
                 FirstName = x.CreatedByFirstName,
                 LastName = x.CreatedByLastName,
                 PhoneNumber = x.CreatedByPhoneNumber
             },
             UpdatedUser = new Domain.UpdatedUserModel
             {
                 UserId = x.UpdatedBy,
                 FirstName = x.UpdatedByFirstName,
                 LastName = x.UpdatedByLastName,
                 PhoneNumber = x.UpdatedByPhoneNumber
             },
             FileGroupItemsXml = x.FileGroupItemsXml
         }).ToList());
     }
 }
Example #22
0
 //copy SearchParam
 void Copy_Inter.SearchParamCopy(SearchParam ssp, SearchParam dsp)
 {
     dsp.Db_index          = ssp.Db_index;
     dsp.Db.Db_name        = string.Copy(ssp.Db.Db_name);
     dsp.Db.Db_path        = string.Copy(ssp.Db.Db_path);
     dsp.Enzyme_index      = ssp.Enzyme_index;
     dsp.Enzyme            = string.Copy(ssp.Enzyme);
     dsp.Enzyme_Spec       = string.Copy(ssp.Enzyme_Spec);
     dsp.Enzyme_Spec_index = ssp.Enzyme_Spec_index;
     dsp.Cleavages         = ssp.Cleavages;
     dsp.Ptl.Tl_value      = ssp.Ptl.Tl_value;
     dsp.Ptl.Isppm         = ssp.Ptl.Isppm;
     dsp.Ftl.Tl_value      = ssp.Ftl.Tl_value;
     dsp.Ftl.Isppm         = ssp.Ftl.Isppm;
     dsp.Open_search       = ssp.Open_search;
     dsp.Fix_mods.Clear();
     for (int i = 0; i < ssp.Fix_mods.Count; i++)
     {
         dsp.Fix_mods.Add(ssp.Fix_mods[i]);
     }
     dsp.Var_mods.Clear();
     for (int i = 0; i < ssp.Var_mods.Count; i++)
     {
         dsp.Var_mods.Add(ssp.Var_mods[i]);
     }
     Factory.Create_Copy_Instance().SearchAdvancedCopy(ssp.Search_advanced, dsp.Search_advanced);
 }
Example #23
0
        public ExeResEdm GetListByPage(string tableName, PageSerach <T> para, DBOperUser dbLogMsg = null)
        {
            var orderByStr = LambdaToSqlHelper <T> .GetSqlFromLambda(para.OrderBy).OrderbySql;

            string whereSql = !string.IsNullOrEmpty(para.StrWhere) ? para.StrWhere : LambdaToSqlHelper <T> .GetWhereFromLambda(para.Filter, DBStoreType.NoSelect);

            SearchParam searchParam = new SearchParam()
            {
                Orderby = orderByStr, PageIndex = para.PageIndex, PageSize = para.PageSize, TableName = tableName, StrWhere = whereSql,
            };
            ExeResEdm res    = GetDTByPage(searchParam);
            int       curNum = 0;

            if (res.ErrCode == 0)
            {
                List <T> list = DtModelConvert <T> .DatatableToList((res.ExeModel as DataTable));

                res.ExeModel = list.AsQueryable();
                curNum       = list.Count();
                res.ExeNum   = searchParam.TotalCount;
            }
            WriteLogMsg(dbLogMsg, LogType.查询, "根据[" + DtModelConvert <T> .SerializeToString(searchParam) + "]获取了分页数据,返回了"
                        + curNum + "/" + searchParam.TotalCount + "条记录", tableName);
            return(res);
        }
Example #24
0
        public string GetList(SearchParam searchParam)
        {
            DataSet ds = _masterGroupRepository.GetIdentityGroupList(searchParam);
            var     identityGroupJson = ds.Tables[0].ToJsonString();

            return(identityGroupJson);
        }
        public IHttpActionResult GetAllLeaves([FromUri] SearchParam param)
        {
            param = param ?? new SearchParam();
            var leaves = _leaveService.LeaveSelect(param).Select(x => x.ToViewModel());;

            return(Ok(leaves.SuccessResponse()));
        }
        public ActionResult LocationToSearch(string address)
        {
            if (!string.IsNullOrEmpty(address))
            {
                GLatLong loc = new GLatLong();
                //    loc = GeoCodingHelper.GetLatLong(address);//uncomment this

                loc.Latitude  = 41.330215;  //comment this
                loc.Longitude = -73.859004; //comment this

                Session["UserLocLat"]  = loc.Latitude;
                Session["UserLocLong"] = loc.Longitude;
                Session["UserLoc"]     = address;



                LocationsSearched ls = new LocationsSearched();
                ls.Location    = address;
                ls.Latitude    = Convert.ToDecimal(loc.Latitude);
                ls.Longitude   = Convert.ToDecimal(loc.Longitude);
                ls.DateCreated = DateTime.Now;
                ls.UserID      = WebSecurity.CurrentUserId;
                dbmeals.LocationsSearcheds.Add(ls);
                dbmeals.SaveChanges();


                SearchParam searchparam = new SearchParam();
                return(RedirectToAction("Index", "Home", new RouteValueDictionary(searchparam)));
            }

            return(View());
        }
        public string GetList(SearchParam searchParam)
        {
            DataSet ds = _masterDepartmentRepository.GetMasterDepartmentList(searchParam);
            var     masterDepartmentJson = ds.Tables[0].ToJsonString();

            return(masterDepartmentJson);
        }
Example #28
0
        public ContentResult Search(SearchParam param)
        {
            string BeginTime = DateTime.Now.ToString("yyyy-MM-dd");
            string EndTime   = DateTime.Now.ToString("yyyy-MM-dd");
            string PackNo    = "01";

            if (param.Stime != null)
            {
                BeginTime = Convert.ToDateTime(param.Stime).ToString("yyyy-MM-dd");
            }
            if (param.Etime != null)
            {
                EndTime = Convert.ToDateTime(param.Etime).ToString("yyyy-MM-dd");
            }
            if (param.Park != null)
            {
                PackNo = param.Park;
            }
            DataTable dt = null;

            if (PackNo == "01")
            {
                doservice.Service service = new doservice.Service();
                service.Url = "http://120.76.154.6/Order/api/Service.asmx";
                dt          = service.GetStatisticsList_Resourse("2", BeginTime, EndTime, "6E5F0C851FD4");
            }

            return(Content(JsonConvert.SerializeObject(new { data = dt })));
        }
Example #29
0
        private static string BuilderWhere(List <SearchParam> param, List <SqlParameter> paramList)
        {
            var builder = new StringBuilder(" 1 = 1");

            if ((param != null) && (param.Count > 0))
            {
                for (int i = 0; i < param.Count; i++)
                {
                    SqlParameter parameter;
                    SearchParam  iparam = param[i];
                    switch (iparam.ParamKey.Trim().ToLower())
                    {
                    case "id":
                        builder.Append(" AND [id] = @id");
                        parameter       = new SqlParameter("@id", SqlDbType.Int);
                        parameter.Value = (int)iparam.ParamValue;
                        paramList.Add(parameter);
                        break;

                    case "typeid":
                        builder.Append(" AND [typeId] = @typeId");
                        parameter       = new SqlParameter("@typeId", SqlDbType.Int, 4);
                        parameter.Value = (int)iparam.ParamValue;
                        paramList.Add(parameter);
                        break;

                    case "cardtype":
                        builder.Append(" AND [typeId] > 102 ");
                        break;
                    }
                }
            }
            return(builder.ToString());
        }
        protected virtual List <SitecoreItem> Simple()
        {
            var searchParam = new SearchParam
            {
                FullTextQuery = TextBox1.Text
            };

            //var dateRange = new DateRangeSearchParam
            //{
            //    Language = Lang,
            //    TemplateIds = GetTemplates(FullTextQuery),
            //    LocationIds = LocationFilter,
            //    FullTextQuery = GetText(FullTextQuery),
            //    ShowAllVersions = false,
            //    Ranges = new List<DateRangeSearchParam.DateRangeField>()
            //                                     {
            //                                         new DateRangeSearchParam.DateRangeField("__Created",
            //                                                                                 Convert.ToDateTime(GetStartDate(FullTextQuery)),
            //                                                                                 Convert.ToDateTime(GetEndDate(FullTextQuery)))
            //                                     }


            //};

            using (var searcher = new ItemBucket.Kernel.Kernel.Util.IndexSearcher(IndexName))
            {
                return(searcher.GetItems(searchParam));
            }
        }
        protected void Filter_Click(object sender, EventArgs e)
        {
            if (Session["SearchTerm"] != null)
            {
                Searchparam = (SearchParam)Session["SearchTerm"];

            }
            if (Session["City"] != null)
            {
                Searchparam.City = Session["City"] as string;
            }
            if (ddlMaximum.SelectedValue != "No Maximum")
                Searchparam.PriceMaximum = ConvertToNullableDecimalType(ddlMaximum.SelectedValue);

            if (ddlMinimum.SelectedValue != "No Minimum")
                Searchparam.PriceMinimum = ConvertToNullableDecimalType(ddlMinimum.SelectedValue);

            if (ddlBathroomsMinimum.SelectedValue != "No Maximum")
                Searchparam.BathMaximum = ConvertToNullableType(ddlBedroomsMaximum.SelectedValue);

            if (ddlBathroomsMinimum.SelectedValue != "No Minimum")
                Searchparam.BathMinimum = ConvertToNullableType(ddlBathroomsMinimum.SelectedValue);

            if (ddlBedroomsMinimum.SelectedValue != "No Minimum")
                Searchparam.BedMinimum = ConvertToNullableType(ddlBedroomsMinimum.SelectedValue);

            if (ddlBedroomsMaximum.SelectedValue != "No Maximum")
                Searchparam.BedMaximum = ConvertToNullableType(ddlBedroomsMaximum.SelectedValue);

            if (ddlPropertyType.SelectedValue != "Any")
                Searchparam.PropertyType = ddlPropertyType.SelectedValue;

            Searchparam.SearchTypeValue = SearchType.Filter;
            Session["SearchTerm"] = Searchparam;

            ltvResult.DataSource = Search.SearchFunction(Searchparam);
            ltvResult.DataBind();
        }
Example #32
0
        public DataRow[] Search(SearchParam param, object find)
        {
            // desativa o comando Selecionar
             view.SelectEnabled = false;

             // limpa os resultados anteriores
             view.ClearResults();

             // atribui o parametro selecionado pelo usuário e o valor de pesquisa
             param.Value = find;
             searcher.SelectedFilter = param;

             // não há uma transação definida para realizar a pesquisa
             // dispara uma exceção
             if (searcher.RunFunction == null)
            throw new Exception("A rotina de pesquisa não foi definida para o filtro selecionado.");

             // executa a pesquisa
             searcher.RunFunction.Execute();

             // retorna o resultado da pesquisa
             return searcher.RunFunction.Result;
        }
        protected void ltVEstateAgents_PagePropertiesChanged(object sender, EventArgs e)
        {
            if (Session["SearchTermEstate"] != null)
            {
                Param = (SearchParam)Session["SearchTermEstate"];

                if (Param.SearchTypeValue == SearchType.FreeText)
                {
                    if (!string.IsNullOrWhiteSpace(Param.SearchTerm))
                    {
                        ltVEstateAgents.DataSource = Search.SearchAgents(param);
                        ltVEstateAgents.DataBind();
                    }
                    else
                    {
                        //IEnumerable<PropertyTableAzure> propertyTable = Search.GetPropertyTablesFromCache(Param.UserID);
                        //ltVEstateAgents.DataSource = propertyTable;
                        //ltVEstateAgents.DataBind();

                    }
                }
                else if (Param.SearchTypeValue == SearchType.Filter)
                {
                    ltVEstateAgents.DataSource = Search.SearchAgents(Param);
                    ltVEstateAgents.DataBind();
                }

            }
        }
Example #34
0
        // return:
        //      -1  出错
        //      >=0 命中的记录数
        int SearchLineMessage(
            string strQueryWord,
            string strFrom,
            // AccountInfo account,
            bool bAutoSetFocus,
            out string strError)
        {
            strError = "";
            int nRet = 0;

            string strFromStyle = "";

            if (string.IsNullOrEmpty(strFrom) == true)
                strFrom = "ISBN";

            if (strFrom == "书名" || strFrom == "题名")
                strFromStyle = "title";
            else if (strFrom == "作者" || strFrom == "著者" || strFrom == "责任者")
                strFromStyle = "contributor";
            else if (strFrom == "出版社" || strFrom == "出版者")
                strFromStyle = "publisher";
            else if (strFrom == "出版日期")
                strFromStyle = "publishtime";
            else if (strFrom == "主题词")
                strFromStyle = "subject";

            if (string.IsNullOrEmpty(strFromStyle) == true)
            {
                try
                {
                    strFromStyle = this.MainForm.GetBiblioFromStyle(strFrom);
                }
                catch (Exception ex)
                {
                    strError = ex.Message;
                    goto ERROR1;
                }

                if (String.IsNullOrEmpty(strFromStyle) == true)
                {
                    strError = "GetFromStyle()没有找到 '" + strFrom + "' 对应的 style 字符串";
                    goto ERROR1;
                }
            }

            string strMatchStyle = "left";  // BiblioSearchForm.GetCurrentMatchStyle(this.comboBox_matchStyle.Text);
            if (string.IsNullOrEmpty(strQueryWord) == true)
            {
                if (strMatchStyle == "null")
                {
                    strQueryWord = "";

                    // 专门检索空值
                    strMatchStyle = "exact";
                }
                else
                {
                    // 为了在检索词为空的时候,检索出全部的记录
                    strMatchStyle = "left";
                }
            }
            else
            {
                if (strMatchStyle == "null")
                {
                    strError = "检索空值的时候,请保持检索词为空";
                    goto ERROR1;
                }
            }

            this.ShowMessage("正在针对 共享网络\r\n检索 " + strQueryWord + " ...",
                "progress", false);

                string strSearchID = Guid.NewGuid().ToString();
                _searchParam = new SearchParam();
                _searchParam._searchID = strSearchID;
                _searchParam._autoSetFocus = bAutoSetFocus;
                _searchParam._searchComplete = false;
                _searchParam._searchCount = 0;
                this.MainForm.MessageHub.SearchResponseEvent += MessageHub_SearchResponseEvent;

            try
            {
                string strOutputSearchID = "";
                nRet = this.MainForm.MessageHub.BeginSearchBiblio(
                    strSearchID,
                    "<全部>",
    strQueryWord,
    strFromStyle,
    strMatchStyle,
    "",
    1000,
    out strOutputSearchID,
    out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == 0)
                    return 0;

                // 装入浏览记录
                {
                    TimeSpan timeout = new TimeSpan(0,1,0);
                    DateTime start_time = DateTime.Now;
                    while (_searchParam._searchComplete == false)
                    {
                        Application.DoEvents();
                        Thread.Sleep(200);
                        if (DateTime.Now - start_time > timeout)    // 超时
                            break;
                        if (this.Progress != null && this.Progress.State != 0)
                        {
                            strError = "用户中断";
                            goto ERROR1;
                        }
                    }
                }

                return _searchParam._searchCount;
            }
            finally
            {
                this.ClearMessage();
                {
                    this.MainForm.MessageHub.SearchResponseEvent -= MessageHub_SearchResponseEvent;
                    _searchParam._searchID = "";
                }
            }

        ERROR1:
            strError = "针对 共享网络 检索出错: " + strError;
            AddBiblioBrowseLine(strError, TYPE_ERROR, bAutoSetFocus);
            return -1;
        }
        protected void ltvResult_PagePropertiesChanged(object sender, EventArgs e)
        {
            if (Session["SearchTerm"] != null)
            {
                Searchparam = (SearchParam)Session["SearchTerm"];

                if (Searchparam.SearchTypeValue == SearchType.FreeText)
                {
                    if (!string.IsNullOrWhiteSpace(Searchparam.SearchTerm))
                    {
                        ltvResult.DataSource = Search.SearchFunction(Searchparam);
                        ltvResult.DataBind();
                    }
                    else
                    {
                        IEnumerable<PropertyTableAzure> propertyTable = Search.GetPropertyTablesFromCache(Searchparam.UserID);
                        ltvResult.DataSource = propertyTable;
                        ltvResult.DataBind();

                    }
                }
                else if (Searchparam.SearchTypeValue == SearchType.Filter)
                {
                    ltvResult.DataSource = Search.SearchFunction(Searchparam);
                    ltvResult.DataBind();
                }
                else if (Searchparam.SearchTypeValue == SearchType.Custom)
                {
                    ltvResult.DataSource = Search.SearchFunction(Searchparam);
                    ltvResult.DataBind();
                }

            }
        }
 public ChainedParamValue(SearchParam value)
 {
     Value = value;
 }
Example #37
0
        // 开始检索共享书目
        // return:
        //      -1  出错
        //      0   没有检索目标
        //      1   成功启动检索
        int BeginSearchShareBiblio(
            string strQueryWord,
            string strFromStyle,
            string strMatchStyle,
            out string strError)
        {
            strError = "";

            string strSearchID = Guid.NewGuid().ToString();
            _searchParam = new SearchParam();
            _searchParam._searchID = strSearchID;
            _searchParam._searchComplete = false;
            _searchParam._searchCount = 0;
            this.MainForm.MessageHub.SearchResponseEvent += MessageHub_SearchResponseEvent;

            string strOutputSearchID = "";
            int nRet = this.MainForm.MessageHub.BeginSearchBiblio(
                strSearchID,
                "<全部>",
strQueryWord,
strFromStyle,
strMatchStyle,
"",
1000,
out strOutputSearchID,
out strError);
            if (nRet == -1)
            {
                // 检索过程结束
                _searchParam._searchComplete = true;
                return -1;
            }
            if (nRet == 0)
            {
                // 检索过程结束
                _searchParam._searchComplete = true;
                return 0;
            }

            return 1;
        }
        //private static readonly Regex FacetQueryRegex = new Regex("^facet.query", RegexOptions.Compiled | RegexOptions.IgnoreCase);
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var qs = controllerContext.HttpContext.Request.QueryString;

            //int  UserID = Convert.ToInt32(StringHelper.EmptyToNull(qs["UserID"]));

            //string latlongstring = StringHelper.EmptyToNull(qs["UserLoc"]);
            //GLatLong latlong = new GLatLong();
            //latlong = GetLatLong(latlongstring);

            DateTime PickUpDateSearch = string.IsNullOrEmpty(qs["Search.PickUpDateSearch"]) ? Convert.ToDateTime(qs["PickUpDateSearch"]) : Convert.ToDateTime(qs["Search.PickUpDateSearch"]);

            var qsDict = NVToDict(qs);
            var sp = new SearchParam
            {
                //UserLoc.Latitude = Convert.ToDouble(StringHelper.EmptyToNull(qs["CurrLoc"])),
               // CurrLoc = StringHelper.EmptyToNull(qs["CurrLoc"]),
              //  UserID = WebSecurity.CurrentUserId,
                FreeSearch = StringHelper.EmptyToNull(qs["Search.FreeSearch"]),
                DistanceSearch = StringHelper.EmptyToNull(qs["DistanceDD.SelectedDistanceLimit"]),
                PickUpDateSearch = PickUpDateSearch,
                PageIndex = StringHelper.TryParse(qs["page"], 1),
                PageSize = StringHelper.TryParse(qs["pageSize"], DefaultPageSize),
                Sort = StringHelper.EmptyToNull(qs["sort"]),
                Facets = qsDict.Where(k => FacetRegex.IsMatch(k.Key))
                    .Select(k => k.WithKey(FacetRegex.Replace(k.Key, "")))
                    .ToDictionary(),
              //  UserLoc = latlong
                //FacetQueries = qsDict.Where(k => FacetQueryRegex.IsMatch(k.Key))
                //    .Select(k => k.WithKey(k.Key))
                //    .ToDictionary()
            };
            return sp;
        }
Example #39
0
        // 开始检索共享书目
        // return:
        //      -1  出错
        //      0   没有检索目标
        //      1   成功启动检索
        int BeginSearchShareBiblio(
            string strQueryWord,
            string strFromStyle,
            string strMatchStyle,
            out string strError)
        {
            strError = "";

            this.browseWindow.BrowseTitleTable = this._browseTitleTable;

            string strSearchID = Guid.NewGuid().ToString();
            _searchParam = new SearchParam();
            _searchParam._searchID = strSearchID;
            _searchParam._searchComplete = false;
            _searchParam._searchCount = 0;
            _searchParam._serverPushEncoding = "utf-7";
            this.MainForm.MessageHub.SearchResponseEvent += MessageHub_SearchResponseEvent;

            string strOutputSearchID = "";
            int nRet = this.MainForm.MessageHub.BeginSearchBiblio(
                "*",
                new SearchRequest(strSearchID,
                    "searchBiblio",
                "<全部>",
strQueryWord,
strFromStyle,
strMatchStyle,
"",
"id",
1000,
0,
-1,
_searchParam._serverPushEncoding),
out strOutputSearchID,
out strError);
            if (nRet == -1)
            {
                // 检索过程结束
                _searchParam._searchComplete = true;
                return -1;
            }
            if (nRet == 0)
            {
                // 检索过程结束
                _searchParam._searchComplete = true;
                return 0;
            }

            if (_searchParam._manager.SetTargetCount(nRet) == true)
                _searchParam._searchComplete = true;

            return 1;
        }
 public CustomSelectOleDbOperation(string sqlCommand, SearchParam[] parameters, OleDbConnection connection, OleDbTransaction transaction)
     : base(connection, transaction)
 {
     this.wCommand = sqlCommand;
      this.wParams = parameters;
 }