internal void ChangeAdStatus(AdvertisementSearchModel advertisementSearchModel)
        {
            string AddID, Status;

            this.FillSearchParamitters(advertisementSearchModel);
            this.Search();
            if (this.GetRowsOfGrid().Count > 0)
            {
                IWebElement ResultRow = this.GetRowsOfGrid()[0];
                Status = this.FindStatusFromResultRow(ResultRow);
                AddID  = this.FindAddIDFromResultRow(ResultRow);
                this.SelectRow(ResultRow);
                this.ChangeStatusofSelectedAds("Work In Progress");
            }
            else
            {
                this.ClearFilter();
                advertisementSearchModel.Statuses[0] = "Work In Progress";
                this.FillSearchParamitters(advertisementSearchModel);
                this.Search();
                IWebElement ResultRow = this.GetRowsOfGrid()[0];
                Status = this.FindStatusFromResultRow(ResultRow);
                AddID  = this.FindAddIDFromResultRow(ResultRow);
                this.SelectRow(ResultRow);
                this.ChangeStatusofSelectedAds("Active");
            }
        }
 public AdvertisementPage FillSearchParamitters(AdvertisementSearchModel Data)
 {
     this.ClearFilter();
     FillEMemberID(Data.MemberID);
     Select.SelectFromMultipleControl(Data.Positions, PositionControl);
     this.TagBasedInput(Data.SearchTerms, SearchTermsControl);
     Element.syncCheckBox(Data.IncludeSubCat, IncludeSubCatInput);
     Select.SelectFromMultipleControl(Data.SalesReps, SalesRepsControl);
     Select.SelectFromMultipleControl(Data.Statuses, AdStatusControl);
     Select.ByText(YearDD, Data.Year.ToString());
     Select.ByText(MonthDD, Data.Month.ToString());
     Select.SelectFromMultipleControl(Data.Rates, RateControl);
     FilterTextfield.SendKeys(Data.SearchField == null ? "" : Data.SearchField);
     Select.SelectFromMultipleControl(Data.ProductGroup, ProductGroupControl);
     Select.SelectFromMultipleControl(Data.AddType, AdTypeControl);
     this.Search();
     return(this);
 }
        /// <summary>
        /// 廣告區管理 Index
        /// </summary>
        /// <param name="search"></param>
        /// <param name="page"></param>
        /// <param name="siteId"></param>
        /// <param name="menuId"></param>
        /// <returns></returns>
        public ActionResult Index(AdvertisementSearchModel search, int?page, long siteId = 1, long menuId = 2000)
        {
            ViewBag.SiteID = siteId;
            ViewBag.MenuID = menuId;

            if (Request.HttpMethod == "GET")
            {
                if (page == null)
                {
                    WorkV3.Common.Utility.ClearSearchValue();
                }
                else
                {
                    AdvertisementSearchModel prevSearch = WorkV3.Common.Utility.GetSearchValue <AdvertisementSearchModel>();
                    if (prevSearch != null)
                    {
                        search = prevSearch;
                    }
                }
            }
            else if (Request.HttpMethod == "POST")
            {
                WorkV3.Common.Utility.SetSearchValue(search);
                ViewBag.IsSearchMode = "IsSearchMode";
            }
            ViewBag.Search = search;

            List <AdvertisementModel> list = new List <AdvertisementModel>();
            Pagination pagination          = new Pagination
            {
                PageIndex = page ?? 1,
                PageSize  = WebInfo.PageSize
            };
            int totalRecord = 0;

            list = AdvertisementDAO.GetAdvertisement(search, pagination.PageSize, pagination.PageIndex, siteId, out totalRecord);
            pagination.TotalRecord = totalRecord;
            ViewBag.Pagination     = pagination;


            return(View(list));
        }
Exemple #4
0
        public List <Advertisement> Search(AdvertisementSearchModel searchModel)
        {
            var result = this.context.Advertisements.AsQueryable();

            if (searchModel != null)
            {
                result = result.Where(x => x.Brand.Equals(searchModel.Brand));
                result = result.Where(x => x.VehicleModel.Contains(searchModel.VehicleModel));
                result = result.Where(x => x.Category.Equals(searchModel.Category));
                result = result.Where(x => x.EngineType.Equals(searchModel.EngineType));
                result = result.Where(x => x.Transmission.Equals(searchModel.Transmission));
                result = result.Where(x => x.Location.Equals(searchModel.Location));
                result = result.Where(x => x.ModelYear >= searchModel.ModelYearFrom);
                result = result.Where(x => x.ModelYear <= searchModel.ModelYearTo);
                result = result.Where(x => x.HorsePower >= searchModel.HorsePowerFrom);
                result = result.Where(x => x.HorsePower <= searchModel.HorsePowerTo);
                result = result.Where(x => x.Price >= searchModel.PriceFrom);
                result = result.Where(x => x.Price <= searchModel.PriceTo);
            }
            return(result.ToList());
        }