public ActionResult SaveSolution(int?id) { ViewBag.Modes = ListToSelect(SysDataDictService.GetDictionaryList(Logic.DicType.返利模式).Select(o => new SelectListItem() { Value = o.DicSN.ToString(), Text = o.Title })); ViewBag.Suppliers = ListToSelect(SupplierService.GetList().Where(o => o.BusinessType == 1).Select(o => new SelectListItem() { Value = o.Id, Text = o.FullTitle }), emptyTitle: "请选择"); var obj = PrivilegeOrderService.GetObj(id); return(View(obj.IsNullThrow())); }
public ActionResult SetProduct(int?id) { var obj = PrivilegeOrderService.GetObj(id, false); var data = SysDataDictService.Find(o => o.DicSN == obj.ModeSN); if (obj != null) { obj.ModeTitle = data.Title; } List <DropdownItem> parents = null; if (obj.SupplierIds.IsNullOrEmpty()) { parents = ProductCategoryService.GetParentTypes().Select(o => new DropdownItem() { Value = o.CategorySN.ToString(), Text = o.Title }).ToList(); } else { var sp = obj.SupplierIds.Split(',').ToList(); var bars = BaseService <ProductMultSupplier> .FindList(o => sp.Contains(o.SupplierId)).Select(o => o.Barcode).Distinct().ToList(); var categorys = BaseService <VwProduct> .FindList(o => sp.Contains(o.SupplierId) || bars.Contains(o.Barcode)).Select(o => o.CategorySN).Distinct().ToList(); parents = ProductCategoryService.GetRootSNs(categorys).Select(o => new DropdownItem() { Value = o.CategorySN.ToString(), Text = o.Title }).ToList();; } parents.Insert(0, new DropdownItem("", "请选择")); ViewBag.parenttypes = parents.ToJson(); ViewBag.types = PrivilegeOrderService.LoadTypeDetailJson(id); ViewBag.products = PrivilegeOrderService.LoadProductDetailJson(id); return(View(obj.ModeSN == 46 ? "SetProduct2" : "SetProduct", obj.IsNullThrow())); }