예제 #1
0
        public ActionResult ListWeighScales(Boolean? showInactive, int page = 1, int itemsperpage = 10, string srchParam = "")
        {
            try
            {
                if (itemsperpage != null)
                {
                    ViewModelBase.ItemsPerPage = itemsperpage;
                }
                bool showinactive = false;
                if (showInactive != null)
                    showinactive = (bool)showInactive;
                ViewBag.srchParam = srchParam;
                ViewBag.showInactive = showinactive;
                if (TempData["msg"] != null)
                {
                    ViewBag.msg = TempData["msg"].ToString();
                    TempData["msg"] = null;
                }

                var currentPageIndex = page-1 < 0 ? 0 : page-1;
                var take = itemsperpage;
                var skip = take*currentPageIndex;

                var query = new QueryEquipment
                    {
                        Name = srchParam,
                        ShowInactive = showinactive,
                        Skip = skip,
                        Take = take,
                        EquipmentType = (int) EquipmentType.WeighingScale
                    };

                var ls = _scaleViewModelBuilder.Query(query);
                
                var data = ls.Data;
                var total = ls.Count;
                return View(data.ToPagedList(currentPageIndex, take, total));
            }
            catch (Exception ex)
            {
                _log.Debug("Failed to list hubs " + ex.Message);
                _log.Error("Failed to list hubs" + ex.ToString());
                return View();
            }
        }
예제 #2
0
        public ActionResult ListPrinters(Boolean? showInactive, int page=1, int itemsperpage=10, string srchParam="")
        {
            try
            {
                if (itemsperpage != null)
                {
                    ViewModelBase.ItemsPerPage = itemsperpage;
                }
                bool showinactive = false;
                if (showInactive != null)
                    showinactive = (bool)showInactive;
                ViewBag.srchParam = srchParam;
                ViewBag.showInactive = showinactive;
                if (TempData["msg"] != null)
                {
                    ViewBag.msg = TempData["msg"].ToString();
                    TempData["msg"] = null;
                }
                //var ls = _printerViewModelBuilder.GetAll(showinactive);

                int take = itemsperpage;
                int currentPageIndex = page - 1 < 0 ? 0 : page - 1;
                int skip = take*currentPageIndex;
                
                var query = new QueryEquipment {Name = srchParam, ShowInactive = showinactive, Skip = skip, Take = take,EquipmentType =(int)EquipmentType.Printer};

             /*   var ls = _printerViewModelBuilder.Query(query);
                var data = ls.Data.OfType<Printer>().ToList();
                var results = _printerViewModelBuilder.QueryList(data);
                var total = ls.Count;
                //int currentPageIndex = page.HasValue ? page.Value - 1 : 0;*/

                var ls = _printerViewModelBuilder.Query(query);
                var total = ls.Count;
                var data = ls.Data;
                return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, total));
            }
            catch (Exception ex)
            {
                _log.Debug("Failed to list printers " + ex.Message);
                _log.Error("Failed to list printers" + ex.ToString());
                return View();
            }
        }
예제 #3
0
        public QueryResult<VehicleViewModel> Query(QueryEquipment query)
        {
            var queryResult = _vehicleRepository.Query(query);

            var result = new QueryResult<VehicleViewModel>();

            result.Data = queryResult.Data.Select(Map).ToList();
            result.Count = queryResult.Count;

            return result;
        }
        public QueryResult<WeighScaleViewModel> Query(QueryEquipment query)
        {
            var queryResults = _equipmentRepository.Query(query);

            var results = new QueryResult<WeighScaleViewModel>();
            results.Data = queryResults.Data.OfType<WeighScale>().Select(Map).ToList();
            results.Count = queryResults.Count;

            return results;
        }
        public QueryResult<SourcingContainerViewModel> Query(QueryEquipment query)
        {
            var queryResults = _equipmentRepository.Query(query);

            var results = new QueryResult<SourcingContainerViewModel>();
            results.Data = queryResults.Data.OfType<SourcingContainer>().Select(Map).ToList();
            results.Count = queryResults.Count;

            return results;
        }