public IActionResult AddProduct()
        {
            ProductInputVM vm = new ProductInputVM();

            var brands     = _reposBrand.GetBrands();
            var categories = _reposCategory.GetCategories();

            vm.Brands     = brands.Select(b => new SelectListItem(b.Name, b.Id.ToString())).ToList();
            vm.Categories = categories.Select(c => new SelectListItem(c.Name, c.Id.ToString())).ToList();
            return(View(vm));
        }
        // GET: ProductSearch
        public async Task <IActionResult> Search()
        {
            var ucCategories = await _category.GetCategories();

            var ucCategoryList = ucCategories.Select(c => new Category
            {
                Id   = c.Id,
                Name = c.Name
            }).ToList();

            var ucBrands = await _brand.GetBrands();

            var ucBrandList = ucBrands.Select(c => new Brand
            {
                Id   = c.Id,
                Name = c.Name
            }).ToList();

            var localCategories = await _context.Categories.Where(c => c.Active == true).ToListAsync();

            var localBrands = await _context.Brands.Where(c => c.Active == true).ToListAsync();

            var categories = localCategories.Concat(ucCategoryList);
            var brands     = localBrands.Concat(ucBrandList);

            var viewModel = new ProductDrillDown {
            };

            ViewData["CategoryId"] = new SelectList(categories, "Id", "Name");
            ViewData["BrandId"]    = new SelectList(brands, "Id", "Name");

            return(View(viewModel));
        }
Ejemplo n.º 3
0
    //产品类型品牌选择
    public string ProductType_BrandSelect_BAK(IList <BrandInfo> ProductType_Brands)
    {
        string brand_select;

        brand_select = "";
        bool Is_target           = false;
        IList <BrandInfo> Brands = new List <BrandInfo>();

        QueryInfo Query = new QueryInfo();

        Query.PageSize    = 0;
        Query.CurrentPage = 1;
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "BrandInfo.Brand_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo("BrandInfo.Brand_Sort", "asc"));
        Brands = MyBrand.GetBrands(Query, Public.GetUserPrivilege());

        if (Brands != null)
        {
            foreach (BrandInfo entity in Brands)
            {
                Is_target = false;
                if (ProductType_Brands != null)
                {
                    foreach (BrandInfo producttype_brand in ProductType_Brands)
                    {
                        if (producttype_brand.Brand_ID == entity.Brand_ID)
                        {
                            Is_target = true;
                        }
                    }
                    if (Is_target == true)
                    {
                        brand_select = brand_select + " <input type=\"checkbox\" name=\"ProductType_Brand\" value=\"" + entity.Brand_ID + "\" checked> " + entity.Brand_Name;
                    }
                    else
                    {
                        brand_select = brand_select + " <input type=\"checkbox\" name=\"ProductType_Brand\" value=\"" + entity.Brand_ID + "\"> " + entity.Brand_Name;
                    }
                }
                else
                {
                    brand_select = brand_select + " <input type=\"checkbox\" name=\"ProductType_Brand\" value=\"" + entity.Brand_ID + "\"> " + entity.Brand_Name;
                }
            }
        }
        return(brand_select);
    }
Ejemplo n.º 4
0
 public FrmBrands(IBrand brand)
 {
     _brand = brand;
     brands = _brand.GetBrands();
     SetDatagridViewElements(brands);
     this.ClearProperties();
     this.lblTitle.Text = "MARCAS";
 }
Ejemplo n.º 5
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var items = await _brand.GetBrands();

            List <BrandViewModel> viewModels = _mapper.Map <List <BrandViewModel> >(items);

            return(View(viewModels));
        }
Ejemplo n.º 6
0
    //最新品牌
    public BrandInfo GetLastBrandInfo()
    {
        QueryInfo Query = new QueryInfo();

        Query.PageSize    = 1;
        Query.CurrentPage = 1;
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "BrandInfo.Brand_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo("BrandInfo.Brand_ID", "Desc"));
        IList <BrandInfo> Brands = brand.GetBrands(Query, Public.GetUserPrivilege());

        if (Brands != null)
        {
            return(Brands[0]);
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 7
0
        private void AddReplaceEvent(object sender, EventArgs e)
        {
            var name = this.txtName.Text;

            if (ValidatorManager.IsValid(TypeValidation.WORD, name))
            {
                DialogResult result = MessageBox.Show("¿Estás seguro que deseas " + btnGuardar.Text + " la marca " + name + "?", "", MessageBoxButtons.OKCancel);
                if (result.Equals(DialogResult.OK))
                {
                    MessageModel message = null;
                    if (btnGuardar.Text.ToLower().Equals("guardar"))
                    {
                        message = _brand.SetItem(new BrandModel()
                        {
                            Name = name
                        });
                    }
                    else
                    {
                        message = _brand.UpdateItem(new BrandModel()
                        {
                            Name = name, Id = idSelected
                        });

                        message = _brand.UpdateStateItem(new BrandModel()
                        {
                            State = (this.rdoActive.Checked)?0:1, Id = idSelected
                        });
                    }
                    if (message.Code == 200)
                    {
                        this.dgvCatalog.DataSource = _brand.GetBrands();
                        this.ClearProperties();
                    }
                    else
                    {
                        MessageBox.Show(message.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("Debes completar todos los parametros antes de realizar el proceso");
            }
        }
Ejemplo n.º 8
0
 public IEnumerable <Brand> GetBrands()
 {
     return(_brandRepository.GetBrands());
 }