private void btnMoveDown_Click(object sender, EventArgs e) { if (!Save(false)) { return; } if (this.treeList1.FocusedNode != null) { if (this.treeList1.FocusedNode.NextNode != null) { try { MenuInfoModel nextModel = (MenuInfoModel)this.treeList1.GetDataRecordByNode(this.treeList1.FocusedNode.NextNode); MenuInfoModel curModel = (MenuInfoModel)this.treeList1.GetDataRecordByNode(this.treeList1.FocusedNode); int nextSort = nextModel.MenuSort; nextModel.MenuSort = curModel.MenuSort; curModel.MenuSort = nextSort; MenuInfoBLL bll = new MenuInfoBLL(); bll.Update(nextModel); bll.Update(curModel); this.treeList1.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("已是最后节点,无法下移!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } }
public ActionResult EditMenuForm(MenuInfo mi) { int k = menuInfoBll.Update(mi); new LogMessage().Save("ID:" + mi.MenuId + "。"); if (k == 1) { return(JavaScript("editFormSucceed();")); } else { return(JavaScript("editFormError();")); } }
private void updateChildNodeSort(TreeListNode node) { if (node.Nodes.Count > 0) { int iSort = 10; MenuInfoBLL bll = new MenuInfoBLL(); for (int i = 0; i < node.Nodes.Count; i++) { MenuInfoModel model = (MenuInfoModel)treeList1.GetDataRecordByNode(node.Nodes[i]); model.MenuSort = iSort; bll.Update(model); iSort += 10; updateChildNodeSort(node.Nodes[i]); } } }
private void btnRefreshSort_Click(object sender, EventArgs e) { if (!Save(false)) { return; } if (this.treeList1.Nodes.Count > 0) { int iSort = 10; MenuInfoBLL bll = new MenuInfoBLL(); for (int i = 0; i < treeList1.Nodes.Count; i++) { MenuInfoModel model = (MenuInfoModel)treeList1.GetDataRecordByNode(this.treeList1.Nodes[i]); model.MenuSort = iSort; bll.Update(model); iSort += 10; updateChildNodeSort(this.treeList1.Nodes[i]); } this.treeList1.RefreshDataSource(); } }