public IActionResult Button() { string id = Request.Querys("id"); Business.SystemButton systemButton = new Business.SystemButton(); var buttons = new Business.AppLibraryButton().GetListByApplibraryId(id.ToGuid()); ViewData["buttonJSON"] = Newtonsoft.Json.JsonConvert.SerializeObject(new Business.SystemButton().GetAll()); ViewData["queryString"] = Request.UrlQuery(); ViewData["buttonOptions"] = systemButton.GetOptions(); ViewData["buttonTypeOptions"] = systemButton.GetButtonTypeOptions(); return(View(buttons)); }
public string SaveButton() { string buttonindex = Request.Forms("buttonindex"); string id = Request.Querys("id"); Business.AppLibraryButton appLibraryButton = new Business.AppLibraryButton(); var buttons = appLibraryButton.GetListByApplibraryId(id.ToGuid()); List <Tuple <Model.AppLibraryButton, int> > tuples = new List <Tuple <Model.AppLibraryButton, int> >(); foreach (var button in buttons) { if (!buttonindex.ContainsIgnoreCase(button.Id.ToString())) { tuples.Add(new Tuple <Model.AppLibraryButton, int>(button, 0)); } } foreach (string index in buttonindex.Split(',')) { string button_ = Request.Forms("button_" + index); string buttonname_ = Request.Forms("buttonname_" + index); string buttonevents_ = Request.Forms("buttonevents_" + index); string buttonico_ = Request.Forms("buttonico_" + index); string showtype_ = Request.Forms("showtype_" + index); string buttonsort_ = Request.Forms("buttonsort_" + index); if (buttonname_.IsNullOrEmpty()) { continue; } if (index.IsGuid(out Guid indexId)) { var button = buttons.Find(p => p.Id == indexId); if (null != button) { button.ButtonId = button_.ToGuid(); button.AppLibraryId = id.ToGuid(); button.Events = buttonevents_; button.Ico = buttonico_; button.IsValidateShow = 1; button.Name = buttonname_; button.ShowType = showtype_.ToInt(0); button.Sort = buttonsort_.ToInt(0); tuples.Add(new Tuple <Model.AppLibraryButton, int>(button, 1)); continue; } } var buttonModel = new Model.AppLibraryButton { Id = Guid.NewGuid(), ButtonId = button_.ToGuid(), AppLibraryId = id.ToGuid(), Events = buttonevents_, Ico = buttonico_, IsValidateShow = 1, Name = buttonname_, ShowType = showtype_.ToInt(0), Sort = buttonsort_.ToInt(0) }; tuples.Add(new Tuple <Model.AppLibraryButton, int>(buttonModel, 2)); } int i = appLibraryButton.Update(tuples); Business.Log.Add("保存了应用程序库按钮-影响行数-" + i, Newtonsoft.Json.JsonConvert.SerializeObject(tuples), Business.Log.Type.系统管理); return("保存成功!"); }