//初始化功能命令关系 /// <summary> /// 初始化功能命令关系 /// </summary> private void InitFuncCommands(RightFunction rightFunction) { if (rightFunction == null) { return; } var list = RightLkFunctionCommandBll.QueryRightLkFunctionCommand(new QueryCondition { Resv01 = rightFunction.Sysid }); gridViewCommand.ValueChanging -= gridViewCommand_ValueChanging; _commandsInDb = new List <DictionaryItem>(); foreach (var row in gridViewCommand.Rows) { var command = row.DataBoundItem as DictionaryItem; if (command == null) { continue; } var isChecked = list.FindAll(p => p.CommandSysid == command.Sysid).Count > 0; if (isChecked) { var copiedCommand = Mapper.Map <DictionaryItem, DictionaryItem>(command); _commandsInDb.Add(copiedCommand); } row.Cells[0].Value = isChecked; } gridViewCommand.ValueChanging += gridViewCommand_ValueChanging; }
//保存数据 /// <summary> /// 保存数据 /// </summary> /// <returns></returns> internal override bool Submit() { if (CurrentOperationStatus == OperationStatus.Default) { return(false); } List <RightLkFunctionCommand> deleteList; var insertlist = BuildEntity(out deleteList); var rightFunction = gridViewFunc.SelectedRows[0].DataBoundItem as RightFunction; if (rightFunction == null) { return(false); } var result = RightLkFunctionCommandBll.Save(insertlist, deleteList); string msg; if (result) { msg = "保存成功"; CurrentOperationStatus = OperationStatus.Default; } else { msg = "保存失败"; CurrentOperationStatus = OperationStatus.Edit; } UI.ShowInfo(msg); return(result); }