public async Task <IActionResult> Oi1(int VendorID)
        {
            if (VendorID <= 0)
            {
                return(RedirectToAction("Vendors"));
            }

            var model = new VendorListModel();

            model.SelectedVendorId = VendorID;

            //costcenter list
            foreach (var item in (await _costCenterService.SelectCostCenter((int)_workContext.CurrentCustomer.ClientId,
                                                                            (int)_workContext.CurrentCustomer.UserType,
                                                                            (int)_workContext.CurrentCustomer.LogonId)))
            {
                if (!string.IsNullOrEmpty(item.Both) && !string.IsNullOrEmpty(item.Sid.ToString()))
                {
                    model.AvailableCostCenter.Add(new SelectListItem {
                        Text = item.Both, Value = item.Sid.ToString()
                    });
                }
            }

            return(View(model));
        }
Esempio n. 2
0
        /// <summary>
        /// Prepare paged vendor list model
        /// </summary>
        /// <param name="searchModel">Vendor search model</param>
        /// <returns>Vendor list model</returns>
        public virtual VendorListModel PrepareVendorListModel(VendorSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get vendors
            var vendors = _vendorService.GetAllVendors(showHidden: true,
                                                       name: searchModel.SearchName,
                                                       pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize);

            //prepare list model
            var model = new VendorListModel().PrepareToGrid(searchModel, vendors, () =>
            {
                //fill in model values from the entity
                return(vendors.Select(vendor =>
                {
                    var vendorModel = vendor.ToModel <VendorModel>();
                    vendorModel.SeName = _urlRecordService.GetSeName(vendor, 0, true, false);

                    return vendorModel;
                }));
            });

            return(model);
        }
        public ActionResult List()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageVendors))
                return AccessDeniedView();

            var model = new VendorListModel();
            return View(model);
        }
Esempio n. 4
0
        public virtual IActionResult List()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageVendors))
            {
                return(AccessDeniedView());
            }

            var model = new VendorListModel();

            return(View(model));
        }
Esempio n. 5
0
        public async Task <IActionResult> Items(DataSourceRequest command,
                                                VendorListModel model)
        {
            var(vendorListModel, totalCount) = await _selectItemsServices.PrepareVendorListModel(model, command.Page, command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data  = vendorListModel.ToList(),
                Total = totalCount
            };

            return(Json(gridModel));
        }
Esempio n. 6
0
        public IActionResult List(DataSourceRequest command, VendorListModel model)
        {
            var vendors   = _vendorService.GetAllVendors(model.SearchName, command.Page - 1, command.PageSize, true);
            var gridModel = new DataSourceResult
            {
                Data = vendors.Select(x =>
                {
                    var vendorModel = x.ToModel();
                    return(vendorModel);
                }),
                Total = vendors.TotalCount,
            };

            return(Json(gridModel));
        }
        public async Task <IActionResult> SelectPage(VendorListModel model)
        {
            var vendor = (await _selectItemsServices.GetVendorList((int)_workContext.CurrentCustomer.ClientId)).Where(v => v.VendorId == model.SelectedVendorId).FirstOrDefault();

            if (vendor == null)
            {
                return(RedirectToAction("Vendors"));
            }

            switch (vendor.Vtype)
            {
            case 2: return(RedirectToAction("OI2", new { VendorID = model.SelectedVendorId }));

            default: return(RedirectToAction("Oi1", new { VendorID = model.SelectedVendorId }));
            }
        }
Esempio n. 8
0
        public VendorListModel SearchVendorList(VendorSearchRequest p)
        {
            var items = _vendorService.GetAllVendors(p.Name);

            var vendors = CreateVendorModelList(items);

            var vendorListModel = new VendorListModel();

            vendorListModel.Vendors         = vendors;
            vendorListModel.HasNextPage     = items.HasNextPage;
            vendorListModel.HasPreviousPage = items.HasPreviousPage;
            vendorListModel.PageIndex       = items.PageIndex;
            vendorListModel.PageSize        = items.PageSize;
            vendorListModel.TotalCount      = items.TotalCount;
            vendorListModel.TotalPages      = items.TotalPages;
            return(vendorListModel);
        }
Esempio n. 9
0
        public async Task <IActionResult> SetupEdit()
        {
            var model = new VendorListModel();

            //vendor list
            foreach (var item in (await _selectItemsServices.GetVendorList((int)_workContext.CurrentCustomer.ClientId)))
            {
                if (!string.IsNullOrEmpty(item.Vname) && !string.IsNullOrEmpty(model.VendorID.ToString()))
                {
                    model.AvailableVendors.Add(new SelectListItem {
                        Text = item.Vname, Value = item.VendorId.ToString()
                    });
                }
            }

            return(View(model));
        }
