public ActionResult SaveSql(int verId) { var pmenus = new List <DropdownItem>(); var obj = ProductPublishVerService.Get(verId); var menuModelId = ""; var runSqlWay = 1; if (obj != null) { ViewBag.products = ListToSelect(ProductVerService.GetList().Select(o => new SelectListItem() { Text = "(" + o.ProductId + ")" + o.SysName, Value = o.ProductId.ToString() }), emptyTitle: "请选择", selectValue: obj.ProductId); ViewBag.state = obj.VerStatusTitle + "," + obj.StatusTitle; ViewBag.status = obj.VerCode == 0 ? "--" : "v" + obj.VerCode.ToString("f1"); ProductModuleVer model = null; if (!obj.MenuModuleId.IsNullOrEmpty()) { model = ProductModelVerService.Get(obj.MenuModuleId); } else { model = ProductModelVerService.GetOfficialLast(obj.ProductId); } if (model != null) { menuModelId = model.ModuleId; pmenus.AddRange(model.ProductMenuLimits.Where(o => o.PMenuId <= 0).OrderBy(o => o.SortOrder).Select(o => new DropdownItem() { Text = o.Title, Value = o.MenuId.ToString() })); } if (pmenus.Any()) { pmenus[0].IsSelected = true; } runSqlWay = obj.RunSqlWay == 2?2:1; } else { ViewBag.products = ListToSelect(ProductVerService.GetList(1).Select(o => new SelectListItem() { Text = "(" + o.ProductId + ")" + o.SysName, Value = o.ProductId.ToString() }), emptyTitle: "请选择"); ViewBag.state = "未发布,未生效"; ViewBag.status = "--"; } ViewBag.pmenus = pmenus.ToJson(); ViewBag.menuModelId = menuModelId; ViewBag.runSqlWay = runSqlWay; return(View()); }
public ActionResult Save(int?verId) { if (verId.HasValue) { ViewBag.products = ListToSelect(ProductVerService.GetList().Select(o => new SelectListItem() { Text = "(" + o.ProductId + ")" + o.SysName, Value = o.ProductId.ToString() }), emptyTitle: "请选择"); } else { ViewBag.products = ListToSelect(ProductPublishVerService.GetProductVers().Select(o => new SelectListItem() { Text = "(" + o.ProductId + ")" + o.SysName, Value = o.ProductId.ToString() }), emptyTitle: "请选择"); } ProductPublishVer ver = verId.HasValue ?ProductPublishVerService.Get(verId.Value):new ProductPublishVer(); return(View(ver)); }