2013-04-04 17 views
5

Nopcommerce2.8 sürümü üzerinde çalışıyorum. Yeni ızgara oluşturmak için telerik eklenti uygulaması ile ilgili bir sorunum var. Bir ürün için farklı müşteri için farklı fiyat vermek istediğim bir konsept uygulayarak. Yani farklı müşteriler için yeni fiyat atamak için, yönetici panelinde telerik kullanılarak ürün çeşitlendirme sayfasında bir ızgara oluşturuyorum. Bu ayrıntıları görüntülemek için yeni bir sekme oluşturdum. Müşteri adını ve fiyatı ızgarada görüntüleyebildiğim, ancak bir satır düzenledikten sonra güncelleme düğmesine tıkladığımda güncelleme işlevini arayamıyorum. Aynı güncelleme işlevini de ızgara satırını silme için çağırdım, böylece aynı güncelleme işlevini tetiklemeyi silmek için tıkladığımda. View'da bazı ayarların kaçırıldığını düşünüyorum. Lütfen bu güncelleme sorununu çözmek için bana yardımcı olun.nopcommerce'de Telerik pluggin kullanarak özel ızgara 2.8

Nopcommerce'ımın modeli, görünümü ve denetleyicisi aşağıda verilmiştir.

Teşekkürler.

//Model 
using System.Collections.Generic; 
using System.ComponentModel.DataAnnotations; 
using System.Web.Mvc; 
using FluentValidation.Attributes; 
using Nop.Admin.Models.Customers; 
using Nop.Admin.Validators.Catalog; 
using Nop.Web.Framework; 
using Nop.Web.Framework.Localization; 
using Nop.Web.Framework.Mvc; 
using Telerik.Web.Mvc; 

namespace Nop.Admin.Models.Catalog 
{ 
    public partial class CustomerProductPriceModel : BaseNopModel 
    { 
     public int Customer_Id { get; set; } 
     [NopResourceDisplayName("Customer Name")] 
     public string Customer_name { get; set; } 

     [NopResourceDisplayName("Price")] 
     public decimal Price { get; set; } 

     [NopResourceDisplayName("Unit")] 
     public string Units { get; set; } 

    } 
} 

// view 

    @(Html.Telerik().Grid<CustomerProductPriceModel>() 
     .Name("Grid") 
     .DataKeys(x => 
        { 
         x.Add(y => y.Customer_Id); 
        }) 
        .DataBinding(dataBinding => 
        { 
          dataBinding.Ajax() 
          .Select("CustomerProductPriceList", "ProductVariant", new { productVariantId = Model.Id }) 
          .Update("CustomerPriceUpdate", "ProductVariant", new { productVariantId = Model.Id }) 
          .Delete("CustomerPriceUpdate", "ProductVariant", new { productVariantId = Model.Id }); 
        }) 
     .Columns(columns => 
     { 
      columns.Bound(y => y.Customer_name).Width(200).ReadOnly(); 
      columns.Bound(y => y.Price).Width(100); 

      columns.Command(commands => 
      { 
       commands.Edit().Text(T("Admin.Common.Edit").Text); 
       commands.Delete().Text(T("Admin.Common.Delete").Text); 
      }).Width(180); 

     }) 
     .Editable(x => 
       { 
        x.Mode(GridEditMode.InLine); 
       }) 
     .EnableCustomBinding(true) 

    ) 


    // controller 

    [GridAction(EnableCustomBinding = true)] 
     public ActionResult CustomerPriceUpdate(GridCommand command, CustomerProductPriceModel model, int productVariantId) 
     { 
      if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) 
       return AccessDeniedView(); 


      return CustomerProductPriceList(command, productVariantId); 
     } 


     [HttpPost, GridAction(EnableCustomBinding = true)] 
     public ActionResult CustomerProductPriceList(GridCommand command, int productVariantId) 
     { 
      if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) 
       return AccessDeniedView(); 

      var productVariant = _productService.GetProductVariantById(productVariantId); 
      if (productVariant == null) 
       throw new ArgumentException("No product variant found with the specified id"); 

      var CustomerPrices = PrepareCustomerProductPriceModel(productVariant.Product.Id); 
      var CustomerPricesa = CustomerPrices 
       .Select(x => 
       { 
        return new CustomerProductPriceModel() 
        { 
         Customer_Id = x.Customer_Id, 
         Price = x.Price, 
         Units = x.Units, 
         Customer_name = x.Customer_name 
        }; 
       }) 
       .ToList(); 
      var model = new GridModel<CustomerProductPriceModel> 
      { 
       Data = CustomerPricesa, 
       Total = CustomerPrices.Count 
      }; 
      return new JsonResult 
      { 
       Data = model 
      }; 
     } 
+1

Aradıgınız Grid Güncellemesi ve Silme için CustomerPriceUpdate adlı denetleyiciden aynı eylem – snowp

cevap

0

yerleşik müşteri fiyat seviyelerinde zaten nopCommerce yerinde, veya tek seferde tüm fiyatlar görüntülemek isteyen kullanmamak için bir neden var mı?

İlgili konular