public ActionResult Index([Bind(Exclude = "ProductSearchResult")] ProductListView SerchCriteria) { var ProductList = AgroExpressDBAccess.GetAllEnabledProduct(); ProductListView ProductListV = new ProductListView(); ProductListV.ProductList = ProductList.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName, Selected = x.PKProductId == SerchCriteria.SelectedProductID ? true : false }); var SearchResult = AgroExpressDBAccess.SearchProduct(SerchCriteria.SelectedProductID, SerchCriteria.MinimumStock, SerchCriteria.MaximumStock); if (SearchResult != null) { ProductListV.ProductSearchResult = SearchResult; } else { ProductListV.ProductSearchResult = new List <Product>(); } ProductListV.MaximumStock = SerchCriteria.MaximumStock; ProductListV.MinimumStock = SerchCriteria.MinimumStock; ModelState.Clear(); return(View(ProductListV)); }
public ProductListViewModel(ProductListView productListView) : this() { ProductListView = productListView; Task.Run(() => LoadProductsAsync()); AddCPUCommand = new RelayCommand(ExecAddCPU, CanAddProduct); EditCPUCommand = new RelayCommand(ExecEditCPU, CanEditCPU); DeleteCPUCommand = new RelayCommand(ExecDeleteCPUAsync, CanDeleteCPU); AddGPUCommand = new RelayCommand(ExecAddGPU, CanAddProduct); EditGPUCommand = new RelayCommand(ExecEditGPU, CanEditGPU); DeleteGPUCommand = new RelayCommand(ExecDeleteGPUAsync, CanDeleteGPU); AddMotherboardCommand = new RelayCommand(ExecAddMotherboard, CanAddProduct); EditMotherboardCommand = new RelayCommand(ExecEditMotherboard, CanEditMotherboard); DeleteMotherboardCommand = new RelayCommand(ExecDeleteMotherboardAsync, CanDeleteMotherboard); AddMemoryCommand = new RelayCommand(ExecAddMemory, CanAddProduct); EditMemoryCommand = new RelayCommand(ExecEditMemory, CanEditMemory); DeleteMemoryCommand = new RelayCommand(ExecDeleteMemoryAsync, CanDeleteMemory); AddStorageCommand = new RelayCommand(ExecAddStorage, CanAddProduct); EditStorageCommand = new RelayCommand(ExecEditStorage, CanEditStorage); DeleteStorageCommand = new RelayCommand(ExecDeleteStorageAsync, CanDeleteStorage); AddPSUCommand = new RelayCommand(ExecAddPSU, CanAddProduct); EditPSUCommand = new RelayCommand(ExecEditPSU, CanEditPSU); DeletePSUCommand = new RelayCommand(ExecDeletePSUAsync, CanDeletePSU); AddCaseCommand = new RelayCommand(ExecAddCase, CanAddProduct); EditCaseCommand = new RelayCommand(ExecEditCase, CanEditCase); DeleteCaseCommand = new RelayCommand(ExecDeleteCaseAsync, CanDeleteCase); }
/// <summary> /// Runs also on UI thread: it updates some labels, sets default per-page value, updates the list view and shows pagination. /// /// When this task is done, your items in the ListVIew should appear. /// </summary> private void UpdateUIAfterLoad() { if (ProductListView.InvokeRequired) { ProductListView.Invoke((MethodInvoker) delegate() { TotalRecords = LoadedProducts.Count; UpdateTotalPages(); CurrentPage = 1; LblCurrentPage.Text = CurrentPage.ToString(); LblTotalRecords.Text = TotalRecords.ToString(); ProductListView.Visible = true; /* On first file load we call SetDefaultPerPageValue() since it will trigger it's SelectedIndexChanged event which * will call UpdateListView(0) for us, but when we try to load another file in the same context, we'll update the * list from here. */ if (DropDownPerPage.SelectedIndex == -1) { SetDefaultPerPageValue(); } else { UpdateListView(0); } TogglePaginationVisibility(); }); } }
public ProductListPage(string title, bool isPerformingProductSelection = false) { Title = title; #region product list ProductListView productListView = new ProductListView(); productListView.SetBinding(ProductListView.ItemsSourceProperty, "Products"); productListView.IsPullToRefreshEnabled = true; productListView.SetBinding(CategoryListView.RefreshCommandProperty, "LoadProductsCommand"); productListView.SetBinding(CategoryListView.IsRefreshingProperty, "IsBusy", mode: BindingMode.OneWay); productListView.ItemTapped += async(sender, e) => { Product catalogProduct = ((Product)e.Item); await Navigation.PushAsync(new ProductDetailPage(catalogProduct, isPerformingProductSelection)); }; #endregion #region compase view hierarchy Content = new UnspacedStackLayout() { Children = { productListView } }; #endregion }
// список продуктов с сортировкой по категориям //[AllowAnonymous] возможность просмотра незарегистрированным пользователем public IActionResult Index(int?categoryId) { IQueryable <Product> productsCateg = _context.Products.Include(p => p.Category); if (categoryId != null && categoryId != 0) { productsCateg = productsCateg.Where(p => p.CategoryId == categoryId); } List <Category> categories = _context.Categories.ToList(); //для отображени названий вместо id в таблице List <Brand> brands = _context.Brands.ToList(); List <Provider> providers = _context.Providers.ToList(); // устанавливаем начальный элемент, который позволит выбрать всех categories.Insert(0, new Category { Title = "All", Id = 0 }); ProductListView plv = new ProductListView { Categories = new SelectList(categories, "Id", "Title"), Products = productsCateg.ToList(), }; return(View(plv)); }
public ProductRegistrationViewModel(IUnityContainer container) { // Resolve services _regionManager = container.Resolve <IRegionManager>(); _productService = container.Resolve <IProductService>(); _eventAggregator = container.Resolve <IEventAggregator>(); // Get data from Database Initialization = InitializeProductListAsync(); ProductListView.MoveCurrentToFirst(); _title = "-Product Management Title-"; _currentCommand = Definitions.Enumeration.Commands.None; NewProductFormVisibility = false; EnableProductList = true; SetProductValidationRules(); // Event Handler OnFirstCommand = new DelegateCommand(FirstCommandHandler); OnPreviousCommand = new DelegateCommand(PreviousCommandHandler); OnNextCommand = new DelegateCommand(NextCommandHandler); OnLastCommand = new DelegateCommand(LastCommandHandler); OnAddCommand = new DelegateCommand(AddCommandHandler); OnEditProductCommand = new DelegateCommand <ProductModel>(EditProductCommandHandler); OnSaveCommand = new DelegateCommand(SaveCommandHandler); OnDeleteProductCommand = new DelegateCommand <ProductModel>(DeleteProductCommandHandler); OnCancelCommand = new DelegateCommand(CancelCommandHandler); OnCloseCommand = new DelegateCommand(CloseCommandHandler); OnSelectImageCommand = new DelegateCommand(SelectImageHandler); }
public ProductListViewModel(ProductListView productListView) { this.productListView = productListView; this.productListView.SearchProductBtn.Click += SearchProductBtn_Click; this.productListView.AddB.Click += AddB_Click; this.productListView.EditBtn.Click += EditBtn_Click; this.categoryManager = new MySQLManager <Category>(DataConnectionResource.LOCALMYQSL); this.productListView.CategoryListUserControl.LoadItems(Session.Shop.Id); }
private void NextCommandHandler() { ProductListView.MoveCurrentToNext(); if (ProductListView.IsCurrentAfterLast == true) { ProductListView.MoveCurrentToLast(); } }
private void PreviousCommandHandler() { ProductListView.MoveCurrentToPrevious(); if (ProductListView.IsCurrentBeforeFirst == true) { ProductListView.MoveCurrentToFirst(); } }
public List <product> searchProduct(PageService page, ProductListView list) { var data = db.product.AsEnumerable().Where(p => p.cid.ToString().Contains(list.cid.ToString()) && p.name.Contains(list.search)); page.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(data.Count()) / page.itemCount)); page.rightPage(); return(data.OrderBy(p => p.id).Skip((page.currentPage - 1) * page.itemCount).Take(page.itemCount).ToList()); }
protected void ProductListView_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager pager = ProductListView.FindControl("pager") as DataPager; pager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); string productId = ProductDetailsView.DataKey[0].ToString(); LoadComments(productId); LoadProduct(productId); }
private void InitializeViews() { m_HomeView = new HomeView(); m_MainListView = new MainListView(); m_ProductListView = new ProductListView(); m_FilterView = new FilterView(); m_ProductImportView = new ProductImportView(); m_ProductExportView = new ProductExportView(); m_DeliveryView = new DeliveryView(); }
public IActionResult Index(int?categoryId) { IQueryable <Product> productsCateg = _context.Products.Include(p => p.Category); if (categoryId != null && categoryId != 0) { productsCateg = productsCateg.Where(p => p.CategoryId == categoryId); } ProductListView plv = new ProductListView { Products = productsCateg.ToList(), }; return(View(plv)); }
/// <summary> /// Clears the ListView and locks any visible changes in the ListView, until EndUpdate is called. /// /// It creates a range fromIndex with count of ItemsPerPage to show appropriate number of items in the list view and at a specific positions. /// </summary> /// <param name="fromIndex"></param> private void UpdateListView(int fromIndex, int perPage = -1) { ProductListView.Items.Clear(); ProductListView.BeginUpdate(); int perPageContext = (perPage == -1) ? ItemsPerPage : perPage; if (perPageContext > TotalRecords) { perPageContext = TotalRecords; } ListViewItem[] range = LoadedProducts.GetRange(fromIndex, perPageContext).ToArray(); ProductListView.Items.AddRange(range); ProductListView.EndUpdate(); }
public PartialViewResult CategorySearch(int?categoryId) { IQueryable <Product> productsCateg = _context.Products.Include(p => p.Category); if (categoryId != null && categoryId != 0) { productsCateg = productsCateg.Where(p => p.CategoryId == categoryId); } List <Category> categories = _context.Categories.ToList(); List <Brand> brands = _context.Brands.ToList(); List <Provider> providers = _context.Providers.ToList(); ProductListView plv = new ProductListView { Products = productsCateg.ToList(), }; return(PartialView(plv)); }
public ProductListPage(string title, bool isPerformingProductSelection = false) { Title = title; #region product list ProductListView productListView = new ProductListView(); productListView.SetBinding(ProductListView.ItemsSourceProperty, "Products"); productListView.IsPullToRefreshEnabled = true; productListView.SetBinding(CategoryListView.RefreshCommandProperty, "LoadProductsCommand"); productListView.SetBinding(CategoryListView.IsRefreshingProperty, "IsBusy", mode: BindingMode.OneWay); productListView.ItemTapped += async(sender, e) => await App.ExecuteIfConnected(async() => { CatalogProduct catalogProduct = ((CatalogProduct)e.Item); await Navigation.PushAsync(new ProductDetailPage(catalogProduct, isPerformingProductSelection)); }); productListView.SetBinding(CategoryListView.HeaderProperty, "."); productListView.HeaderTemplate = new DataTemplate(() => { Label loadingLabel = new Label() { Text = TextResources.Products_ProductList_LoadingLabel, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), XAlign = TextAlignment.Center, YAlign = TextAlignment.End, TextColor = Palette._007 }; loadingLabel.SetBinding(Label.IsEnabledProperty, "IsBusy", mode: BindingMode.OneWay); loadingLabel.SetBinding(Label.IsVisibleProperty, "IsBusy", mode: BindingMode.OneWay); return(loadingLabel); }); #endregion #region compase view hierarchy Content = new UnspacedStackLayout() { Children = { productListView } }; #endregion }
public ActionResult Index() { var ProductList = AgroExpressDBAccess.GetAllEnabledProduct(); ProductListView ProductListV = new ProductListView(); ProductListV.ProductList = ProductList.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); if (ProductList != null) { ProductListV.ProductSearchResult = ProductList; } else { ProductListV.ProductSearchResult = new List <Product>(); } return(View(ProductListV)); }
public ActionResult List(string group = null, int page = 1) { ProductDAC product = new ProductDAC(); ProductListView model = new ProductListView { Products = product.GetList(page, pageSize, group), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = product.GetWorkCenterTotalCount(group) }, CurrentCategory = group }; ViewBag.WorkOrderList = model; //페이지 뷰백 return(View(model)); }
public ViewResult List(string category, int page = 1) { ProductListView model = new ProductListView() { Products = repository.Products .Where(p => category == null || p.Category == category) .OrderBy(p => p.ProductId) .Skip((page - 1) * sizePage) .Take(sizePage), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = sizePage, TotalItems = repository == null? repository.Products.Count() : repository.Products.Where(game => game.Category == category).Count() }, CurrentCategory = category }; return(View(model)); }
public void Display() { IView productListView = new ProductListView(productList); productListView.Display(); }
protected void Page_PreRender(object sender, EventArgs e) { ProductDetailsView.DataBind(); ProductListView.DataBind(); }
//public void SaveAudit(PriceBase priceBase, HistoryStatus historyStatus) //{ // SaveAudit(priceBase, historyStatus, null); //} //public void SaveAudit(PriceBase priceBase, HistoryStatus historyStatus, Guid? userId) //{ // PriceBaseHistory priceBaseHistory = new PriceBaseHistory(); // priceBaseHistory.PriceImport = priceBase.PriceImport; // priceBaseHistory.PriceList = priceBase.PriceList; // priceBaseHistory.PriceListCurrency = priceBase.PriceListCurrency; // priceBaseHistory.PricePurchase = priceBase.PricePurchase; // priceBaseHistory.PricePurchaseCurrency = priceBase.PricePurchaseCurrency; // priceBaseHistory.PriceSuggest = priceBase.PriceSuggest; // priceBaseHistory.PriceSuggestCurrency = priceBase.PriceSuggestCurrency; // priceBaseHistory.Product = priceBase.Product; // priceBaseHistory.Provider = priceBase.Provider; // priceBaseHistory.ProviderCode = priceBase.ProviderCode; // priceBaseHistory.Status = priceBase.Status; // priceBaseHistory.HistoryStatus = historyStatus; // priceBaseHistory.CurrencyRate = priceBase.CurrencyRate; // priceBaseHistory.PricePurchaseCurrencyRate = priceBase.PricePurchaseCurrencyRate; // priceBaseHistory.PriceSuggestCurrencyRate = priceBase.PriceSuggestCurrencyRate; // if (userId.HasValue) // { // priceBaseHistory.TimeStamp.CreatedBy = userId; // priceBaseHistory.TimeStamp.CreatedOn = DateTime.Now; // priceBaseHistory.TimeStamp.ModifiedBy = userId; // priceBaseHistory.TimeStamp.ModifiedOn = DateTime.Now; // } // Save(priceBaseHistory); //} //public void SaveAudit(IList<PriceBase> lst, HistoryStatus historyStatus) //{ // foreach (PriceBase priceBase in lst) // SaveAudit(priceBase, historyStatus); //} public IList <ProductListView> GetByProduct(Product product, GridState gridState, out int totalRecords) { ICriteria crit = GetByProductCriteria(product); //crit.SetProjection(Projections.ProjectionList().Add(Projections.Count("ID"))); //totalRecords = crit.UniqueResult<int>(); //if (totalRecords == 0) // return new List<ProductListView>(); int pageNumber = gridState.PageNumber; int pageSize = gridState.PageSize; //crit = GetByProductCriteria(product); //crit.SetMaxResults(gridState.PageSize); //if (pageNumber == 1) // crit.SetFirstResult(0); //else // crit.SetFirstResult((pageNumber - 1) * gridState.PageSize); string[] sort = gridState.SortField.Split('.'); ICriteria critSort = crit; string sortField = gridState.SortField; if (!sortField.Contains("TimeStamp") && sort.Length > 1) { critSort = crit.CreateCriteria(sort[0]); sortField = sort[1]; } critSort.AddOrder(new Order(sortField, gridState.SortAscending)); IList <PriceBaseHistory> priceBaseHistoryList = crit.List <PriceBaseHistory>(); IList <ProductListView> productListViewList = new List <ProductListView>(); totalRecords = priceBaseHistoryList.Count; pageNumber = Utils.AdjustPageNumber(pageNumber, pageSize, totalRecords); int count; int maxcount; if (pageNumber == 1) { count = 0; } else { count = (pageNumber - 1) * gridState.PageSize; } maxcount = count + pageSize; decimal price = -1; foreach (PriceBaseHistory pbh in priceBaseHistoryList) { if (count < maxcount) { if (price == pbh.PriceList) { continue; } ProductListView productListView = new ProductListView(pbh); productListViewList.Add(productListView); count++; price = pbh.PriceList; } else { break; } } return(productListViewList); }
// GET: Home public ActionResult Index() { //작업지시별 불량률 확인 하고 리스트로 뿌려준다. JobOrderDAC jobOrder = new JobOrderDAC(); JobOrderListView jobordermodel = new JobOrderListView // 작업지시 view만들고 { JobOrders = jobOrder.GetWorkOrderFive(), // 진행중인 작업지시 조회 }; PrdUnitListView prdUnitmodel = new PrdUnitListView // { PrdUnits = jobOrder.GetUnitCount() // }; ViewBag.Badrate = string.Format("{0:0.0}", jobOrder.GetBadrate()); // 불량률 뷰백 ViewBag.TotalmonthWOJS = jobOrder.GetWorkOrderTotalCount_month("제선"); ViewBag.TotalmonthWOJK = jobOrder.GetWorkOrderTotalCount_month("제강"); ViewBag.TotalmonthWOAY = jobOrder.GetWorkOrderTotalCount_month("압연"); ViewBag.TotalmonthWOJJ = jobOrder.GetWorkOrderTotalCount_month("적재"); ViewBag.TotalmonthWOPJ = jobOrder.GetWorkOrderTotalCount_month("포장"); //이번달 전체작업지시 뷰백 ViewBag.FinishmonthWOJS = jobOrder.GetWorkOrderFinishCount_month("제선"); ViewBag.FinishmonthWOJK = jobOrder.GetWorkOrderFinishCount_month("제강"); ViewBag.FinishmonthWOAY = jobOrder.GetWorkOrderFinishCount_month("압연"); ViewBag.FinishmonthWOJJ = jobOrder.GetWorkOrderFinishCount_month("적재"); ViewBag.FinishmonthWOPJ = jobOrder.GetWorkOrderFinishCount_month("포장"); //이번달 작업완료 뷰백 ViewBag.FinishtodayWOJS = jobOrder.GetWorkOrderFinishCount_today("제선"); ViewBag.FinishtodayWOJK = jobOrder.GetWorkOrderFinishCount_today("제강"); ViewBag.FinishtodayWOAY = jobOrder.GetWorkOrderFinishCount_today("압연"); ViewBag.FinishtodayWOJJ = jobOrder.GetWorkOrderFinishCount_today("적재"); ViewBag.FinishtodayWOPJ = jobOrder.GetWorkOrderFinishCount_today("포장"); //금일작업완료 뷰백 ViewBag.FinishWOJS = jobOrder.GetWorkOrderFinishCount("제선"); ViewBag.FinishWOJK = jobOrder.GetWorkOrderFinishCount("제강"); ViewBag.FinishWOAY = jobOrder.GetWorkOrderFinishCount("압연"); ViewBag.FinishWOJJ = jobOrder.GetWorkOrderFinishCount("적재"); ViewBag.FinishWOPJ = jobOrder.GetWorkOrderFinishCount("포장"); //누적작업완료 뷰백 ViewBag.TopFive = jobordermodel; //작업지시 뷰백 ProductDAC workcenter = new ProductDAC(); ProductListView workcentermodel = new ProductListView { Products = workcenter.GetList(1, 10, null), PagingInfo = new PagingInfo { CurrentPage = 1, ItemsPerPage = 5, TotalItems = workcenter.GetWorkCenterTotalCount(null) }, CurrentCategory = null }; ViewBag.TotalWCJS = workcenter.GetWorkCenterTotalCount("제선"); ViewBag.TotalWCJK = workcenter.GetWorkCenterTotalCount("제강"); ViewBag.TotalWCAY = workcenter.GetWorkCenterTotalCount("압연"); ViewBag.TotalWCJJ = workcenter.GetWorkCenterTotalCount("적재"); ViewBag.TotalWCPJ = workcenter.GetWorkCenterTotalCount("포장"); //전체 작업장수 뷰백 ViewBag.StoppingWCJS = workcenter.GetWorkCenterCountStop("제선"); ViewBag.StoppingWCJK = workcenter.GetWorkCenterCountStop("제강"); ViewBag.StoppingWCAY = workcenter.GetWorkCenterCountStop("압연"); ViewBag.StoppingWCJJ = workcenter.GetWorkCenterCountStop("적재"); ViewBag.StoppingWCPJ = workcenter.GetWorkCenterCountStop("포장"); //멈춘 작업장수 뷰백 ViewBag.WorkOrderList = workcentermodel; // 작업장 뷰백 OrderReqDAC woreq = new OrderReqDAC(); WoReqListView woreqmodel = new WoReqListView { WoReqs = woreq.GetWoReqTen() }; ViewBag.WoReqList = woreqmodel; // 생산의뢰 뷰백 ViewBag.WoReqCount = woreq.GetReqTotalCount(); //누적 생산의뢰 뷰백 ViewBag.WoReqCountToday = woreq.GetReqTotalCount_Today(); //금일 생산의뢰 뷰백 MemberDAC memcnt = new MemberDAC(); MemcntListView memcntmodel = new MemcntListView { Members = memcnt.GetWorkerCount() }; ViewBag.memcnt = memcntmodel; //직책별 카운트 뷰백 ViewBag.gn1 = memcntmodel.Members[0].UserGroup_Name; ViewBag.gn1cnt = memcntmodel.Members[0].UserCnt; ViewBag.gn2 = memcntmodel.Members[1].UserGroup_Name; ViewBag.gn2cnt = memcntmodel.Members[1].UserCnt; ViewBag.gn3 = memcntmodel.Members[2].UserGroup_Name; ViewBag.gn3cnt = memcntmodel.Members[2].UserCnt; //직책별 차트데이터 뷰백 ViewBag.WorkTimeAVG = memcnt.GetWorkTimeAVG(); return(View()); }
private void AutosizeListView() { ProductListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); //ProductListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); }
private async Task <int> AddLoadMoreProducts(EstateResultDto productResults) { TaskCompletionSource <int> taskCompletionSource = new TaskCompletionSource <int>(); Device.BeginInvokeOnMainThread(() => { try { if (productResults != null && productResults.EstateResults != null) { var items = productResults.EstateResults.Select(x => new ProductItemViewModel { Id = x.Id, ProductName = x.EstateCode, SalePrice = x.SalePrice ?? 0, SaleUnitId = x.SaleUnit != null ? x.SaleUnit.SaleUnitId ?? 0 : 0, SaleUnit = x.SaleUnit?.Name, RentPrice = x.RentPrice ?? 0, RentUnitId = x.RentUnit != null ? x.RentUnit.RentUnitId ?? 0 : 0, RentUnit = x.RentUnit?.Name, TownId = x.Town != null ? x.Town.TownId ?? 0 : 0, TownName = x.Town?.Name, ListingTypeId = x.Estate_TypeId ?? 0, ListingName = x.NameEstate_Type, HouseNumber = x.HouseNumber, StaffInfo = new StaffInfoViewModel { Name = $"{x.Account?.FirstName} {x.Account?.LastName}", Mobile = x.Account?.Mobile }, OwnerInfo = new OwnerInfoViewModel { Name = x.OwnerName, Mobile = x.Phone }, Area = x.Area, Notes = x.Note, CreatedDate = x.CreatedDate, UpdatedDate = x.ModifiedDate, IsDeleted = x.IsDelete ?? false, IsHot = x.IsHot ?? false, Lat = x.Lat, Long = x.Long, MainPinText = x.MainPinText, Address = x.Address, ImageUrls = x.ImageUrls, CreatorId = (int)(x.Account != null ? x.Account.AccountId ?? 0 : 0) }); foreach (var item in items) { Products.Add(item); } var indexTo = Products.Count - ProductFilters.Instance.PageLimit; ProductListView.LayoutManager.ScrollToRowIndex(indexTo, Syncfusion.ListView.XForms.ScrollToPosition.End, true); ProductListView.ScrollTo(indexTo, Syncfusion.ListView.XForms.ScrollToPosition.End, true); taskCompletionSource.SetResult(1); } CanLoadMore = CheckCanLoadMore(productResults); } catch (Exception ex) { taskCompletionSource.SetResult(0); } }); return(await taskCompletionSource.Task); }
private void FirstCommandHandler() { ProductListView.MoveCurrentToFirst(); }
protected void rpterProductList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { LinkButton orderArrow; switch (param.SortColumn) { case "P.Description": orderArrow = (LinkButton)e.Item.FindControl("lnkDescription"); break; case "PP.Price": orderArrow = (LinkButton)e.Item.FindControl("lnkPrice"); break; case "LPPA.Price": orderArrow = (LinkButton)e.Item.FindControl("lnkLastPrice"); break; case "LPPA.PCR": orderArrow = (LinkButton)e.Item.FindControl("lnkPCR"); break; default: orderArrow = (LinkButton)e.Item.FindControl("lnk" + param.SortColumn); break; } if (param.SortOrder == "asc") { orderArrow.CssClass = "up"; } else { orderArrow.CssClass = "down"; } return; } if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } ProductListView prodlisttemp = (ProductListView)e.Item.DataItem; string currency = ViewState["Currency"].ToString(); ((Label)e.Item.FindControl("lblBaseCurrency")).Text = currency + " "; CheckBox chktemp = (CheckBox)e.Item.FindControl("chbSelected"); if (!Marked) { if (!string.IsNullOrEmpty(SelectedItems.Find(delegate(string record) { if (record == prodlisttemp.ID.ToString()) { return(true); } return(false); }))) { chktemp.Checked = true; } else { chktemp.Checked = false; } } else if (Marked) { if (!string.IsNullOrEmpty(SelectedItems.Find(delegate(string record) { if (record == prodlisttemp.ID.ToString()) { return(true); } return(false); }))) { chktemp.Checked = false; } else { chktemp.Checked = true; } } ProductListView plvtemp = (ProductListView)e.Item.DataItem; HtmlTableCell temp = (HtmlTableCell)e.Item.FindControl("tdPrice"); if (plvtemp.LastPrice > plvtemp.Price) { temp.Attributes["class"] = "down"; } else if ((plvtemp.LastPrice > 0) && (plvtemp.LastPrice < plvtemp.Price)) { temp.Attributes["class"] = "up"; } if (plvtemp.LastPrice > 0) { temp.Attributes["title"] = plvtemp.PriceCurrency.ToString() + " " + plvtemp.LastPrice.ToString("#,##0.00"); } Label lbltemp = (Label)e.Item.FindControl("lblPrice"); if (prodlisttemp.PriceSell > prodlisttemp.PriceSuggest) { lbltemp.ForeColor = System.Drawing.Color.Green; } else if ((prodlisttemp.PriceSell < prodlisttemp.PriceSuggest) && (prodlisttemp.PriceSell > prodlisttemp.PricePurchase)) { lbltemp.ForeColor = System.Drawing.Color.Black; } else if (prodlisttemp.PriceSell < prodlisttemp.PricePurchase) { lbltemp.ForeColor = System.Drawing.Color.Red; } HtmlTableCell temptype = (HtmlTableCell)e.Item.FindControl("tdType"); if (plvtemp.Type == ProductType.Hz50) { temptype.Attributes["class"] = "hz50"; } else if (plvtemp.Type == ProductType.Hz60) { temptype.Attributes["class"] = "hz60"; } }
public void BindProducts(IEnumerable <Product> products) { ProductListView.DataSource = products; ProductListView.DataBind(); }
public ActionResult list(string sort, ProductListView productListView, int page = 1) { //dropdownlist商品分類 ViewBag.category = pcServer.categoryItem(); ViewBag.productCount = db.product.Count(); productListView.page = new PageService(page); //判斷搜尋是否有輸入字串 if (productListView.cid == null || productListView.search == null) { //顯示資料排序 ViewBag.pid = sort == "pid" ? "pid_desc" : "pid"; ViewBag.pName = sort == "pName" ? "pName_desc" : "pName"; ViewBag.pPrice = sort == "pPrice" ? "pPrice_desc" : "pPrice"; ViewBag.pStock = sort == "pStock" ? "pStock_desc" : "pStock";; IQueryable <product> data = db.product; productListView.page.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(data.Count()) / productListView.page.itemCount)); //最大頁數 productListView.dataList = data.OrderBy(p => p.id).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); productListView.page.rightPage(); //頁碼校正 switch (sort) { case "pid": productListView.dataList = data.OrderBy(p => p.id).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pid_desc": productListView.dataList = data.OrderByDescending(p => p.id).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pName": productListView.dataList = data.OrderBy(p => p.name).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pName_desc": productListView.dataList = data.OrderByDescending(p => p.name).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pPrice": productListView.dataList = data.OrderBy(p => p.price).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pPrice_desc": productListView.dataList = data.OrderByDescending(p => p.price).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pStock": productListView.dataList = data.OrderBy(p => p.instock).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; case "pStock_desc": productListView.dataList = data.OrderByDescending(p => p.instock).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); break; } } else { //顯示所查詢資料 var data = db.product.AsEnumerable().Where(p => p.cid.ToString().Contains(productListView.cid.ToString()) && p.name.Contains(productListView.search)); productListView.page.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(data.Count()) / productListView.page.itemCount)); //最大頁數 productListView.page.rightPage(); //頁碼校正 productListView.dataList = data.OrderBy(p => p.id).Skip((productListView.page.currentPage - 1) * productListView.page.itemCount).Take(productListView.page.itemCount).ToList(); } return(View(productListView)); }