Esempio n. 10
0
        public ActionResult List(DataSourceRequest command, VendorListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageVendors))
                return AccessDeniedView();

            var vendors = _vendorService.GetAllVendors(model.SearchName, command.Page - 1, command.PageSize, true);
            var gridModel = new DataSourceResult
            {
                Data = vendors.Select(x =>
                {
                    var vendorModel = x.ToModel();
                    PrepareVendorModel(vendorModel, x, false, false);
                    return vendorModel;
                }),
                Total = vendors.TotalCount,
            };

            return Json(gridModel);
        }
Esempio n. 11
0
        /// <summary>
        /// Prepare paged vendor list model
        /// </summary>
        /// <param name="searchModel">Vendor search model</param>
        /// <returns>Vendor list model</returns>
        public virtual VendorListModel PrepareVendorListModel(VendorSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get vendors
            var vendors = _vendorService.GetAllVendors(showHidden: true,
                                                       name: searchModel.SearchName,
                                                       pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize);

            //prepare list model
            var model = new VendorListModel
            {
                //fill in model values from the entity
                Data  = vendors.Select(vendor => vendor.ToModel <VendorModel>()),
                Total = vendors.TotalCount
            };

            return(model);
        }
Esempio n. 12
0
        public List <VendorListModel> GetVendorsList(bool FirstElementEmpty)
        {
            var model        = new List <VendorListModel>();
            var _vendorsList = _vendorService.GetVendorsList().Where(v => v.Deleted.Equals(false)).ToList();

            var vendorListMapper = new ecvMapper <VendorListDTO, VendorListModel>();

            model = vendorListMapper.CreateMappedObject(_vendorsList);

            model = model.OrderBy(m => m.Name).ToList();

            if (FirstElementEmpty.Equals(true))
            {
                VendorListModel singleVendorListModel = null;
                singleVendorListModel      = new VendorListModel();
                singleVendorListModel.Id   = 0;
                singleVendorListModel.Name = "[None]";

                model.Insert(0, singleVendorListModel);
            }

            return(model);
        }
Esempio n. 13
0
        public IActionResult List()
        {
            var model = new VendorListModel();

            return(View(model));
        }
        public async Task <(IEnumerable <VendorsDisplay> vendorModel, int totalCount)> PrepareVendorListModel(VendorListModel model, int pageIndex, int pageSize)
        {
            var query = from v in _vendorRepository.Table
                        join i in _itemRepository.Table on v.VendorId equals i.VendorId
                        select new VendorsDisplay
            {
                VendorID    = v.VendorId,
                VItemID     = i.VitemId,
                VItem       = i.Vitem,
                Manufacture = i.MfgAbb,
                Description = i.Vdescription,
                Unit        = i.Uom,
                Pkg         = i.Pkg,
                Price       = i.SellingPrice,
                GL          = i.Gl
            };

            query = query.Where(c => c.VendorID == model.SelectedVendorId);

            //Sorting
            if (model.SortBy == 1)
            {
                query = query.OrderBy(c => c.VItem);
            }

            if (model.SortBy == 2)
            {
                query = query.OrderBy(c => c.Description);
            }

            if (model.SortBy == 3)
            {
                query = query.OrderBy(c => c.Manufacture);
            }


            var vendorListModel = query.ToList();

            int totalCount = vendorListModel.Count;
            int pageOffSet = (Convert.ToInt32(pageIndex) - 1) * 10;

            vendorListModel = vendorListModel.Skip(pageOffSet).Take(Convert.ToInt32(pageSize)).ToList();

            return(vendorListModel, totalCount);
        }
Esempio n. 15
0
        public async Task <(IEnumerable <VendorModel> vendorListModel, int totalCount)> PrepareVendorListModel(VendorListModel model, int pageIndex, int pageSize)
        {
            var vendors = _vendorRepository.Table.Where(v => v.ClientId == model.ClientId);

            var vendorlistModel = new List <VendorModel>();

            foreach (var item in vendors)
            {
                vendorlistModel.Add(new VendorModel
                {
                    CreateDate = item.CreateDate,
                    MinOrder   = item.MinOrder,
                    PayTerms   = item.PayTerms,
                    Vzip       = item.Vzip,
                    Vacct      = item.Vacct,
                    Vadd1      = item.Vadd1,
                    Vcity      = item.Vcity,
                    Vcontact   = item.Vcontact,
                    Vemail     = item.Vemail,
                    VendorId   = (int)item.VendorId,
                    Vname      = item.Vname,
                    Vphone     = item.Vphone,
                    Vtype      = item.Vtype
                });
            }

            int totalCount = vendorlistModel.Count;
            int pageOffSet = (Convert.ToInt32(pageIndex) - 1) * 10;

            vendorlistModel = vendorlistModel.Skip(pageOffSet).Take(Convert.ToInt32(pageSize)).ToList();

            return(vendorlistModel, totalCount);
        }